ref: 9429dd64f746ebf9afc634f50f3f88d9408cfa7e
parent: 2c67fb9794369eea87c0d2179560f8f79198d34c
author: Jacob Moody <[email protected]>
date: Sun May 15 01:44:59 EDT 2022
kernel: disable wstat for devpipe
--- a/sys/src/9/port/devpipe.c
+++ b/sys/src/9/port/devpipe.c
@@ -14,7 +14,6 @@
Pipe *next;
int ref;
ulong path;
- long perm;
Queue *q[2];
int qref[2];
};
@@ -35,10 +34,9 @@
Dirtab pipedir[] =
{
".", {Qdir,0,QTDIR}, 0, DMDIR|0500,
- "data", {Qdata0}, 0, 0600,
- "data1", {Qdata1}, 0, 0600,
+ "data", {Qdata0}, 0, 0666,
+ "data1", {Qdata1}, 0, 0666,
};
-#define NPIPEDIR 3
static void
pipeinit(void)
@@ -86,7 +84,6 @@
lock(&pipealloc);
p->path = ++pipealloc.path;
unlock(&pipealloc);
- p->perm = pipedir[Qdata0].perm;
mkqid(&c->qid, NETQID(2*p->path, Qdir), 0, QTDIR);
c->aux = p;
@@ -123,7 +120,7 @@
break;
}
mkqid(&q, NETQID(NETID(c->qid.path), tab->qid.path), 0, QTFILE);
- devdir(c, q, tab->name, len, eve, p->perm, dp);
+ devdir(c, q, tab->name, len, eve, tab->perm, dp);
return 1;
}
@@ -134,7 +131,7 @@
Walkqid *wq;
Pipe *p;
- wq = devwalk(c, nc, name, nname, pipedir, NPIPEDIR, pipegen);
+ wq = devwalk(c, nc, name, nname, pipedir, nelem(pipedir), pipegen);
if(wq != nil && wq->clone != nil && wq->clone != c){
p = c->aux;
qlock(p);
@@ -160,18 +157,22 @@
{
Pipe *p;
Dir dir;
+ ulong path;
+ Dirtab *d;
p = c->aux;
+ path = NETTYPE(c->qid.path);
+ d = pipedir + path;
- switch(NETTYPE(c->qid.path)){
+ switch(path){
case Qdir:
- devdir(c, c->qid, ".", 0, eve, 0555, &dir);
+ devdir(c, c->qid, d->name, 0, eve, d->perm, &dir);
break;
case Qdata0:
- devdir(c, c->qid, "data", qlen(p->q[0]), eve, p->perm, &dir);
+ devdir(c, c->qid, d->name, qlen(p->q[0]), eve, d->perm, &dir);
break;
case Qdata1:
- devdir(c, c->qid, "data1", qlen(p->q[1]), eve, p->perm, &dir);
+ devdir(c, c->qid, d->name, qlen(p->q[1]), eve, d->perm, &dir);
break;
default:
panic("pipestat");
@@ -182,36 +183,6 @@
return n;
}
-static int
-pipewstat(Chan* c, uchar* db, int n)
-{
- int m;
- Dir *dir;
- Pipe *p;
-
- p = c->aux;
- if(strcmp(up->user, eve) != 0)
- error(Eperm);
- if(NETTYPE(c->qid.path) == Qdir)
- error(Eisdir);
-
- dir = smalloc(sizeof(Dir)+n);
- if(waserror()){
- free(dir);
- nexterror();
- }
- m = convM2D(db, n, &dir[0], (char*)&dir[1]);
- if(m == 0)
- error(Eshortstat);
- if(!emptystr(dir[0].uid))
- error("can't change owner");
- if(dir[0].mode != ~0UL)
- p->perm = dir[0].mode;
- poperror();
- free(dir);
- return m;
-}
-
/*
* if the stream doesn't exist, create it
*/
@@ -309,7 +280,7 @@
switch(NETTYPE(c->qid.path)){
case Qdir:
- return devdirread(c, va, n, pipedir, NPIPEDIR, pipegen);
+ return devdirread(c, va, n, pipedir, nelem(pipedir), pipegen);
case Qdata0:
return qread(p->q[0], va, n);
case Qdata1:
@@ -424,5 +395,5 @@
pipewrite,
pipebwrite,
devremove,
- pipewstat,
+ devwstat,
};