#!/bin/rc # # command: /bin/boddle /usr/forsyth/cd/nfs /sys/src/cmd/service/nfs # srcdir: /usr/forsyth/cd/nfs # version: 889198085 # date: Fri Mar 6 15:28:05 GMT 1998 # myname=$0 doextract=no fn usage{ echo $myname: usage: $myname '[-X] [src-directory]' >[1=2] exit usage } fn sigint{ rm -rf 889198085 exit interrupt } while(~ $1 -*){ switch($1){ case -X doextract=yes case -* usage } shift } switch($#*){ case 0 srcdir=/usr/forsyth/cd/nfs case 1 srcdir=$1 case * usage } if(! ~ $doextract yes){ echo This shell file contains a bundle of diffs representing changes echo to original source files in the Plan 9 distribution. It will run echo against the files in echo ' ' $srcdir echo '(unless overridden by the optional source directory argument)' echo and create a directory 889198085 containing the updated files. echo It will NOT automatically update the original files. echo echo Invoke with argument -X to perform the actual extraction. exit 0 } rm -rf 889198085 mkdir 889198085 target=889198085/9p.c echo -n '889198085/9p.c: ' if(! test -f $srcdir/9p.c || ! test -r $srcdir/9p.c){ echo $srcdir/9p.c unreadable exit unreadable } sum=`{sum < $srcdir/9p.c} if(! ~ 71e9b4253202 $sum(1)^$sum(2)){ echo $srcdir/9p.c is not the original distribution file exit original } cp $srcdir/9p.c 889198085/9p.c ed 889198085/9p.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM 9p.c' 60a memmove(err, s->f.ename, ERRLEN); errstr(err); . 24a char err[ERRLEN]; . wq //GO.SYSIN DD VADIM 9p.c sum=`{sum < 889198085/9p.c} if(~ a482d1153272 $sum(1)^$sum(2)) echo if not{ echo 889198085/9p.c checksum error creating updated file exit checksum } target=889198085/auth.c echo -n '889198085/auth.c: ' if(! test -f $srcdir/auth.c || ! test -r $srcdir/auth.c){ echo $srcdir/auth.c unreadable exit unreadable } sum=`{sum < $srcdir/auth.c} if(! ~ 0a41d2ce6667 $sum(1)^$sum(2)){ echo $srcdir/auth.c is not the original distribution file exit original } cp $srcdir/auth.c 889198085/auth.c ed 889198085/auth.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM auth.c' 109a if(r == 0) r = -1; . wq //GO.SYSIN DD VADIM auth.c sum=`{sum < 889198085/auth.c} if(~ 85aa504f6689 $sum(1)^$sum(2)) echo if not{ echo 889198085/auth.c checksum error creating updated file exit checksum } target=889198085/fns.h echo -n '889198085/fns.h: ' if(! test -f $srcdir/fns.h || ! test -r $srcdir/fns.h){ echo $srcdir/fns.h unreadable exit unreadable } sum=`{sum < $srcdir/fns.h} if(! ~ ea887aa31950 $sum(1)^$sum(2)){ echo $srcdir/fns.h is not the original distribution file exit original } cp $srcdir/fns.h 889198085/fns.h ed 889198085/fns.h >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM fns.h' 40c void srvinit(int, char*, char*, char*); . wq //GO.SYSIN DD VADIM fns.h sum=`{sum < 889198085/fns.h} if(~ d12780771957 $sum(1)^$sum(2)) echo if not{ echo 889198085/fns.h checksum error creating updated file exit checksum } target=889198085/nfs.c echo -n '889198085/nfs.c: ' if(! test -f $srcdir/nfs.c || ! test -r $srcdir/nfs.c){ echo $srcdir/nfs.c unreadable exit unreadable } sum=`{sum < $srcdir/nfs.c} if(! ~ 254dc90d8426 $sum(1)^$sum(2)){ echo $srcdir/nfs.c is not the original distribution file exit original } cp $srcdir/nfs.c 889198085/nfs.c ed 889198085/nfs.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM nfs.c' 142a xp->name = strstore(dp->name); return 0; . wq //GO.SYSIN DD VADIM nfs.c sum=`{sum < 889198085/nfs.c} if(~ 844a9b338471 $sum(1)^$sum(2)) echo if not{ echo 889198085/nfs.c checksum error creating updated file exit checksum } target=889198085/nfs.h echo -n '889198085/nfs.h: ' if(! test -f $srcdir/nfs.h || ! test -r $srcdir/nfs.h){ echo $srcdir/nfs.h unreadable exit unreadable } sum=`{sum < $srcdir/nfs.h} if(! ~ 0b2bbf8d642 $sum(1)^$sum(2)){ echo $srcdir/nfs.h is not the original distribution file exit original } cp $srcdir/nfs.h 889198085/nfs.h ed 889198085/nfs.h >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM nfs.h' 13a NFSERR_XDEV = 18, /* not in v2 protocol spec. but Unix mv expects it */ . wq //GO.SYSIN DD VADIM nfs.h sum=`{sum < 889198085/nfs.h} if(~ 84d80b7c715 $sum(1)^$sum(2)) echo if not{ echo 889198085/nfs.h checksum error creating updated file exit checksum } target=889198085/nfsfile.c echo -n '889198085/nfsfile.c: ' if(! test -f $srcdir/nfsfile.c || ! test -r $srcdir/nfsfile.c){ echo $srcdir/nfsfile.c unreadable exit unreadable } sum=`{sum < $srcdir/nfsfile.c} if(! ~ 02d1668b14908 $sum(1)^$sum(2)){ echo $srcdir/nfsfile.c is not the original distribution file exit original } cp $srcdir/nfsfile.c 889198085/nfsfile.c ed 889198085/nfsfile.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM nfsfile.c' 634a } /* * Map plan9 error messages to NFS/Unix error codes. * Unix implementations rely on NFS returning codes * not defined by the v2 spec. */ typedef struct Emap Emap; struct Emap { int eno; char *msg; }; static Emap emap[] = { 0, "no error", NFSERR_NOENT, "file does not exist", NFSERR_ACCES, "permission denied", NFSERR_ACCES, "access permission denied", NFSERR_NOENT, "unknown device in # filename", NFSERR_NOTDIR, "not a directory", NFSERR_ISDIR, "file is a directory", NFSERR_IO, "interrupted", NFSERR_IO, "mount rpc error", NFSERR_STALE, "mounted device shut down", NFSERR_ACCES, "mounted directory forbids creation", 22, "bad character in file name", 22, "file name syntax", 22, "bad arg in system call", 16, "device or object already in use", NFSERR_IO, "i/o error", NFSERR_IO, "read or write too large", NFSERR_IO, "read or write too small", NFSERR_EXIST, "file exists", NFSERR_NOENT, "bad network address", NFSERR_NOTEMPTY, "directory not empty", NFSERR_IO, "write to hungup stream", NFSERR_IO, "i/o error in demand load", 60, "connection timed out", 61, "connection refused", 51, "network unreachable", 0, 0, }; int errno(int deferr) { Emap *e; char *dash; char lasterr[ERRLEN]; lasterr[0] = 0; errstr(lasterr); if(*lasterr==0 || strcmp(lasterr, "no error")==0) return deferr; for(e=emap; e->msg; e++) if(strcmp(e->msg, lasterr) == 0) return e->eno; dash = strrchr(lasterr, '-'); if(dash != 0) { /* cope with file server's messages: rmdir -- mumble */ while(*dash == '-' || *dash==' ') dash++; for(e=emap; e->msg; e++) if(strcmp(e->msg, dash) == 0) return e->eno; } return deferr; . 555c return error(reply, NFSERR_ACCES); . 491,492c if(xfwstat(newxf, &dir) < 0) { e = errno(NFSERR_ACCES); if(e == NFSERR_EXIST && tries == 1) { e = removefile(xf, &toelem, 1, dir.mode); if(e == 0) goto Retry; } return error(reply, e); } . 483c return error(reply, errno(NFSERR_IO)); . 478c return error(reply, NFSERR_XDEV); . 473a Retry: tries++; . 459a tries = 0; . 458a int e, tries; . 436a return 0; } static int remov(int n, Rpccall *cmd, Rpccall *reply) { Xfid *xf; String elem; uchar *argptr = cmd->args; uchar *dataptr = reply->results; int e; if(n <= FHSIZE) return garbage(reply, "count too small"); xf = rpc2xfid(cmd, 0); argptr += FHSIZE; argptr += string2S(argptr, &elem); if(argptr != &((uchar *)cmd->args)[n]) return garbage(reply, "bad count"); if(xf == 0) return error(reply, NFSERR_STALE); e = removefile(xf, &elem, 0, 0); if(e) return error(reply, e); . 433c return e; . 431a e = errno(NFSERR_ACCES); . 428c return e; . 426a e = errno(NFSERR_IO); . 421c return NFSERR_NOENT; if(samemode) { if(xfstat(newxf, &dir) < 0) return errno(NFSERR_IO); if((dir.mode & CHDIR) != (mode & CHDIR)) return dir.mode&CHDIR? NFSERR_NOTDIR: NFSERR_ISDIR; } . 415,419c return NFSERR_NOTDIR; chat("%s/%.*s...", xp->name, name->n, name->s); if(noauth == 0 && xp->parent == xp && name->s[0] == '#') return NFSERR_PERM; newxf = xfwalkcr(Tclwalk, xf, name, 0); . 404,412d 401,402c Dir dir; int e; . 398,399c Xfid *newxf; . 394c removefile(Xfid *xf, String *name, int samemode, int mode) . 377c return error(reply, errno(NFSERR_IO)); . 375c return error(reply, errno(NFSERR_ACCES)); . 371c return error(reply, errno(NFSERR_ACCES)); . 310c return error(reply, errno(NFSERR_ACCES)); . 251c return error(reply, errno(NFSERR_ACCES)); . 158c return error(reply, errno(NFSERR_PERM)); . 147c return error(reply, errno(NFSERR_PERM)); . 145c return error(reply, errno(NFSERR_PERM)); . 61a static int errno(int); . wq //GO.SYSIN DD VADIM nfsfile.c sum=`{sum < 889198085/nfsfile.c} if(~ 86130cb717193 $sum(1)^$sum(2)) echo if not{ echo 889198085/nfsfile.c checksum error creating updated file exit checksum } target=889198085/nfsmount.c echo -n '889198085/nfsmount.c: ' if(! test -f $srcdir/nfsmount.c || ! test -r $srcdir/nfsmount.c){ echo $srcdir/nfsmount.c unreadable exit unreadable } sum=`{sum < $srcdir/nfsmount.c} if(! ~ e7d984046333 $sum(1)^$sum(2)){ echo $srcdir/nfsmount.c is not the original distribution file exit original } cp $srcdir/nfsmount.c 889198085/nfsmount.c ed 889198085/nfsmount.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM nfsmount.c' 88c if(spec) s->spec = spec; else s->spec = ""; . 78c srvinit(int fd, char *file, char *addr, char *spec) . 71c srvinit(-1, 0, "il!bootes", spec); . 67a case 't': spec = ARGF(); break; . 60c srvinit(1, 0, 0, spec); . 56c srvinit(-1, ARGF(), 0, spec); . 52c srvinit(-1, 0, ARGF(), spec); . 42a char *spec = 0; . wq //GO.SYSIN DD VADIM nfsmount.c sum=`{sum < 889198085/nfsmount.c} if(~ 012d24056458 $sum(1)^$sum(2)) echo if not{ echo 889198085/nfsmount.c checksum error creating updated file exit checksum }