]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/cmd/9660srv/9660srv.c
make error handling in 9p service loops consistent
[plan9front.git] / sys / src / cmd / 9660srv / 9660srv.c
index 5d4d0309bc84bbe4f6f402e75b0f5cb52e46e9b4..d0bdbabe337baf27e5a415c2d1a18233a8ce0a25 100644 (file)
@@ -13,7 +13,7 @@ static void   iwalkup(Xfile*);
 static void    iwalk(Xfile*, char*);
 static void    iopen(Xfile*, int);
 static void    icreate(Xfile*, char*, long, int);
-static long    ireaddir(Xfile*, uchar*, long, long);
+static long    ireaddir(Xfile*, uchar*, vlong, long);
 static long    iread(Xfile*, char*, vlong, long);
 static long    iwrite(Xfile*, char*, vlong, long);
 static void    iclunk(Xfile*);
@@ -69,7 +69,7 @@ iattach(Xfile *root)
        dp = nil;
        haveplan9 = 0;
        for(i=VOLDESC;i<VOLDESC+100; i++){      /* +100 for sanity */
-               p = getbuf(cd->d, i);
+               p = getbuf(cd->d, i, 1);
                v = (Voldesc*)(p->iobuf);
                if(memcmp(v->byte, "\01CD001\01", 7) == 0){             /* iso */
                        if(dirp)
@@ -314,7 +314,7 @@ icreate(Xfile *f, char *name, long perm, int mode)
 }
 
 static long
-ireaddir(Xfile *f, uchar *buf, long offset, long count)
+ireaddir(Xfile *f, uchar *buf, vlong offset, long count)
 {
        Isofile *ip = f->ptr;
        Dir d;
@@ -372,7 +372,7 @@ iread(Xfile *f, char *buf, vlong offset, long count)
        while(count > 0){
                if(n > count)
                        n = count;
-               p = getbuf(f->xf->d, addr);
+               p = getbuf(f->xf->d, addr, 0);
                memmove(&buf[rcnt], &p->iobuf[o], n);
                putbuf(p);
                count -= n;
@@ -499,7 +499,7 @@ getdrec(Xfile *f, void *buf)
                        ip->offset += Sectorsize-boff;
                        continue;
                }
-               p = getbuf(f->xf->d, addr/Sectorsize);
+               p = getbuf(f->xf->d, addr/Sectorsize, 1);
                len = p->iobuf[boff];
                if(len >= 34)
                        break;
@@ -569,7 +569,6 @@ rzdir(Xfs *fs, Dir *d, int fmt, Drec *dp)
        char buf[Maxname+UTFmax+1];
        uchar *q;
        Rune r;
-       enum { ONAMELEN = 28 }; /* old Plan 9 directory name length */
 
        have = 0;
        flags = 0;
@@ -622,23 +621,23 @@ rzdir(Xfs *fs, Dir *d, int fmt, Drec *dp)
                 * from plan9 directory extension
                 */
                nl = *s;
-               if(nl >= ONAMELEN)
-                       nl = ONAMELEN-1;
+               if(nl >= Maxname)
+                       nl = Maxname-1;
                if(nl) {
-                       memset(d->name, 0, ONAMELEN);
+                       memset(d->name, 0, Maxname);
                        memmove(d->name, s+1, nl);
                }
                s += 1 + *s;
                nl = *s;
-               if(nl >= ONAMELEN)
-                       nl = ONAMELEN-1;
-               memset(d->uid, 0, ONAMELEN);
+               if(nl >= Maxname)
+                       nl = Maxname-1;
+               memset(d->uid, 0, Maxname);
                memmove(d->uid, s+1, nl);
                s += 1 + *s;
                nl = *s;
-               if(nl >= ONAMELEN)
-                       nl = ONAMELEN-1;
-               memset(d->gid, 0, ONAMELEN);
+               if(nl >= Maxname)
+                       nl = Maxname-1;
+               memset(d->gid, 0, Maxname);
                memmove(d->gid, s+1, nl);
                s += 1 + *s;
                if(((uintptr)s) & 1)
@@ -755,7 +754,7 @@ getcontin(Xdata *dev, uchar *p, uchar **s)
        off = l32(p+12);
        len = l32(p+20);
        chat("getcontin %d...", bn);
-       b = getbuf(dev, bn);
+       b = getbuf(dev, bn, 1);
        if(b == 0){
                *s = 0;
                return 0;