fs: merge in Geoff Collyer's 64-bit changes [geoff] --rw-rw-r-- M 1217231 glenda fs 64965 Feb 17 01:24 sys/doc/fs/fs.pdf binary files /n/sourcesdump/2006/0217/plan9/sys/doc/fs/fs.pdf /n/sourcesdump/2006/0218/plan9/sys/doc/fs/fs.pdf differ [geoff] --rw-rw-r-- M 1217231 glenda fs 298023 Feb 17 01:23 sys/doc/fs/fs.ps [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/doc/fs/fs.ps /n/sourcesdump/2006/0218/plan9/sys/doc/fs/fs.ps] [geoff] --rw-rw-r-- M 1217231 glenda fs 366 Feb 17 01:17 sys/doc/fs/mkfile /n/sourcesdump/2006/0217/plan9/sys/doc/fs/mkfile:9,22 - /n/sourcesdump/2006/0218/plan9/sys/doc/fs/mkfile:9,26 p6\ p7\ p8\ + p9\ + pa\ fs.ps:D: $OBJ - {echo $FONTS; cat $OBJ } | troff -ms | lp -dstdout >fs.ps - ../cleanps fs.ps + {echo $FONTS; tbl $OBJ } | eqn | troff -ms | lp -dstdout >$target + ../cleanps $target fs.trout:D: $OBJ - {echo $FONTS; cat $OBJ } | troff -ms >fs.trout + {echo $FONTS; tbl $OBJ } | eqn | troff -ms >$target fs.html:D: - htmlroff -ms -mhtml $OBJ >fs.html + {echo $FONTS; tbl $OBJ } | eqn | htmlroff -ms -mhtml >$target + clean:V: + rm -f fs.^(html trout ps pdf) [geoff] --rw-rw-r-- M 1217231 glenda fs 1677 Jan 28 05:50 sys/doc/fs/p0 /n/sourcesdump/2006/0217/plan9/sys/doc/fs/p0:1,20 - /n/sourcesdump/2006/0218/plan9/sys/doc/fs/p0:1,51 - .HTML "The Plan 9 File Server + .HTML "The 64-bit Standalone Plan 9 File Server + .de Ex + .TA 0.5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i + .P1 + .TA 0.5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i + .. + .de Ee + .P2 + .. + + .EQ + delim $$ + .EN .FP lucidasans + .TL - The Plan 9 File Server + The 64-bit Standalone Plan 9 File Server .AU - Ken Thompson + Ken Thompson* ken@plan9.bell-labs.com + .FS + \l'4i' + .br + * now + .CW ken@entrisphere.com + .FE + .AU + Geoff Collyer + .CW geoff@collyer.net .AB - This paper describes the structure - and the operation of Plan 9 file servers. - The specifics apply to - our main Plan 9 file server + This paper is a revision of Thompson's + .I "The Plan 9 File Server" , + and describes the structure + and the operation of the new 64-bit Plan 9 file servers. + Some specifics apply to the 32-bit + Plan 9 file server Emelie, - but - the code is also the basis for + which code is also the basis for the user level file server .CW kfs . + .PP + Collyer recently created a 64-bit version of + Thompson's 32-bit file server, updating all file + offsets, sizes and block numbers to 64 bits. + In addition, triple- and quadruple-indirect + blocks were implemented. + File name components were extended from 27 to 55 bytes. + Further work is planned, notably improved peripheral and protocol support. .AE .SH Introduction /n/sourcesdump/2006/0217/plan9/sys/doc/fs/p0:30,32 - /n/sourcesdump/2006/0218/plan9/sys/doc/fs/p0:61,75 but it has slowly come to terms with its particular set of cranky computers and devices. + .PP + The file server + .I fs64 + runs a revision of Emelie's code + with 64-bit file sizes, offsets and block numbers + and indirect blocks from single to quadruple. + Actually these are 63-bit values, since the type used is + .I vlong + (signed + .I "long long" + integer), + but 63 bits should suffice for a little while. [geoff] --rw-rw-r-- M 1217231 glenda fs 800 Aug 31 2004 sys/doc/fs/p1 /n/sourcesdump/2006/0217/plan9/sys/doc/fs/p1:14,31 - /n/sourcesdump/2006/0218/plan9/sys/doc/fs/p1:14,39 The structure of the file system server is a set of kernel processes synchronizing mostly through message passing. - In Emelie there are 26 processes of 10 types: - .P1 - .ft R - number name function - 15 \f(CWsrv\fP Main file system server processes - \01 \f(CWrah\fP Block read-ahead processes - \h'\w'0'u'1 \f(CWscp\fP Sync process - \h'\w'0'u'1 \f(CWwcp\fP WORM copy process - \h'\w'0'u'1 \f(CWcon\fP Console process - \h'\w'0'u'1 \f(CWilo\fP IL protocol process - \h'\w'0'u'1 \f(CWilt\fP IL timer process - \h'\w'0'u'2 \f(CWethi\fP Ethernet input process - \h'\w'0'u'2 \f(CWetho\fP Ethernet output process - \h'\w'0'u'1 \f(CWflo\fP Floppy disk process - .P2 + In + .I fs64 + there are 27 processes of 11 types: + .KS + .TS + center ; + c l c + n lf(CW) l . + number name function + _ + 15 srv Main file system server processes + 1 rah Block read-ahead processes + 1 scp Sync process + 1 wcp WORM copy process + 1 con Console process + 1 ilo IL protocol process + 1 ilt IL timer process + 2 ethi Ethernet input process + 2 etho Ethernet output process + 1 flo Floppy disk process + 1 snt sntp clock-synchronisation process + .TE + .KE [geoff] --rw-rw-r-- M 1217231 glenda fs 3775 Sep 2 2004 sys/doc/fs/p2 [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/doc/fs/p2 /n/sourcesdump/2006/0218/plan9/sys/doc/fs/p2] [geoff] --rw-rw-r-- M 1217231 glenda fs 5764 Sep 2 2004 sys/doc/fs/p4 [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/doc/fs/p4 /n/sourcesdump/2006/0218/plan9/sys/doc/fs/p4] [geoff] --rw-rw-r-- M 1217231 glenda fs 1140 Aug 31 2004 sys/doc/fs/p5 /n/sourcesdump/2006/0217/plan9/sys/doc/fs/p5:32,39 - /n/sourcesdump/2006/0218/plan9/sys/doc/fs/p5:32,39 and only block offset 0 is read. This is to prevent some fairly common action such as - .P1 - file * - .P2 + .Ex + file * + .Ee from swamping the file system with read-ahead requests that will never be used. [geoff] --rw-rw-r-- M 1217231 glenda fs 6091 Sep 2 2004 sys/doc/fs/p6 [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/doc/fs/p6 /n/sourcesdump/2006/0218/plan9/sys/doc/fs/p6] [geoff] --rw-rw-r-- M 1217231 glenda fs 960 Aug 31 2004 sys/doc/fs/p7 /n/sourcesdump/2006/0217/plan9/sys/doc/fs/p7:45,48 - /n/sourcesdump/2006/0218/plan9/sys/doc/fs/p7:45,48 On Emelie, the main file system is configured on both sides of the first 237 disks, - platters 0-236 and 238-474. + platters 0\-236 and 238\-474. [geoff] --rw-rw-r-- M 1217231 geoff fs 659 Feb 17 01:22 sys/doc/fs/p9 [geoff] --rw-rw-r-- M 1217231 geoff fs 2027 Aug 31 2004 sys/doc/fs/pa [geoff] --rw-rw-r-- M 1217231 glenda fs 8350 Feb 8 2005 sys/man/8/fsconfig /n/sourcesdump/2006/0217/plan9/sys/man/8/fsconfig:46,51 - /n/sourcesdump/2006/0218/plan9/sys/man/8/fsconfig:46,55 .PP .B copyworm .PP + .B copydev + .I from-dev + .I to-dev + .PP .B halt .PP .B end /n/sourcesdump/2006/0217/plan9/sys/man/8/fsconfig:318,323 - /n/sourcesdump/2006/0218/plan9/sys/man/8/fsconfig:322,340 block by block, and loop. It knows how to read a fake worm file system. + .PP + .I Halt + will cause the server to + .I immediately + exit and reboot. + .PP + .I Copydev + will copy the device + .I from-dev + to the device + .IR to-dev . + block by block, + and panic. .PP .I Halt will cause the server to [geoff] d-rwxrwxr-x M 1217231 geoff fs 0 Feb 17 04:18 sys/src/fs/9netics32.16k [geoff] d-rwxrwxr-x M 1217231 geoff fs 0 Feb 17 04:18 sys/src/fs/9netics64.8k [geoff] d-rwxrwxr-x M 1217231 geoff fs 0 Feb 17 04:20 sys/src/fs/doc [geoff] d-rwxrwxr-x M 1217231 geoff fs 0 Feb 17 04:20 sys/src/fs/fs [geoff] d-rwxrwxr-x M 1217231 geoff fs 0 Feb 17 04:20 sys/src/fs/fs64 [geoff] --rw-rw-r-- M 1217231 geoff fs 3208 Feb 17 04:18 sys/src/fs/9netics32.16k/9net32.16kfs.c [geoff] --rw-rw-r-- M 1217231 geoff fs 612 Feb 17 04:18 sys/src/fs/9netics32.16k/dat.h [geoff] --rw-rw-r-- M 1217231 geoff fs 1961 Feb 17 04:18 sys/src/fs/9netics32.16k/fns.h [geoff] --rw-rw-r-- M 1217231 geoff fs 6688 Oct 13 2004 sys/src/fs/9netics32.16k/io.h [geoff] --rw-rw-r-- M 1217231 geoff fs 2907 Feb 17 04:18 sys/src/fs/9netics32.16k/mem.h [geoff] --rw-rw-r-- M 1217231 geoff fs 1615 Feb 17 04:18 sys/src/fs/9netics32.16k/mkfile [geoff] --rw-rw-r-- M 1217231 geoff fs 3235 Feb 17 04:18 sys/src/fs/9netics64.8k/9net64.8kfs.c [geoff] --rw-rw-r-- M 1217231 geoff fs 611 Sep 21 2004 sys/src/fs/9netics64.8k/dat.h [geoff] --rw-rw-r-- M 1217231 geoff fs 1961 Feb 17 04:18 sys/src/fs/9netics64.8k/fns.h [geoff] --rw-rw-r-- M 1217231 geoff fs 6688 Oct 13 2004 sys/src/fs/9netics64.8k/io.h [geoff] --rw-rw-r-- M 1217231 geoff fs 2907 Feb 17 04:18 sys/src/fs/9netics64.8k/mem.h [geoff] --rw-rw-r-- M 1217231 geoff fs 1608 Feb 17 04:18 sys/src/fs/9netics64.8k/mkfile [geoff] --rw-rw-r-- M 1217231 glenda fs 2989 Feb 17 04:20 sys/src/fs/choline/9cholinefs.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/9cholinefs.c:13,22 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/9cholinefs.c:13,22 int FIXEDSIZE = 1; #ifndef DATE - #define DATE 568011600L+4*3600 + #define DATE 1094098624L #endif - ulong mktime = DATE; /* set by mkfile */ + Timet mktime = DATE; /* set by mkfile */ Startsb startsb[] = { "main", 2, /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/9cholinefs.c:25,48 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/9cholinefs.c:25,46 Dos dos; - static - struct + static struct { char *name; - long (*read)(int, void*, long); - vlong (*seek)(int, vlong); - long (*write)(int, void*, long); + Off (*read)(int, void*, long); + Devsize (*seek)(int, Devsize); + Off (*write)(int, void*, long); int (*part)(int, char*); - } nvrdevs[] = - { + } nvrdevs[] = { { "fd", floppyread, floppyseek, floppywrite, 0, }, { "hd", ataread, ataseek, atawrite, setatapart, }, - /* - { "sd", scsiread, scsiseek, scsiwrite, setscsipart, }, - */ + /* { "sd", scsiread, scsiseek, scsiwrite, setscsipart, }, */ { 0, }, }; + void apcinit(void); + void otherinit(void) { /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/9cholinefs.c:53,58 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/9cholinefs.c:51,57 printcpufreq(); etherinit(); scsiinit(); + apcinit(); s = spllo(); nhd = atainit(); [geoff] --rw-rw-r-- M 1217231 glenda fs 612 Feb 17 04:20 sys/src/fs/choline/dat.h /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/dat.h:1,9 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/dat.h:1,10 - #define RBUFSIZE (16*1024) /* raw buffer size */ /* - * verify that the kernel reports the right size when you - * first boot this kernel. + * The most fundamental constant. + * The code will not compile with RBUFSIZE made a variable; + * for one thing, RBUFSIZE determines FEPERBUF, which determines + * the number of elements in a free-list-block array. */ - /* #define DSIZE (79563-1) /* worm size */ + #define RBUFSIZE (16*1024) /* raw buffer size */ #include "../port/portdat.h" [geoff] --rw-rw-r-- M 1217231 glenda fs 1961 Feb 17 04:20 sys/src/fs/choline/fns.h /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/fns.h:12,20 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/fns.h:12,20 void etherstart(void); int floppyinit(void); void floppyproc(void); - long floppyread(int, void*, long); - vlong floppyseek(int, vlong); - long floppywrite(int, void*, long); + Off floppyread(int, void*, long); + Devsize floppyseek(int, Devsize); + Off floppywrite(int, void*, long); void fpinit(void); char* getconf(char*); ulong getcr0(void); /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/fns.h:23,34 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/fns.h:23,33 int getfields(char*, char**, int, char); ulong getstatus(void); int atainit(void); - long ataread(int, void*, long); - vlong ataseek(int, vlong); - long atawrite(int, void*, long); + Off ataread(int, void*, long); + Devsize ataseek(int, Devsize); + Off atawrite(int, void*, long); void i8042a20(void); void i8042reset(void); - void idecheck(Device*); int inb(int); void insb(int, void*, int); ushort ins(int); /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/fns.h:55,65 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/fns.h:54,65 void putcr4(ulong); void puttr(ulong); void rdmsr(int, vlong*); - void rdtsc(uvlong*); + void wrmsr(int, vlong); + void (*cycles)(uvlong*); void scsiinit(void); - long scsiread(int, void*, long); - long scsiseek(int, long); - long scsiwrite(int, void*, long); + Off scsiread(int, void*, long); + Devsize scsiseek(int, Devsize); + Off scsiwrite(int, void*, long); int setatapart(int, char*); int setscsipart(int, char*); void setvec(int, void (*)(Ureg*, void*), void*); /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/fns.h:70,79 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/fns.h:70,79 void uartputc(int); void wbflush(void); void cpuid(char*, int*, int*); + #define PADDR(a) ((ulong)(a)&~KZERO) void ideinit(Device *d); - int ideread(Device *d, long, void*); - int idewrite(Device *d, long, void*); - long atasize(Device *d); - void atainitstub(Device *d); + Devsize idesize(Device *d); + int ideread(Device *d, Devsize, void*); + int idewrite(Device *d, Devsize, void*); [geoff] --rw-rw-r-- M 1217231 glenda fs 6688 Feb 17 04:20 sys/src/fs/choline/io.h /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/io.h:161,170 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/io.h:161,173 int size; } mem[6]; + uchar rid; + uchar ccrp; + uchar ccrb; uchar intl; /* interrupt line */ - ushort ccru; + ushort ccru; /* is uchar in cpu kernel */ + ulong pcr; - Pcidev* list; Pcidev* bridge; /* down a bus */ Pcidev* link; /* next device on this bno */ /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/io.h:181,186 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/io.h:184,190 extern Pcidev* pcimatchtbdf(int); extern void pcireset(void); extern void pcisetbme(Pcidev*); + extern void pciclrbme(Pcidev*); /* * a parsed plan9.ini line [geoff] --rw-rw-r-- M 1217231 glenda fs 2909 Feb 17 04:20 sys/src/fs/choline/mem.h /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/mem.h:82,85 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/mem.h:82,85 #define MACHADDR ((ulong)&mach0) /* hack number 1 */ - #define IFLAG 0x200 + #define IFLAG 0x200 /* psw: interrupt enable, to be accurate */ [geoff] --rw-rw-r-- M 1217231 glenda fs 1751 Feb 17 04:20 sys/src/fs/choline/mkfile /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/mkfile:7,12 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/mkfile:7,13 TARG=$p$CONF'fs' DEV=\ + apc.$O\ cw.$O\ fworm.$O\ juke.$O\ /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/mkfile:51,57 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/mkfile:52,60 8250.$O\ 8253.$O\ cga.$O\ - devata.$O\ + devsd.$O\ + sdscsi.$O\ + sdata.$O\ dosfs.$O\ floppy.$O\ kbd.$O\ /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/mkfile:65,80 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/mkfile:68,84 trap.$O\ ETHER=\ - etherif.$O\ + compat.$O\ ether2114x.$O\ - etherelnk3.$O\ + ether8139.$O\ ether82557.$O\ - compat.$O\ - ethermii.$O\ ether83815.$O\ etherdp83820.$O\ - ether8139.$O\ + etherelnk3.$O\ etherga620.$O\ + etherif.$O\ + etherigbe.$O\ + ethermii.$O\ SCSI=\ scsi.$O\ /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/mkfile:88,94 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/mkfile:92,98 $IP\ $ETHER\ $SCSI\ - + HFILES=\ ../port/all.h\ ../port/lib.h\ /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/mkfile:103,113 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/mkfile:107,118 LIB=\ -lauthsrv\ - /$objtype/lib/libc.a\ + -lc\ -lsec\ # -I../pc & -DFS are for compat.h - CFLAGS=-FVw -I. -I../port -I../pc -DFS + # -DOLD uses 32-bit file offsets instead of 64-bit ones + CFLAGS=-FTVw -I. -I../port -I../pc -DFS -DOLD all:V: $TARG /n/sourcesdump/2006/0217/plan9/sys/src/fs/choline/mkfile:116,132 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/choline/mkfile:121,135 <../dev/mkfile <../ip/mkfile - $TARG: $OBJ $TARG.$O - $LD -o $target -l -T0x80100020 $prereq $LIB + $TARG: $TARG.c $OBJ + $CC $CFLAGS -DDATE'='`{date -n} $TARG.c + $LD -o $target -l -T0x80100020 $OBJ $TARG.$O $LIB size $target - $TARG.$O: $TARG.c - $CC $CFLAGS -DDATE'='`{date -n} $TARG.c - install:V: $TARG cp $TARG /$objtype/ - #import lookout / /n/lookout && cp $TARG /n/lookout/$objtype/ - #import boundary / /n/boundary && cp $TARG /n/boundary/$objtype/ + import lookout / /n/lookout && cp $TARG /n/lookout/$objtype/ + import boundary / /n/boundary && cp $TARG /n/boundary/$objtype/ $TARG.$O: ../pc/dosfs.h [geoff] --rw-rw-r-- M 1217231 geoff fs 14910 Feb 17 04:18 sys/src/fs/dev/apc.c [geoff] --rw-rw-r-- M 1217231 glenda fs 43252 Oct 13 2004 sys/src/fs/dev/cw.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/dev/cw.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/dev/cw.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 1845 Feb 17 04:18 sys/src/fs/dev/fworm.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/dev/fworm.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/dev/fworm.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 22885 Oct 12 2004 sys/src/fs/dev/juke.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/dev/juke.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/dev/juke.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 4264 Feb 17 04:18 sys/src/fs/dev/mworm.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/dev/mworm.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/dev/mworm.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 2392 Feb 17 04:18 sys/src/fs/dev/wren.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/dev/wren.c:4,12 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/dev/wren.c:4,12 struct Wren { long block; /* size of a block -- from config */ - long nblock; /* number of blocks -- from config */ + Devsize nblock; /* number of blocks -- from config */ long mult; /* multiplier to get physical blocks */ - long max; /* number of logical blocks */ + Devsize max; /* number of logical blocks */ }; void /n/sourcesdump/2006/0217/plan9/sys/src/fs/dev/wren.c:51,65 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/dev/wren.c:51,65 dr->max = (dr->nblock + 1) / dr->mult; print(" drive %Z:\n", d); - print(" %ld blocks at %ld bytes each\n", - dr->nblock, dr->block); - print(" %ld logical blocks at %d bytes each\n", - dr->max, RBUFSIZE); + print(" %lld blocks at %ld bytes each\n", + (Wideoff)dr->nblock, dr->block); + print(" %lld logical blocks at %d bytes each\n", + (Wideoff)dr->max, RBUFSIZE); print(" %ld multiplier\n", dr->mult); } - long + Devsize wrensize(Device *d) { Wren *dr; /n/sourcesdump/2006/0217/plan9/sys/src/fs/dev/wren.c:69,87 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/dev/wren.c:69,87 } int - wreniocmd(Device *d, int io, long b, void *c) + wreniocmd(Device *d, int io, Off b, void *c) { - long l, m; + Off l, m; uchar cmd[10]; Wren *dr; dr = d->private; if(d == 0) { - print("wreniocmd: no drive - a=%Z b=%ld\n", d, b); + print("wreniocmd: no drive - a=%Z b=%lld\n", d, (Wideoff)b); return 0x40; } if(b >= dr->max) { - print("wreniocmd out of range a=%Z b=%ld\n", d, b); + print("wreniocmd out of range a=%Z b=%lld\n", d, (Wideoff)b); return 0x40; } /n/sourcesdump/2006/0217/plan9/sys/src/fs/dev/wren.c:104,116 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/dev/wren.c:104,116 } int - wrenread(Device *d, long b, void *c) + wrenread(Device *d, Off b, void *c) { int s; s = wreniocmd(d, SCSIread, b, c); if(s) { - print("wrenread: %Z(%ld) bad status %.4x\n", d, b, s); + print("wrenread: %Z(%lld) bad status %.4x\n", d, (Wideoff)b, s); cons.nwormre++; return 1; } /n/sourcesdump/2006/0217/plan9/sys/src/fs/dev/wren.c:118,130 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/dev/wren.c:118,130 } int - wrenwrite(Device *d, long b, void *c) + wrenwrite(Device *d, Off b, void *c) { int s; s = wreniocmd(d, SCSIwrite, b, c); if(s) { - print("wrenwrite: %Z(%ld) bad status %.4x\n", d, b, s); + print("wrenwrite: %Z(%lld) bad status %.4x\n", d, (Wideoff)b, s); cons.nwormwe++; return 1; } [geoff] --rw-rw-r-- M 1217231 geoff fs 2967 Feb 17 04:20 sys/src/fs/doc/changes [geoff] --rw-rw-r-- M 1217231 geoff fs 507 Feb 17 04:20 sys/src/fs/doc/words [geoff] --rw-rw-r-- M 1217231 geoff fs 4057 Feb 17 04:20 sys/src/fs/doc/worm.fs [geoff] --rw-rw-r-- M 1217231 geoff fs 1554 Nov 30 2004 sys/src/fs/doc/worm.fs64 [geoff] --rw-rw-r-- M 1217231 geoff fs 2806 Feb 17 04:20 sys/src/fs/doc/worms.32-bit [geoff] --rw-rw-r-- M 1217231 geoff fs 2989 Feb 17 04:20 sys/src/fs/emelie/9emeliefs.c [geoff] --rw-rw-r-- M 1217231 glenda fs 612 Feb 17 04:20 sys/src/fs/emelie/dat.h /n/sourcesdump/2006/0217/plan9/sys/src/fs/emelie/dat.h:1,9 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/emelie/dat.h:1,11 - #define RBUFSIZE (16*1024) /* raw buffer size */ /* - * verify that the kernel prints this size when you - * first boot this kernel. - * #define DSIZE 157933 + * The most fundamental constant. + * The code will not compile with RBUFSIZE made a variable; + * for one thing, RBUFSIZE determines FEPERBUF, which determines + * the number of elements in a free-list-block array. */ + #define RBUFSIZE (16*1024) /* raw buffer size */ + #include "../port/portdat.h" extern Mach mach0; [geoff] --rw-rw-r-- M 1217231 glenda fs 1961 Feb 17 04:20 sys/src/fs/emelie/fns.h /n/sourcesdump/2006/0217/plan9/sys/src/fs/emelie/fns.h:12,20 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/emelie/fns.h:12,20 void etherstart(void); int floppyinit(void); void floppyproc(void); - long floppyread(int, void*, long); - vlong floppyseek(int, vlong); - long floppywrite(int, void*, long); + Off floppyread(int, void*, long); + Devsize floppyseek(int, Devsize); + Off floppywrite(int, void*, long); void fpinit(void); char* getconf(char*); ulong getcr0(void); /n/sourcesdump/2006/0217/plan9/sys/src/fs/emelie/fns.h:23,34 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/emelie/fns.h:23,33 int getfields(char*, char**, int, char); ulong getstatus(void); int atainit(void); - long ataread(int, void*, long); - vlong ataseek(int, vlong); - long atawrite(int, void*, long); + Off ataread(int, void*, long); + Devsize ataseek(int, Devsize); + Off atawrite(int, void*, long); void i8042a20(void); void i8042reset(void); - void idecheck(Device*); int inb(int); void insb(int, void*, int); ushort ins(int); /n/sourcesdump/2006/0217/plan9/sys/src/fs/emelie/fns.h:55,65 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/emelie/fns.h:54,65 void putcr4(ulong); void puttr(ulong); void rdmsr(int, vlong*); - void rdtsc(uvlong*); + void wrmsr(int, vlong); + void (*cycles)(uvlong*); void scsiinit(void); - long scsiread(int, void*, long); - long scsiseek(int, long); - long scsiwrite(int, void*, long); + Off scsiread(int, void*, long); + Devsize scsiseek(int, Devsize); + Off scsiwrite(int, void*, long); int setatapart(int, char*); int setscsipart(int, char*); void setvec(int, void (*)(Ureg*, void*), void*); /n/sourcesdump/2006/0217/plan9/sys/src/fs/emelie/fns.h:70,79 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/emelie/fns.h:70,79 void uartputc(int); void wbflush(void); void cpuid(char*, int*, int*); + #define PADDR(a) ((ulong)(a)&~KZERO) void ideinit(Device *d); - int ideread(Device *d, long, void*); - int idewrite(Device *d, long, void*); - long atasize(Device *d); - void atainitstub(Device *d); + Devsize idesize(Device *d); + int ideread(Device *d, Devsize, void*); + int idewrite(Device *d, Devsize, void*); [geoff] --rw-rw-r-- M 1217231 glenda fs 6688 Feb 17 04:20 sys/src/fs/emelie/io.h /n/sourcesdump/2006/0217/plan9/sys/src/fs/emelie/io.h:161,170 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/emelie/io.h:161,173 int size; } mem[6]; + uchar rid; + uchar ccrp; + uchar ccrb; uchar intl; /* interrupt line */ - ushort ccru; + ushort ccru; /* is uchar in cpu kernel */ + ulong pcr; - Pcidev* list; Pcidev* bridge; /* down a bus */ Pcidev* link; /* next device on this bno */ /n/sourcesdump/2006/0217/plan9/sys/src/fs/emelie/io.h:181,186 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/emelie/io.h:184,190 extern Pcidev* pcimatchtbdf(int); extern void pcireset(void); extern void pcisetbme(Pcidev*); + extern void pciclrbme(Pcidev*); /* * a parsed plan9.ini line [geoff] --rw-rw-r-- M 1217231 glenda fs 2909 Feb 17 04:20 sys/src/fs/emelie/mem.h /n/sourcesdump/2006/0217/plan9/sys/src/fs/emelie/mem.h:82,85 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/emelie/mem.h:82,85 #define MACHADDR ((ulong)&mach0) /* hack number 1 */ - #define IFLAG 0x200 + #define IFLAG 0x200 /* psw: interrupt enable, to be accurate */ [geoff] --rw-rw-r-- M 1217231 glenda fs 1750 Feb 17 04:20 sys/src/fs/emelie/mkfile [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/emelie/mkfile /n/sourcesdump/2006/0218/plan9/sys/src/fs/emelie/mkfile] [geoff] --rw-rw-r-- M 1217231 geoff fs 3308 Feb 17 04:20 sys/src/fs/fs/9fsfs.c [geoff] --rw-rw-r-- M 1217231 geoff fs 611 Feb 17 04:20 sys/src/fs/fs/dat.h [geoff] --rw-rw-r-- M 1217231 geoff fs 1961 Feb 17 04:20 sys/src/fs/fs/fns.h [geoff] --rw-rw-r-- M 1217231 geoff fs 6688 Oct 13 2004 sys/src/fs/fs/io.h [geoff] --rw-rw-r-- M 1217231 geoff fs 2909 Feb 17 04:20 sys/src/fs/fs/mem.h [geoff] --rw-rw-r-- M 1217231 geoff fs 1663 Feb 17 04:20 sys/src/fs/fs/mkfile [geoff] --rw-rw-r-- M 1217231 geoff fs 3294 Feb 17 04:20 sys/src/fs/fs64/9fsfs64.c [geoff] --rw-rw-r-- M 1217231 geoff fs 611 Feb 17 04:20 sys/src/fs/fs64/dat.h [geoff] --rw-rw-r-- M 1217231 geoff fs 1961 Feb 17 04:20 sys/src/fs/fs64/fns.h [geoff] --rw-rw-r-- M 1217231 geoff fs 6688 Feb 17 04:20 sys/src/fs/fs64/io.h [geoff] --rw-rw-r-- M 1217231 geoff fs 2909 May 5 2002 sys/src/fs/fs64/mem.h [geoff] --rw-rw-r-- M 1217231 geoff fs 1603 Feb 17 04:20 sys/src/fs/fs64/mkfile [geoff] --rw-rw-r-- M 1217231 glenda fs 8696 Oct 12 2004 sys/src/fs/ip/arp.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/ip/arp.c:86,92 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/ip/arp.c:86,92 Arpe *a; uchar *tpa; int type, i, h; - ulong t; + Timet t; if(l < Ensize+Arpsize) return; /n/sourcesdump/2006/0217/plan9/sys/src/fs/ip/arp.c:208,214 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/ip/arp.c:208,214 Arppkt *q; Arpe *a; int i, id, len, dlen, off; - ulong t; + Timet t; p = (Ippkt*)mb->data; [geoff] --rw-rw-r-- M 1217231 glenda fs 19479 Feb 17 04:18 sys/src/fs/ip/il.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/ip/il.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/ip/il.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 3859 Oct 12 2004 sys/src/fs/ip/ip.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/ip/ip.c:19,25 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/ip/ip.c:19,25 uchar dst[Pasize]; int id; /* src,dst,id are address of the rock */ Msgbuf* mb; /* reassembly. if 0, the rock is empty */ - ulong age; /* timeout to throw away */ + Timet age; /* timeout to throw away */ int last; /* set to data size when last frag arrives */ int nfrag; Frag frag[Nfrag]; /n/sourcesdump/2006/0217/plan9/sys/src/fs/ip/ip.c:41,47 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/ip/ip.c:41,47 Frag *f; int len, id, frag, off, loff, i, n; Ippkt pkt; - ulong t; + Timet t; p = (Ippkt*)ep; if(l < Ensize+Ipsize) { [geoff] --rw-rw-r-- M 1217231 glenda fs 6691 Feb 17 04:18 sys/src/fs/ip/ip.h /n/sourcesdump/2006/0217/plan9/sys/src/fs/ip/ip.h:43,53 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/ip/ip.h:43,53 ulong rstart; /* remote start id */ ulong acksent; /* Last packet acked */ - ulong lastxmit; /* time of last xmit */ - ulong lastrecv; /* time of last recv */ - ulong timeout; /* time out counter */ - ulong acktime; /* acknowledge timer */ - ulong querytime; /* Query timer */ + Timet lastxmit; /* time of last xmit */ + Timet lastrecv; /* time of last recv */ + Timet timeout; /* time out counter */ + Timet acktime; /* acknowledge timer */ + Timet querytime; /* Query timer */ ulong delay; /* Average of the fixed rtt delay */ ulong rate; /* Average byte rate */ [geoff] --rw-rw-r-- M 1217231 glenda fs 7386 Oct 12 2004 sys/src/fs/ip/iproute.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/ip/iproute.c:73,79 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/ip/iproute.c:73,79 uchar gate[Pasize]; int metric; int inuse; - long time; + Timet time; }; struct { /n/sourcesdump/2006/0217/plan9/sys/src/fs/ip/iproute.c:147,164 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/ip/iproute.c:147,160 goto usage; break; } - if(chartoip(r.dest, argv[2])) + if(chartoip(r.dest, argv[2]) || chartoip(r.gate, argv[3])) goto usage; - if(chartoip(r.gate, argv[3])) - goto usage; r.metric = 0; /* rip can't nuke these */ deleteroute(&r); considerroute(&r); } else if(strcmp(argv[1], "delete") == 0) { - if(argc != 3) - goto usage; - if(chartoip(r.dest, argv[2])) + if(argc != 3 || chartoip(r.dest, argv[2])) goto usage; deleteroute(&r); } else [geoff] --rw-rw-r-- M 1217231 glenda fs 231 Feb 17 04:18 sys/src/fs/mkfile /n/sourcesdump/2006/0217/plan9/sys/src/fs/mkfile:1,7 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/mkfile:1,10 ARCH=\ + fs\ + fs64\ + 9netics32.16k\ + 9netics64.8k\ choline\ emelie\ - roro\ all:V: for(i in $ARCH)@{ [geoff] --rw-rw-r-- M 1217231 glenda fs 6957 Feb 17 02:35 sys/src/fs/pc/8250.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/8250.c:3,8 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/8250.c:3,14 #include "ureg.h" #include "io.h" + enum { + Development = 1, /* i.e., debugging */ + DLE = 0x10, /* ^p == DLE */ + Asciimask = 0x7f, + }; + /* * INS8250 uart */ /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/8250.c:74,79 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/8250.c:80,88 ulong overrun; }; + /* externally-visible console-on-a-uart flag */ + int uartcons; + Uart uart[2]; #define UartFREQ 1843200 /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/8250.c:146,152 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/8250.c:155,161 uartrdreg(up, Istat); uartrdreg(up, Data); } - + /* turn on fifo */ if(n){ uartwrreg(up, Fifoctl, Fena|Ftrig); /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/8250.c:180,197 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/8250.c:189,204 if(l & Oerror) up->overrun++; break; - + case 4: /* received data available */ case 12: ch = inb(up->port+Data); - #ifndef nohacks - if((ch & 0x7F) == 0x10) + if (Development && (ch & Asciimask) == DLE) firmware(); - #endif /* nohacks */ if(up->rx) - (*up->rx)(ch & 0x7F); + (*up->rx)(ch & Asciimask); break; - + case 2: /* transmitter empty */ ch = -1; if(up->tx) /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/8250.c:199,209 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/8250.c:206,216 if(ch != -1) outb(up->port+Data, ch); break; - + case 0: /* modem status */ uartrdreg(up, Mstat); break; - + default: if(s&1) return; /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/8250.c:280,285 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/8250.c:287,293 uartenable(up); if(baud) uartsetbaud(up, baud); + uartcons = 1; } int [geoff] --rw-rw-r-- M 1217231 glenda fs 7264 Oct 12 2004 sys/src/fs/pc/8253.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/8253.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/8253.c] [geoff] --rw-rw-r-- M 1217231 jmk fs 1575 Feb 17 03:28 sys/src/fs/pc/compat.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/compat.c:4,11 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/compat.c:4,17 #include "all.h" #include "io.h" #include "mem.h" + #include "../ip/ip.h" /* for Ether */ + #include "etherif.h" /* for Ether */ #include "compat.h" + enum { + VectorPIC = 24, /* external [A]PIC interrupts */ + }; + void free(void *p) /* there's a struct member named "free". sigh. */ { /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/compat.c:41,44 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/compat.c:47,107 b->next = 0; freeb(b); } + } + + int + readstr(vlong, void *, int, char *) + { + return 0; + } + + void + addethercard(char *, int (*)(struct Ether *)) + { + } + + void + kproc(char *name, void (*f)(void), void *arg) + { + userinit(f, arg, strdup(name)); + } + + void + intrenable(int irq, void (*f)(Ureg*, void*), void* a, int tbdf, char *name) + { + setvec(irq+VectorPIC, f, a); + USED(tbdf, name); + } + + int + intrdisable(int irq, void (*f)(Ureg *, void *), void *a, int tbdf, char *name) + { + USED(irq, f, a, tbdf, name); + return -1; + } + + /* + * Atomically replace *p with copy of s + */ + void + kstrdup(char **p, char *s) + { + int n; + char *t, *prev; + static Lock l; + + n = strlen(s)+1; + /* if it's a user, we can wait for memory; if not, something's very wrong */ + if(0 && u){ + t = /* s */malloc(n); + // setmalloctag(t, getcallerpc(&p)); + }else{ + t = malloc(n); + if(t == nil) + panic("kstrdup: no memory"); + } + memmove(t, s, n); + prev = *p; + *p = t; + free(prev); } [geoff] --rw-rw-r-- M 1217231 jmk fs 2426 Feb 17 04:19 sys/src/fs/pc/compat.h /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/compat.h:16,35 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/compat.h:16,52 #define INCRPTR(bp, incr) (bp)->count += (incr) #define ENDDATA(bp) ((bp)->data + (bp)->count) + #define ROUND(s, sz) (((s)+((sz)-1))&~((sz)-1)) + #define Block Msgbuf #define rp data /* Block member → Msgbuf member */ #define Etherpkt Enpkt #define Eaddrlen Easize + #define ETHERHDRSIZE Ensize + #ifndef CACHELINESZ + #define CACHELINESZ 32 /* pentium & later */ + #endif + + #define KNAMELEN NAMELEN + #define READSTR 128 + #define KADDR(a) ((void*)((ulong)(a)|KZERO)) #define PCIWINDOW 0 #define PCIWADDR(va) (PADDR(va)+PCIWINDOW) #define iprint print + + /* buffers */ #define allocb(sz) mballoc((sz), 0, Maeth1) #define iallocb(sz) mballoc((sz), 0, Mbeth1) + + /* other memory */ #define malloc(sz) ialloc((sz), 0) #define xspanalloc(sz, align, span) ialloc((sz)+(align)+(span), (align)) + /* sleazy hacks; really need better allocators */ + #define xalloc(sz) malloc(sz) + #define xfree(p) #define waserror() 0 #define poperror() /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/compat.h:38,51 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/compat.h:55,82 #define qsetlimit(q, lim) #define ioalloc(a, b, c, d) 0 + #define iofree(p) #define strtol strtoul - #define kproc(name, f, arg) userinit(f, arg, name) + #define PROCARG(arg) + #define GETARG(arg) getarg() + #define vmap(bar, size) upamalloc(bar, size, 0) + /* see portdat.h for Msgbuf flags */ void freeb(Block *b); void freeblist(Block *b); void free(void *p); void *mallocz(ulong sz, int clr); + char *strdup(char *); /* port/config.c */ + void kstrdup(char **p, char *s); /* header files mysteriously fail to declare this */ ulong upamalloc(ulong addr, int size, int align); + + int readstr(vlong, void *, int, char *); + void addethercard(char *, int (*)(struct Ether *)); + void kproc(char *text, void (*f)(void), void *arg); + + /* pc-specific? */ + int intrdisable(int irq, void (*f)(Ureg *, void *), void *a, int, char *); + void intrenable(int irq, void (*f)(Ureg*, void*), void* a, int, char *name); [geoff] --rw-rw-r-- M 1217231 glenda fs 16637 Oct 13 2004 sys/src/fs/pc/dosfs.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/dosfs.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/dosfs.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 2696 Feb 17 04:18 sys/src/fs/pc/dosfs.h /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/dosfs.h:46,63 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/dosfs.h:46,63 char name[8]; char ext[3]; uchar attr; - long length; - long pstart; /* physical start cluster address */ - long pcurrent; /* physical current cluster address */ - long lcurrent; /* logical current cluster address */ - long offset; + Devsize length; + Devsize pstart; /* physical start cluster address */ + Devsize pcurrent; /* physical current cluster address */ + Devsize lcurrent; /* logical current cluster address */ + Devsize offset; }; struct Dos{ int dev; /* device id */ - long (*read)(int, void*, long); /* read routine */ - vlong (*seek)(int, vlong); /* seek routine */ - long (*write)(int, void*, long); /* write routine */ + Off (*read)(int, void*, long); /* read routine */ + Devsize (*seek)(int, Devsize); /* seek routine */ + Off (*write)(int, void*, long); /* write routine */ int start; /* start of file system (sector no.) */ int sectbytes; /* size of a sector */ /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/dosfs.h:72,81 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/dosfs.h:72,81 int fatbytes; /* size of a fat (in bytes) */ int fatclusters; /* no. of clusters governed by fat */ int fatbits; /* 12 or 16 */ - long fataddr; /* sector address of first fat */ - long rootaddr; /* sector address of root directory */ - long dataaddr; /* sector address of first data block */ - long freeptr; /* for cluster allocation */ + Devsize fataddr; /* sector address of first fat */ + Devsize rootaddr; /* sector address of root directory */ + Devsize dataaddr; /* sector address of first data block */ + Devsize freeptr; /* for cluster allocation */ Dosfile root; }; [geoff] --rw-rw-r-- M 1217231 jmk fs 18552 Jun 6 2004 sys/src/fs/pc/ether8139.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/ether8139.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/ether8139.c] [geoff] --rw-rw-r-- M 1217231 jmk fs 28160 Mar 15 2004 sys/src/fs/pc/ether83815.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/ether83815.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/ether83815.c] [geoff] --rw-rw-r-- M 1217231 geoff fs 31622 Mar 31 2003 sys/src/fs/pc/ether83815.mii.c [geoff] --rw-rw-r-- M 1217231 jmk fs 30976 Aug 11 2004 sys/src/fs/pc/etherdp83820.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/etherdp83820.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/etherdp83820.c] [geoff] --rw-rw-r-- M 1217231 rsc fs 24732 Feb 17 03:51 sys/src/fs/pc/etherga620.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/etherga620.c:473,479 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/etherga620.c:473,479 return; } if(DoCountTicks) - rdtsc(&tsc0); + cycles(&tsc0); ctlr->interrupts++; csr32w(ctlr, Hi, 1); /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/etherga620.c:493,499 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/etherga620.c:493,499 csr32w(ctlr, Hi, 0); if(DoCountTicks){ - rdtsc(&tsc1); + cycles(&tsc1); ctlr->ticks += tsc1-tsc0; } } /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/etherga620.c:603,611 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/etherga620.c:603,611 sethost64(&ctlr->gib->srcb.addr, ctlr->sr); if(DoHardwareCksum) flags = TcpUdpCksum|NoPseudoHdrCksum|HostRing; - else + else flags = HostRing; - if(DoCoalUpdateOnly) + if(DoCoalUpdateOnly) flags |= CoalUpdateOnly; ctlr->gib->srcb.control = (Nsr<<16)|flags; sethost64(&ctlr->gib->scp, ctlr->sci); /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/etherga620.c:693,699 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/etherga620.c:693,699 * A unique index for this controller and the maximum packet * length expected. * For now only standard packets are expected. - */ + */ csr32w(ctlr, Ifx, 1); csr32w(ctlr, IfMTU, ETHERMAXTU+4); /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/etherga620.c:879,885 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/etherga620.c:879,885 static int ga620reset(Ctlr* ctlr) { - int cls, csr, i; + int cls, csr, i, b; if(ga620detach(ctlr) < 0) return -1; /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/etherga620.c:918,925 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/etherga620.c:918,926 * Snarf the MAC address from the serial EEPROM. */ for(i = 0; i < Easize; i++){ - if((ctlr->ea[i] = at24c32r(ctlr, 0x8E+i)) == -1) + if((b = at24c32r(ctlr, 0x8E+i)) == -1) return -1; + ctlr->ea[i] = b; } /* [geoff] --rw-rw-r-- M 1217231 glenda fs 6375 Feb 17 02:52 sys/src/fs/pc/etherif.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/etherif.c:9,14 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/etherif.c:9,15 extern int ether21140reset(Ether*); extern int etherelnk3reset(Ether*); extern int etheri82557reset(Ether*); + extern int igbepnp(Ether *); extern int dp83815reset(Ether*); extern int dp83820pnp(Ether*); extern int rtl8139pnp(Ether*); /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/etherif.c:19,33 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/etherif.c:20,35 int (*reset)(Ether*); } etherctlr[] = { - { "ga620", etherga620reset, }, - { "21140", ether21140reset, }, - { "2114x", ether21140reset, }, - { "3C509", etherelnk3reset, }, - { "83815", dp83815reset, }, - { "dp83820", dp83820pnp, }, - { "elnk3", etherelnk3reset, }, - { "i82557", etheri82557reset, }, - { "rtl8139", rtl8139pnp, }, + { "21140", ether21140reset, }, + { "2114x", ether21140reset, }, + { "3C509", etherelnk3reset, }, + { "83815", dp83815reset, }, + { "dp83820", dp83820pnp, }, + { "elnk3", etherelnk3reset, }, + { "ga620", etherga620reset, }, + { "i82557", etheri82557reset, }, + { "igbe", igbepnp, }, + { "rtl8139", rtl8139pnp, }, { 0, }, }; [geoff] --rw-rw-r-- M 1217231 geoff fs 46571 Nov 14 01:05 sys/src/fs/pc/etherigbe.c [geoff] --rw-rw-r-- M 1217231 jmk fs 4689 Feb 17 04:19 sys/src/fs/pc/ethermii.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/ethermii.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/ethermii.c] [geoff] --rw-rw-r-- M 1217231 jmk fs 3259 Feb 17 04:19 sys/src/fs/pc/ethermii.h [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/ethermii.h /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/ethermii.h] [geoff] --rw-rw-r-- M 1217231 glenda fs 14022 Oct 12 2004 sys/src/fs/pc/floppy.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/floppy.c:85,91 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/floppy.c:85,91 int heads; /* number of heads */ int steps; /* steps per cylinder */ int tracks; /* tracks/disk */ - int gpl; /* intersector gap length for read/write */ + int gpl; /* intersector gap length for read/write */ int fgpl; /* intersector gap length for format */ int rate; /* rate code */ /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/floppy.c:137,143 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/floppy.c:137,143 int dt; int dev; - ulong lasttouched; /* time last touched */ + Timet lasttouched; /* time last touched */ int cyl; /* current cylinder */ int confused; /* needs to be recalibrated (or worse) */ long offset; /* current offset */ /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/floppy.c:455,461 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/floppy.c:455,461 *dp->t->sectors; } - dp->lasttouched = MACHP(0)->ticks; + dp->lasttouched = MACHP(0)->ticks; fl.intr = 0; } /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/floppy.c:532,539 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/floppy.c:532,539 return 0; } - vlong - floppyseek(int dev, vlong off) + Devsize + floppyseek(int dev, Devsize off) { Floppy *dp; /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/floppy.c:679,691 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/floppy.c:679,691 return dp->len; } - long + Off floppyread(int dev, void *a, long n) { Floppy *dp; - long rv, i, nn, offset, sec; - uchar *aa; int tries; + Off rv, i, nn, offset, sec; + uchar *aa; dp = &fl.d[dev]; /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/floppy.c:693,699 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/floppy.c:693,699 qlock(&fl); floppypos(dp, dp->offset); offset = dp->offset; - sec = dp->tsec + dp->t->sectors*dp->thead; + sec = dp->tsec + (Off)dp->t->sectors*(Off)dp->thead; n = dp->len; if(fl.ccyl==dp->tcyl && fl.cdev==dev) goto out; /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/floppy.c:701,708 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/floppy.c:701,708 fl.ccyl = -1; fl.cdev = dev; aa = fl.ccache; - nn = dp->t->bytes*dp->t->sectors*dp->t->heads; - dp->offset = dp->tcyl*nn; + nn = (Off)dp->t->bytes * (Off)dp->t->sectors * (Off)dp->t->heads; + dp->offset = dp->tcyl * nn; for(rv = 0; rv < nn; rv += i){ i = 0; for(tries = 0; tries < dp->maxtries; tries++){ /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/floppy.c:727,739 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/floppy.c:727,739 return n; } - long + Off floppywrite(int dev, void *a, long n) { Floppy *dp; - long rv, i, offset; - uchar *aa; int tries; + Off rv, i, offset; + uchar *aa; dp = &fl.d[dev]; [geoff] --rw-rw-r-- M 1217231 glenda fs 10838 Sep 24 2004 sys/src/fs/pc/l.s /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/l.s:3,8 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/l.s:3,9 #define OP16 BYTE $0x66 #define NOP XCHGL AX,AX #define CPUID BYTE $0x0F; BYTE $0xA2 /* CPUID, argument in AX */ + #define WRMSR BYTE $0x0F; BYTE $0x30 /* WRMSR, argument in AX/DX (lo/hi) */ #define RDMSR BYTE $0x0F; BYTE $0x32 /* RDMSR, result in AX/DX (lo/hi) */ #define RDTSC BYTE $0x0F; BYTE $0x31 /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/l.s:251,256 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/l.s:252,258 RET TEXT wbflush(SB), $0 + XORL AX, AX CPUID RET /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/l.s:312,318 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/l.s:314,320 MOVL CR0,AX;\ ANDL $~0x4,AX /* EM=0 */;\ MOVL AX,CR0 - + TEXT fpoff(SB),$0 /* turn off floating point */ FPOFF RET /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/l.s:560,566 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/l.s:562,568 POPL AX RET - TEXT rdtsc(SB), $0 /* time stamp counter; cycles since power up */ + TEXT _cycles(SB), $0 /* time stamp counter; cycles since power up */ RDTSC MOVL vlong+0(FP), CX /* &vlong */ MOVL AX, 0(CX) /* lo */ /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/l.s:573,578 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/l.s:575,587 MOVL vlong+4(FP), CX /* &vlong */ MOVL AX, (CX) /* lo */ MOVL DX, 4(CX) /* hi */ + RET + + TEXT wrmsr(SB), $0 + MOVL index+0(FP), CX + MOVL lo+4(FP), AX + MOVL hi+8(FP), DX + WRMSR RET /* [geoff] --rw-rw-r-- M 1217231 glenda fs 2840 Oct 3 2004 sys/src/fs/pc/malloc.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/malloc.c:136,143 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/malloc.c:136,142 i = 0; for(mbp = mconf.bank; mbp < &mconf.bank[mconf.nbank]; mbp++) i += mbp->limit - mbp->base; - print(" mem left = %d\n", i); - print(" out of = %ld\n", conf.mem); + print(" mem left = %,d, out of %,ld\n", i, conf.mem); /* paranoia: add this command as late as is easy */ cmd_install("memory", "-- print ranges of memory banks", cmd_memory); } [geoff] --rw-rw-r-- M 1217231 glenda fs 426 Feb 17 04:19 sys/src/fs/pc/mkfile /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/mkfile:9,12 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/mkfile:9,13 $ETHER: ../pc/etherif.h dosfs.$O nvr.$O: ../pc/dosfs.h - compat.$O ether83815.$O etherdp83820.$O ether8139.$O: ../pc/compat.h + compat.$O ether8139.$O ether83815.$O etherdp83820.$O etherigbe.$O etherif.$O\ + ethermii.$O sdata.$O sdscsi.$O: ../pc/compat.h [geoff] --rw-rw-r-- M 1217231 glenda fs 7985 Feb 17 04:19 sys/src/fs/pc/pc.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/pc.c:118,124 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/pc.c:118,124 for(;;){ ac = *a++; bc = *b++; - + if(ac >= 'A' && ac <= 'Z') ac = 'a' + (ac - 'A'); if(bc >= 'A' && bc <= 'Z') /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/pc.c:170,176 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/pc.c:170,176 /* memory map */ /* the file server kernel will only see MAXMEG megabytes of RAM at most. */ - #define MAXMEG 1024 + #define MAXMEG 1791 /* 1.75GB-1MB, to avoid overshooting 1.75GB */ char mmap[MAXMEG+2]; Mconf mconf; [geoff] --rw-rw-r-- M 1217231 glenda fs 12118 Sep 11 2004 sys/src/fs/pc/pci.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/pci.c:18,23 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/pci.c:18,33 MaxUBN = 255, }; + enum + { /* command register */ + IOen = (1<<0), + MEMen = (1<<1), + MASen = (1<<2), + MemWrInv = (1<<4), + PErrEn = (1<<6), + SErrEn = (1<<8), + }; + static Lock pcicfglock; static Lock pcicfginitlock; static int pcicfgmode = -1; /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/pci.c:94,102 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/pci.c:104,119 pcilist = p; pcitail = p; - p->intl = pcicfgr8(p, PciINTL); + p->rid = pcicfgr8(p, PciRID); + p->ccrp = pcicfgr8(p, PciCCRp); + p->ccrb = pcicfgr8(p, PciCCRb); + p->pcr = pcicfgr32(p, PciPCR); + /* ccru is uchar in cpu kernel */ + /* p->ccru = pcicfgr8(p, PciCCRu); */ p->ccru = pcicfgr16(p, PciCCRu); + p->intl = pcicfgr8(p, PciINTL); + /* * If the device is a multi-function device adjust the * loop count so all possible functions are checked. /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/pci.c:506,511 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/pci.c:523,530 return "sis"; case 0x104b: return "mylex"; + case 0x105a: + return "promise"; case 0x105d: return "number9"; case 0x10a9: /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/pci.c:599,602 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/pci.c:618,628 pcr = pcicfgr16(p, PciPCR); pcr |= 0x04; pcicfgw16(p, PciPCR, pcr); + } + + void + pciclrbme(Pcidev* p) + { + p->pcr &= ~MASen; + pcicfgw16(p, PciPCR, p->pcr); } [geoff] --rw-rw-r-- M 1217231 glenda fs 53673 Apr 2 2005 sys/src/fs/pc/scsincr53c8xx.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/scsincr53c8xx.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/scsincr53c8xx.c] [geoff] --rw-rw-r-- M 1217231 geoff fs 61793 Oct 13 2004 sys/src/fs/pc/sdata.c [geoff] --rw-rw-r-- M 1217231 geoff fs 7042 Feb 17 03:28 sys/src/fs/pc/sdscsi.c [geoff] --rw-rw-r-- M 1217231 glenda fs 2166 Feb 17 04:19 sys/src/fs/pc/toy.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/toy.c:23,29 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/toy.c:23,29 static Lock rtclock; void - setrtc(ulong secs) + setrtc(Timet secs) { Rtc rtc; uchar bcdclock[Nbcd]; /n/sourcesdump/2006/0217/plan9/sys/src/fs/pc/toy.c:93,103 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/pc/toy.c:93,103 return rtc2sec(&rtc); } - ulong + Timet rtctime(void) { int i; - ulong t, ot; + Timet t, ot; ilock(&rtclock); [geoff] --rw-rw-r-- M 1217231 glenda fs 29982 Feb 17 04:19 sys/src/fs/port/9p1.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/9p1.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/9p1.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 2128 Feb 17 04:19 sys/src/fs/port/9p1.h /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/9p1.h:15,21 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/9p1.h:15,21 { struct { - short uid; /* T-Userstr */ + short uid; /* T-Userstr [obs.] */ short oldtag; /* T-nFlush */ Qid9p1 qid; /* R-Attach, R-Clwalk, R-Walk, * R-Open, R-Create */ /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/9p1.h:44,50 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/9p1.h:44,50 }; struct { - long offset; /* T-Read, T-Write */ + Off offset; /* T-Read, T-Write */ long count; /* T-Read, T-Write, R-Read */ char* data; /* T-Write, R-Read */ }; [geoff] --rw-rw-r-- M 1217231 glenda fs 7911 Nov 28 2004 sys/src/fs/port/9p1lib.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/9p1lib.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/9p1lib.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 36248 Oct 18 2004 sys/src/fs/port/9p2.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/9p2.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/9p2.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 1932 Feb 17 04:19 sys/src/fs/port/all.h /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/all.h:4,10 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/all.h:4,10 #include "fns.h" #define CHAT(cp) ((cons.flags&chatflag)||(cp&&(((Chan*)cp)->flags&chatflag))) - #define QID9P1(a,b) (Qid9p1){a,b} + #define QID9P1(a,b) (Qid9p1){(a),(b)} #define nelem(x) (sizeof(x)/sizeof((x)[0])) #define QPDIR 0x80000000L /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/all.h:32,38 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/all.h:32,38 #define NQUEUE 20 Uid* uid; - short* gidspace; + Userid* gidspace; Lock printing; Time tim; File* files; /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/all.h:41,48 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/all.h:41,48 char* errstr9p[MAXERR]; Chan* chans; RWlock mainlock; - ulong mktime; - ulong boottime; + Timet mktime; + Timet boottime; Queue* serveq; Queue* raheadq; Rabuf* rabuffree; [geoff] --rw-rw-r-- M 1217231 glenda fs 7609 Oct 12 2004 sys/src/fs/port/auth.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/auth.c:210,216 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/auth.c:210,216 int inuse; char uname[NAMELEN]; /* requestor's remote user name */ char aname[NAMELEN]; /* requested aname */ - short uid; /* uid decided on */ + Userid uid; /* uid decided on */ int phase; char cchal[CHALLEN]; char tbuf[TICKETLEN+AUTHENTLEN]; /* server ticket */ [geoff] --rw-rw-r-- M 1217231 glenda fs 15683 Oct 15 2004 sys/src/fs/port/chk.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/chk.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/chk.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 4033 Oct 12 2004 sys/src/fs/port/clock.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/clock.c:136,142 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/clock.c:136,142 checkalarms(void) { User *p; - ulong now; + Timet now; if(talarm.list == 0 || canlock(&talarm) == 0) return; /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/clock.c:185,191 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/clock.c:185,191 } void - clock(ulong n, ulong pc) + clock(Timet n, ulong pc) { int i; Alarm *a; [geoff] --rw-rw-r-- M 1217231 glenda fs 16327 Oct 12 2004 sys/src/fs/port/con.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/con.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/con.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 20264 Feb 7 2005 sys/src/fs/port/config.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/config.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/config.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 4886 Nov 28 2004 sys/src/fs/port/console.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/console.c:89,95 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/console.c:89,95 } int - con_read(int fid, char *data, long offset, int count) + con_read(int fid, char *data, Off offset, int count) { Fcall in, ou; /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/console.c:105,111 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/console.c:105,111 } int - con_write(int fid, char *data, long offset, int count) + con_write(int fid, char *data, Off offset, int count) { Fcall in, ou; /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/console.c:226,240 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/console.c:226,242 if(d == 0) goto out; - print("name = %.28s\n", d->name); + print("name = %.*s\n", NAMELEN, d->name); print("uid = %d; gid = %d; muid = %d\n", d->uid, d->gid, d->muid); - print("size = %ld; qid = %lux/%lux\n", d->size, d->qid.path, d->qid.version); + print("size = %lld; qid = %llux/%lux\n", (Wideoff)d->size, + (Wideoff)d->qid.path, d->qid.version); print("atime = %ld; mtime = %ld\n", d->atime, d->mtime); print("dblock ="); for(i=0; idblock[i]); - print("; iblock = %ld; diblock = %ld\n", d->iblock, d->diblock); - print("\n"); + print(" %lld", (Wideoff)d->dblock[i]); + for (i = 0; i < NIBLOCK; i++) + print("; iblocks[%d] = %lld", i, (Wideoff)d->iblocks[i]); + print("\n\n"); out: if(p) [geoff] --rw-rw-r-- M 1217231 glenda fs 4510 Feb 17 04:19 sys/src/fs/port/data.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/data.c:23,29 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/data.c:23,29 [Ewstatb] "wstat -- unknown bits in qid.type/mode", [Ewstatd] "wstat -- attempt to change directory", [Ewstatg] "wstat -- not in group", - [Ewstatl] "wstat -- attempt to change length", + [Ewstatl] "wstat -- attempt to make length negative", [Ewstatm] "wstat -- attempt to change muid", [Ewstato] "wstat -- not owner or group leader", [Ewstatp] "wstat -- attempt to change qid.path", /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/data.c:59,65 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/data.c:59,65 [0x07] "parity error", [0x08] "message reject error", [0x0a] "copy aborted", - [0x0b] "inniator idetected error", + [0x0b] "initiator detected error", [0x0c] "select re-select failed", [0x0e] "miscompare", /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/data.c:138,143 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/data.c:138,148 [Tfree] "Tfree", [Tind1] "Tind1", [Tind2] "Tind2", + #ifndef OLD + [Tind3] "Tind3", + [Tind4] "Tind4", + /* add more Tind tags here ... */ + #endif [Tnone] "Tnone", [Tsuper] "Tsuper", [Tvirgo] "Tvirgo", [geoff] --rw-rw-r-- M 1217231 glenda fs 6345 Oct 18 2004 sys/src/fs/port/dentry.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/dentry.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/dentry.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 4451 Sep 23 2004 sys/src/fs/port/devcons.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/devcons.c:1,5 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/devcons.c:1,8 #include "all.h" + /* from ../pc/8250.c */ + extern int uartcons; + static struct { /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/devcons.c:272,278 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/devcons.c:275,283 char buf[PRINTSIZE]; lights(Lpanic, 1); - dumpstack(u); + /* if the only console is vga, conserve it */ + if (uartcons) + dumpstack(u); strcpy(buf, "panic: "); va_start(arg, fmt); n = vseprint(buf+strlen(buf), buf+sizeof(buf), fmt, arg) - buf; /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/devcons.c:291,297 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/devcons.c:296,302 { int i; - if(predawn) + if(predawn || !uartcons) return; for(i=0; i<50; i++) { if(!printq.printing) [geoff] --rw-rw-r-- M 1217231 geoff fs 10993 Oct 13 2004 sys/src/fs/port/devsd.c [geoff] --rw-rw-r-- M 1217231 geoff fs 682 Feb 17 04:20 sys/src/fs/port/fs.h [geoff] --rw-rw-r-- M 1217231 glenda fs 4956 Feb 17 04:19 sys/src/fs/port/iobuf.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/iobuf.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/iobuf.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 3701 Aug 8 2004 sys/src/fs/port/lib.h /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/lib.h:67,72 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/lib.h:67,73 }; extern int print(char*, ...); + extern char* seprint(char*, char*, char*, ...); extern char* vseprint(char*, char*, char*, va_list); extern int snprint(char*, int, char*, ...); extern int sprint(char*, char*, ...); /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/lib.h:78,83 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/lib.h:79,85 #pragma varargck argpos fmtit 2 #pragma varargck argpos print 1 + #pragma varargck argpos seprint 3 #pragma varargck argpos snprint 3 #pragma varargck argpos sprint 2 /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/lib.h:97,107 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/lib.h:99,118 #pragma varargck type "x" uint #pragma varargck type "c" uint #pragma varargck type "C" uint + /* no floating-point verbs */ #pragma varargck type "s" char* + #pragma varargck type "q" char* #pragma varargck type "S" Rune* + #pragma varargck type "Q" Rune* #pragma varargck type "r" void #pragma varargck type "%" void + #pragma varargck type "n" int* #pragma varargck type "p" void* + #pragma varargck flag ',' + #pragma varargck type "<" void* + #pragma varargck type "[" void* + #pragma varargck type "H" void* + #pragma varargck type "lH" void* /* * one-of-a-kind [geoff] --rw-rw-r-- M 1217231 glenda fs 7639 Feb 17 04:19 sys/src/fs/port/main.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/main.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/main.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 214 Feb 17 04:19 sys/src/fs/port/mkfile /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/mkfile:3,5 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/mkfile:3,6 $CC $CFLAGS -I. ../port/$stem1.c 9p1.$O 9p1lib.$O console.$O main.$O: ../port/9p1.h + devsd.$O: ../pc/compat.h [geoff] --rw-rw-r-- M 1217231 glenda fs 19670 Feb 17 03:09 sys/src/fs/port/portdat.h [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/portdat.h /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/portdat.h] [geoff] --rw-rw-r-- M 1217231 glenda fs 7526 Feb 17 04:19 sys/src/fs/port/portfns.h [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/portfns.h /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/portfns.h] [geoff] --rw-rw-r-- M 1217231 glenda fs 5364 Oct 12 2004 sys/src/fs/port/proc.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/proc.c:17,23 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/proc.c:17,23 User *free; } procalloc; - struct + volatile struct { Lock; User *head; /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/proc.c:157,172 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/proc.c:157,172 { User *p; - loop: - while(runq.head == 0) - ; - splhi(); - lock(&runq); - p = runq.head; - if(p==0 || p->mach){ + for (;;) { + while(runq.head == 0) /* if nobody to run, */ + ; /* idle with intrs enabled */ + splhi(); + lock(&runq); + p = runq.head; + if (p != nil && !p->mach) + break; unlock(&runq); spllo(); - goto loop; } if(p->rnext == 0) runq.tail = 0; /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/proc.c:240,246 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/proc.c:240,246 /* * if condition happened, never mind */ - if((*f)(arg)) { + if((*f)(arg)) { unlock(r); splx(s); return; /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/proc.c:273,279 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/proc.c:273,279 void tsleep(Rendez *r, int (*fn)(void*), void *arg, int ms) { - ulong when; + Timet when; User *f, **l; when = MS2TK(ms)+MACHP(0)->ticks; /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/proc.c:280,285 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/proc.c:280,287 lock(&talarm); /* take out of list if checkalarm didn't */ + if (u == nil) + panic("tsleep: nil u"); if(u->trend) { l = &talarm.list; for(f = *l; f; f = f->tlink) { [geoff] --rw-rw-r-- M 1217231 geoff fs 2167 Oct 12 2004 sys/src/fs/port/sd.h [geoff] --rw-rw-r-- M 1217231 glenda fs 25628 Oct 18 2004 sys/src/fs/port/sub.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/sub.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/sub.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 6222 Feb 17 04:19 sys/src/fs/port/time.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/time.c /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/time.c] [geoff] --rw-rw-r-- M 1217231 glenda fs 9192 Oct 12 2004 sys/src/fs/port/uidgid.c /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/uidgid.c:3,10 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/uidgid.c:3,10 struct { char* name; - short uid; - short lead; + Userid uid; + Userid lead; } minusers[] = { "adm", -1, -1, /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/uidgid.c:175,188 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/uidgid.c:175,186 void do_newuser(int argc, char *argv[]) { + int i, l, n, nuid; + char *p, *md, *q; Rune *r; - int nuid; - short *s; + Userid *s; Uid *ui, *u2; - char *p, *md, *q; - int i, l, n; - nuid = 10000; md = 0; if(argc == 2) { /n/sourcesdump/2006/0217/plan9/sys/src/fs/port/uidgid.c:505,511 - /n/sourcesdump/2006/0218/plan9/sys/src/fs/port/uidgid.c:503,509 ingroup(int u, int g) { Uid *p; - short *s, *e; + Userid *s, *e; if(u == g) return 1; games/mkfile: add sudoku [rsc] --rw-rw-r-- M 1217231 jmk sys 595 Feb 17 14:03 sys/src/games/mkfile /n/sourcesdump/2006/0217/plan9/sys/src/games/mkfile:15,20 - /n/sourcesdump/2006/0218/plan9/sys/src/games/mkfile:15,21 DIRS=\ mahjongg\ sokoban\ + sudoku\ 4s.$O 5s.$O xs.$O: xs.h $O.4s $O.5s: xs.$O consolefs(4): add note about namespace file [rsc] --rw-rw-r-- M 1217231 glenda sys 4241 Feb 17 15:51 sys/man/4/consolefs /n/sourcesdump/2006/0217/plan9/sys/man/4/consolefs:190,195 - /n/sourcesdump/2006/0218/plan9/sys/man/4/consolefs:190,200 An example of 2 consoles complete with console logging is: .IP .EX + % cat /lib/ndb/consoledb + group=sys + uid=glenda + console=bootes dev=/dev/eia0 gid=sys + console=fornax dev=/dev/eia1 gid=sys % aux/consolefs % ls -p /mnt/consoles bootes /n/sourcesdump/2006/0217/plan9/sys/man/4/consolefs:199,204 - /n/sourcesdump/2006/0218/plan9/sys/man/4/consolefs:204,221 % clog /mnt/consoles/fornax /sys/log/fornax & % clog /mnt/consoles/bootes /sys/log/bootes & .EE + .PP + The console server's default name space must + mount the consoles for + .I C + to import. + This can be arranged by adding + .IP + .EX + mount /srv/consoles /mnt/consoles + .EE + to + .BR /lib/namespace.$sysname . .SH FILES .TF /lib/ndb/consoledb .TP