ref: 56ffc907ac25b28e3640a2d1ef5b61df90f0b700
parent: 8c70c09bfdfb5857e60e2455642603a883847c14
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jun 3 19:33:35 EDT 2018
kernel: stop the practice of passing DMDIR to devir() perm argument devdir internally replicates the qid in ther perm stat field already and the practice of explicitely passing just causing confusion when done inconsistently.
--- a/sys/src/9/port/dev.c
+++ b/sys/src/9/port/dev.c
@@ -277,7 +277,7 @@
for(elem=p=c->path->s; *p; p++)
if(*p == '/')
elem = p+1;
- devdir(c, c->qid, elem, 0, eve, DMDIR|0555, &dir);
+ devdir(c, c->qid, elem, 0, eve, 0555, &dir);
n = convD2M(&dir, db, n);
if(n == 0)
error(Ebadarg);
--- a/sys/src/9/port/devdup.c
+++ b/sys/src/9/port/devdup.c
@@ -17,7 +17,7 @@
Qid q;
if(s == DEVDOTDOT){
- devdir(c, c->qid, ".", 0, eve, DMDIR|0555, dp);
+ devdir(c, c->qid, ".", 0, eve, 0555, dp);
return 1;
}
if(s == 0)
--- a/sys/src/9/port/devfs.c
+++ b/sys/src/9/port/devfs.c
@@ -811,7 +811,7 @@
qid.vers = 0;
if(c->qid.path == Qtop){
if(i == DEVDOTDOT){
- devdir(c, tqid, "#k", 0, eve, DMDIR|0775, dp);
+ devdir(c, tqid, "#k", 0, eve, 0775, dp);
return 1;
}
t = gettree(i, Optional);
@@ -820,7 +820,7 @@
return -1;
}
qid.path = mkpath(i, Qdir);
- devdir(c, qid, t->name, 0, eve, DMDIR|0775, dp);
+ devdir(c, qid, t->name, 0, eve, 0775, dp);
return 1;
}
@@ -832,7 +832,7 @@
}
if((c->qid.type & QTDIR) != 0){
if(i == DEVDOTDOT){
- devdir(c, tqid, "#k", 0, eve, DMDIR|0775, dp);
+ devdir(c, tqid, "#k", 0, eve, 0775, dp);
return 1;
}
if(treeno == 0){
@@ -857,7 +857,7 @@
if(i == DEVDOTDOT){
qid.path = mkpath(treeno, Qdir);
- devdir(c, qid, t->name, 0, eve, DMDIR|0775, dp);
+ devdir(c, qid, t->name, 0, eve, 0775, dp);
return 1;
}
dprint("no\n");
@@ -909,7 +909,7 @@
memset(&d, 0, sizeof d);
switch(p){
case Qtop:
- devdir(c, tqid, "#k", 0, eve, DMDIR|0775, &d);
+ devdir(c, tqid, "#k", 0, eve, 0775, &d);
break;
case Qctl:
devdir(c, cqid, "ctl", 0, eve, 0664, &d);
@@ -917,7 +917,7 @@
default:
t = gettree(path2treeno(p), Mustexist);
if(c->qid.type & QTDIR)
- devdir(c, c->qid, t->name, 0, eve, DMDIR|0775, &d);
+ devdir(c, c->qid, t->name, 0, eve, 0775, &d);
else{
mp = getdev(t, path2devno(p) - Qfirst, Mustexist);
q = c->qid;
--- a/sys/src/9/port/devpipe.c
+++ b/sys/src/9/port/devpipe.c
@@ -102,7 +102,7 @@
Pipe *p;
if(i == DEVDOTDOT){
- devdir(c, c->qid, "#|", 0, eve, DMDIR|0555, dp);
+ devdir(c, c->qid, "#|", 0, eve, 0555, dp);
return 1;
}
i++; /* skip . */
@@ -165,7 +165,7 @@
switch(NETTYPE(c->qid.path)){
case Qdir:
- devdir(c, c->qid, ".", 0, eve, DMDIR|0555, &dir);
+ devdir(c, c->qid, ".", 0, eve, 0555, &dir);
break;
case Qdata0:
devdir(c, c->qid, "data", qlen(p->q[0]), eve, p->perm, &dir);
--- a/sys/src/9/port/devproc.c
+++ b/sys/src/9/port/devproc.c
@@ -231,7 +231,7 @@
if(name != nil && strcmp(name, up->genbuf) != 0)
return -1;
mkqid(&qid, (s+1)<<QSHIFT, pid, QTDIR);
- devdir(c, qid, up->genbuf, 0, p->user, DMDIR|0555, dp);
+ devdir(c, qid, up->genbuf, 0, p->user, 0555, dp);
return 1;
}
if(c->qid.path == Qtrace){
--- a/sys/src/9/port/devsegment.c
+++ b/sys/src/9/port/devsegment.c
@@ -87,7 +87,7 @@
q.vers = 0;
q.path = PATH(0, Qtopdir);
q.type = QTDIR;
- devdir(c, q, "#g", 0, eve, DMDIR|0777, dp);
+ devdir(c, q, "#g", 0, eve, 0777, dp);
break;
}
@@ -104,7 +104,7 @@
q.path = PATH(s, Qsegdir);
q.type = QTDIR;
kstrcpy(up->genbuf, g->name, sizeof up->genbuf);
- devdir(c, q, up->genbuf, 0, g->uid, DMDIR|0777, dp);
+ devdir(c, q, up->genbuf, 0, g->uid, 0777, dp);
unlock(&globalseglock);
break;
case Qsegdir:
@@ -112,7 +112,7 @@
q.vers = 0;
q.path = PATH(0, Qtopdir);
q.type = QTDIR;
- devdir(c, q, "#g", 0, eve, DMDIR|0777, dp);
+ devdir(c, q, "#g", 0, eve, 0777, dp);
break;
}
/* fall through */
--- a/sys/src/9/port/devusb.c
+++ b/sys/src/9/port/devusb.c
@@ -629,7 +629,7 @@
mkqid(&q, Qep0dir+4*s, 0, QTDIR);
putep(ep);
poperror();
- devdir(c, q, up->genbuf, 0, eve, 0755, dp);
+ devdir(c, q, up->genbuf, 0, eve, 0775, dp);
if(0)ddprint("ok\n");
return 1;
--- a/sys/src/9/port/netif.c
+++ b/sys/src/9/port/netif.c
@@ -72,7 +72,7 @@
case DEVDOTDOT:
q.type = QTDIR;
q.path = 0;
- devdir(c, q, ".", 0, eve, DMDIR|0555, dp);
+ devdir(c, q, ".", 0, eve, 0555, dp);
break;
case 0:
q.path = Ncloneqid;
@@ -99,7 +99,7 @@
q.type = QTDIR;
q.path = NETQID(i, N3rdqid);
snprint(up->genbuf, sizeof up->genbuf, "%d", i);
- devdir(c, q, up->genbuf, 0, eve, DMDIR|0555, dp);
+ devdir(c, q, up->genbuf, 0, eve, 0555, dp);
break;
}
return 1;
@@ -121,7 +121,7 @@
q.type = QTDIR;
q.path = N2ndqid;
strcpy(up->genbuf, nif->name);
- devdir(c, q, up->genbuf, 0, eve, DMDIR|0555, dp);
+ devdir(c, q, up->genbuf, 0, eve, 0555, dp);
break;
case 0:
q.path = NETQID(NETID(c->qid.path), Ndataqid);