vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

commit f9af6420760c094569be2236cf6e53ca71b97fb8
parent 2f261d817009cf63adb07044fc3955ef0388f013
Author: Russ Cox <rsc@swtch.com>
Date:   Tue,  9 Dec 2008 01:35:48 -0800

9vx: report type=M in dirstat of #Z

Diffstat:
src/9vx/a/devmnt.c | 2+-
src/9vx/devfs-posix.c | 20++++++++++++--------
2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/9vx/a/devmnt.c b/src/9vx/a/devmnt.c @@ -81,7 +81,7 @@ void (*mntstats)(int, Chan*, uvlong, ulong); static void mntreset(void) { - mntalloc.id = 1; + mntalloc.id = 10; /* 1-9 are reserved for devfs */ mntalloc.tagmask[0] = 1; /* don't allow 0 as a tag */ mntalloc.tagmask[NMASK-1] = 0x80000000UL; /* don't allow NOTAG */ fmtinstall('F', fcallfmt); diff --git a/src/9vx/devfs-posix.c b/src/9vx/devfs-posix.c @@ -100,20 +100,20 @@ fsattach(char *spec) struct stat st; Chan *c; UnixFd *ufd; - static int nattach; - int plan9; - + int plan9, dev; + + dev = 1; plan9 = 0; if(spec && spec[0]){ - if(strcmp(spec, "plan9") == 0) + if(strcmp(spec, "plan9") == 0) { plan9 = 1; - else{ + dev = 2; + } else{ snprint(up->genbuf, sizeof up->genbuf, "no file system #%C%s", FsChar, spec); error(up->genbuf); } } - if(plan9){ if(localroot == nil) error("no #Zplan9 root without -r"); @@ -131,7 +131,7 @@ fsattach(char *spec) ufd->fd = -1; c->aux = ufd; - c->dev = nattach++; + c->dev = dev; c->qid = fsqid(&st); if(Trace) @@ -300,7 +300,11 @@ fsdirstat(char *path, int dev, Dir *d) d->length = disksize(fd, &st); close(fd); } - d->type = FsChar; + + // devmnt leaves 1-9 unused so that we can steal them. + // it is easier for all involved if #Z shows M as the file type instead of Z. + // dev is c->dev, either 1 (#Z) or 2 (#Zplan9). + d->type = 'M'; d->dev = dev; return 0; }