#!/bin/rc # # command: /bin/boddle /n/juke/plan_9/sys/src/cmd/dossrv /sys/src/cmd/dossrv # srcdir: /n/juke/plan_9/sys/src/cmd/dossrv # version: 816323507 # date: Mon Nov 13 23:31:47 EST 1995 # myname=$0 doextract=no fn usage{ echo $myname: usage: $myname '[-X] [src-directory]' >[1=2] exit usage } fn sigint{ rm -rf 816323507 exit interrupt } while(~ $1 -*){ switch($1){ case -X doextract=yes case -* usage } shift } switch($#*){ case 0 srcdir=/sys/src/cmd/dossrv 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 816323507 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 816323507 mkdir 816323507 target=816323507/dat.h echo -n '816323507/dat.h: ' if(! test -f $srcdir/dat.h || ! test -r $srcdir/dat.h){ echo $srcdir/dat.h unreadable exit unreadable } sum=`{sum < $srcdir/dat.h} if(! ~ 518755582407 $sum(1)^$sum(2)){ echo $srcdir/dat.h is not the original distribution file exit original } cp $srcdir/dat.h 816323507/dat.h ed 816323507/dat.h >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM dat.h' 91a #define QIDPATH(p) ((p)->addr*(Sectorsize/sizeof(Dosdir)) + \ (p)->offset/sizeof(Dosdir)) . 19a #define FAT12 0x01 #define FAT16 0x04 #define FATHUGE 0x06 #define DMDDO 0x54 . wq //GO.SYSIN DD VADIM dat.h sum=`{sum < 816323507/dat.h} if(~ 37544a3b2581 $sum(1)^$sum(2)) echo if not{ echo 816323507/dat.h checksum error creating updated file exit checksum } target=816323507/dosfs.c echo -n '816323507/dosfs.c: ' if(! test -f $srcdir/dosfs.c || ! test -r $srcdir/dosfs.c){ echo $srcdir/dosfs.c unreadable exit unreadable } sum=`{sum < $srcdir/dosfs.c} if(! ~ 5722252b9523 $sum(1)^$sum(2)){ echo $srcdir/dosfs.c is not the original distribution file exit original } cp $srcdir/dosfs.c 816323507/dosfs.c ed 816323507/dosfs.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM dosfs.c' 490c getdir(&dir, dp->d, dp->addr, dp->offset); . 470c if(truncfile(f) < 0) . 298c f->qid.path = QIDPATH(ndp); . 279,288c /* * allocate first cluster, if making directory */ if(thdr.perm & CHDIR){ bp = f->xf->ptr; lock(bp); start = falloc(f->xf); unlock(bp); if(start <= 0){ if(ndp) free(ndp); putfile(f); errno = Eio; return; } . 236c int attr, omode=0, start=0; . 231c Dosbpb *bp=0; . 217c if(truncfile(f) < 0){ . 140,141c f->qid.path = QIDPATH(dp); if(dp->addr == 0) . 123,131c else f->qid.path = CHDIR | QIDPATH(dp); . wq //GO.SYSIN DD VADIM dosfs.c sum=`{sum < 816323507/dosfs.c} if(~ 0b8bced69462 $sum(1)^$sum(2)) echo if not{ echo 816323507/dosfs.c checksum error creating updated file exit checksum } target=816323507/dossubs.c echo -n '816323507/dossubs.c: ' if(! test -f $srcdir/dossubs.c || ! test -r $srcdir/dossubs.c){ echo $srcdir/dossubs.c unreadable exit unreadable } sum=`{sum < $srcdir/dossubs.c} if(! ~ 6c15a00417597 $sum(1)^$sum(2)){ echo $srcdir/dossubs.c is not the original distribution file exit original } cp $srcdir/dossubs.c 816323507/dossubs.c ed 816323507/dossubs.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM dossubs.c' 718a if(n < 2 || n >= bp->fatclusters) panic("putfat n=%d", n); . 603c /* dp->qid.path = GSHORT(d->start); */ dp->qid.path = addr*(Sectorsize/sizeof(Dosdir)) + offset/sizeof(Dosdir); . 595c if(d == 0 || addr == 0){ . 590c getdir(Dir *dp, Dosdir *d, int addr, int offset) . 570,574d 565,568c d->start[0] = 0; d->start[1] = 0; while(clust > 0){ . 555c truncfile(Xfile *f) . 333c getdir(&dir, d, addr, o); . 145a if(GSHORT(d->start) == 0){ if(!cflag) return -1; lock(bp); start = falloc(f->xf); unlock(bp); if(start <= 0) return -1; puttime(d, 0); d->start[0] = start; d->start[1] = start>>8; dp->p->flags |= BMOD; dp->clust = 0; } . 139c int start, clust, iclust, nskip, next = 0; . 115c dp->d = (Dosdir *)&p->iobuf[dp->offset]; . 110c f->qid.path, QIDPATH(dp)); . 107,108c if((f->qid.path & ~CHDIR) != QIDPATH(dp)){ . 99d 49c xf->offset = mbroffset+offset; . 38c /* * Check for a disc-manager partition in the MBR. * Real MBR is at lba 63. Unfortunately it starts with * 0xE9, hence the check above against magic. */ if(dp->type == DMDDO){ mbroffset = 63*Sectorsize; putsect(p); purgebuf(xf); xf->offset += mbroffset; goto dmddo; } /* * Make sure it really is the right type, other filesystems * can look like a FAT (e.g. OS/2 BOOT MANAGER). */ if(dp->type == FAT12 || dp->type == FAT16 || dp->type == FATHUGE) . 24c if(mbroffset == 0 && b->magic[0] == 0xe9) . 18a mbroffset = 0; dmddo: . 17c int i, j; long mbroffset, offset; . wq //GO.SYSIN DD VADIM dossubs.c sum=`{sum < 816323507/dossubs.c} if(~ f0a4f06c18455 $sum(1)^$sum(2)) echo if not{ echo 816323507/dossubs.c checksum error creating updated file exit checksum } target=816323507/fns.h echo -n '816323507/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(! ~ cf34da3f1066 $sum(1)^$sum(2)){ echo $srcdir/fns.h is not the original distribution file exit original } cp $srcdir/fns.h 816323507/fns.h ed 816323507/fns.h >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM fns.h' 39c int truncfile(Xfile*); . 9c void getdir(Dir*, Dosdir*, int, int); . wq //GO.SYSIN DD VADIM fns.h sum=`{sum < 816323507/fns.h} if(~ f74077fe1071 $sum(1)^$sum(2)) echo if not{ echo 816323507/fns.h checksum error creating updated file exit checksum } target=816323507/xfile.c echo -n '816323507/xfile.c: ' if(! test -f $srcdir/xfile.c || ! test -r $srcdir/xfile.c){ echo $srcdir/xfile.c unreadable exit unreadable } sum=`{sum < $srcdir/xfile.c} if(! ~ f7022b593285 $sum(1)^$sum(2)){ echo $srcdir/xfile.c is not the original distribution file exit original } cp $srcdir/xfile.c 816323507/xfile.c ed 816323507/xfile.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM xfile.c' 72c fxf->offset = offset; . 48a if(offset && xf->offset != offset) continue; . 25a /* * If the name passed is of the form 'name:offset' then * offset is used to prime xf->offset. This allows accessing * a FAT-based filesystem anywhere within a partition. * Typical use would be to mount a filesystem in the presence * of a boot manager programme at the beginning of the disc. */ offset = 0; if(p = strrchr(name, ':')){ *p++ = 0; offset = strtol(p, &q, 0); chat("name %s, offset %ld\n", p, offset); if(offset < 0 || p == q){ errno = Enofilsys; return 0; } offset *= Sectorsize; } . 18a char *p, *q; long offset; . wq //GO.SYSIN DD VADIM xfile.c sum=`{sum < 816323507/xfile.c} if(~ 996909b43900 $sum(1)^$sum(2)) echo if not{ echo 816323507/xfile.c checksum error creating updated file exit checksum }