From dbde4a09a7e6a07bb686c6a4dd51084cafc8ffee Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sat, 25 Mar 1995 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1995-03-25 --- port/devsd.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/port/devsd.c b/port/devsd.c index 3ece09fd15a1c1b7babe209176a80fa2f50aa3cf..c2439bafbcaf8e202755b60d72232c45e2401c58 100644 --- a/port/devsd.c +++ b/port/devsd.c @@ -52,7 +52,7 @@ static void sdrdpart(Disk*); static long sdio(Chan*, int, char*, ulong, ulong); static int -sdgen(Chan *c, Dirtab *tab, long ntab, long s, Dir *dirp) +sdgen(Chan *c, Dirtab*, long, long s, Dir *dirp) { Qid qid; Disk *d; @@ -60,8 +60,6 @@ sdgen(Chan *c, Dirtab *tab, long ntab, long s, Dir *dirp) int unit; char name[2*NAMELEN]; - USED(tab, ntab); - d = disk; while(s >= d->npart) { s -= d->npart; @@ -183,23 +181,20 @@ sdopen(Chan *c, int omode) } void -sdcreate(Chan *c, char *name, int omode, ulong perm) +sdcreate(Chan*, char*, int, ulong) { - USED(c, name, omode, perm); error(Eperm); } void -sdremove(Chan *c) +sdremove(Chan*) { - USED(c); error(Eperm); } void -sdwstat(Chan *c, char *dp) +sdwstat(Chan*, char*) { - USED(c, dp); error(Eperm); } @@ -209,22 +204,19 @@ sdclose(Chan *c) Disk *d; Part *p; - if(c->mode != OWRITE && c->mode != ORDWR) + if(c->qid.path & CHDIR) return; -print("sdclose: qid 0x%lux drive %d, part %d\n", c->qid, DRIVE(c->qid), PART(c->qid)); d = &disk[DRIVE(c->qid)]; p = &d->table[PART(c->qid)]; - if(strcmp(p->name, "partition")) - return; - - sdrdpart(d); + if((c->mode&3) != OREAD && strcmp(p->name, "partition") == 0) + sdrdpart(d); } long sdread(Chan *c, void *a, long n, ulong offset) { - if(c->qid.path == CHDIR) + if(c->qid.path & CHDIR) return devdirread(c, a, n, 0, 0, sdgen); return sdio(c, 0, a, n, offset);