Browse Source

Plan 9 from Bell Labs 2011-11-12

David du Colombier 12 years ago
parent
commit
549f791bb4

+ 2 - 2
sys/lib/mimetype

@@ -21,7 +21,7 @@
 .bcpio		application	x-bcpio		-		m
 .bib		text		plain		-		y # BibTex input
 .bmp		image		bmp		-		y # bitmapped image
-.bz2		-		-		bzip2		m # bzipped file
+.bz2		application	x-bzip2		bzip2		m # bzipped file
 .c		text		plain		-		y # C program
 .c++		text		plain		-		y # C++ program
 .cacert		application	x-x509-ca-cert	-		y # DER X.509 CA certificate
@@ -53,7 +53,7 @@
 .gcd		text		x-pcs-gcd	-		y	# helper file for .qcp
 .gif		image		gif		-		y
 .gtar		application	x-gtar		-		m
-.gz		-		-		gzip		m # gzipped file
+.gz		application	x-gzip		gzip		m # gzipped file
 .h		text		plain		-		y # C header file
 .hdf		application	x-hdf		-		y
 .hdml		text		x-hdml		-		y

+ 53 - 39
sys/man/8/9load

@@ -14,7 +14,11 @@ and
 .I ld
 are programs that reside in a FAT file system and bootstrap Plan 9.
 .I 9load
-loads the kernel, but it cannot be run from DOS; use
+loads a
+.B 386
+.\" or
+.\" .B amd64
+kernel, but it cannot be run from DOS; use
 .I ld
 to bootstrap (by starting
 .IR 9load )
@@ -26,7 +30,7 @@ it cannot be run directly by hand.
 is a version of
 .I 9load
 that can be booted using the PXE download (BOOTP/DHCP followed by TFTP)
-found in some ethernet card BIOSes.
+found in any reasonable ethernet card's BIOS.
 .I 9loadusb
 is a version that will use only the BIOS's device drivers,
 and thus can load from USB devices.
@@ -38,7 +42,11 @@ use BIOS device drivers.
 .I 9loadask
 is a version that asks on the console (too early for serial ports, alas)
 if you want to use BIOS drivers to boot.
-There are three bootstrap sequences:
+There are four bootstrap sequences:
+.IP \- 3
+PXE BIOS,
+.IR 9pxeload ,
+kernel
 .IP \-
 BIOS, MBR, disk partition PBS,
 .IR 9load ,
@@ -71,11 +79,11 @@ can only be booted using
 and then only if the machine's BIOS supports
 linear block addressing (LBA) mode for disk transfers.
 .PP
-When booting from floppy or hard disk, the BIOS loads the
+When booting from disk or floppy, the BIOS loads the
 first sector of the medium at location
 .BR 0x7C00 .
+In the case of a disk, it is the master boot record (MBR).
 In the case of a floppy, this is the PBS.
-In the case of a hard disk, it is the master boot record (MBR).
 The MBR copies itself to address
 .BR 0x600 ,
 finds the active partition and loads its PBS at address
@@ -97,7 +105,7 @@ operating systems,
 and (modulo the large disk constraints just described)
 non-Plan 9 MBRs are suitable for booting Plan 9.
 .PP
-Thus the default sequence is: BIOS, MBR, PBS,
+Thus the default sequence when booting from disk is: BIOS, MBR, PBS,
 .IR 9load ,
 kernel.
 .PP
@@ -137,21 +145,25 @@ After loading, control is passed to the entry location.
 .PP
 In summary,
 Plan 9 can be booted on a PC three different ways:
-either by booting MS-DOS and using
-.I ld
-to start
-.I 9load
-in the appropriate directory,
-by booting directly from a Plan 9 boot floppy or disk
-partition
+either
+by using a PXE-capable BIOS to boot
+.I 9pxeload
+directly over the ethernet,
+by booting directly from a Plan 9 disk partition
+or boot floppy
 prepared using
 .B format
 to install the appropriate files and bootstrap sectors
 (see
 .IR prep (8)),
-or by using a PXE-capable BIOS to boot
-.I 9pxeload
-directly over the ethernet.
+or rarely
+by booting MS-DOS and using
+.I ld
+to start
+.I 9load
+in the appropriate directory.
+.br
+.ne 4
 .SS Bootfile
 The
 .IR bootfile ,
@@ -193,23 +205,6 @@ are
 .TF \fLethern
 .PD
 .TP
-.BI fd n
-An MS-DOS floppy disk.
-.I N
-specifies the floppy drive, either
-0 or 1.
-The
-.I bootfile
-is the contents of the MS-DOS
-.IR file .
-There is no default file.
-For compatibility with hard disks, a
-.I partition
-may be given, but only
-.B dos
-is recognized:
-.BI fd0!dos! file\f1.
-.TP
 .BI ether n
 Ethernet.
 .I N
@@ -226,7 +221,7 @@ is determined by the
 entry for this PC.
 .TP
 .BI sd Cn
-Non-floppy disk.
+Normal disk.
 The device name format is described in
 .IR sd (3).
 A
@@ -242,6 +237,23 @@ By convention, this partition is called
 .BR 9fat .
 There is no default partition or pathname.
 .TP
+.BI fd n
+An MS-DOS floppy disk.
+.I N
+specifies the floppy drive, either
+0 or 1.
+The
+.I bootfile
+is the contents of the MS-DOS
+.IR file .
+There is no default file.
+For compatibility with normal disks, a
+.I partition
+may be given, but only
+.B dos
+is recognized:
+.BI fd0!dos! file\f1.
+.TP
 .B bios0
 (Not in
 .IR 9pxeload .)
@@ -252,10 +264,12 @@ in the BIOS's list of devices to try to boot from,
 using the BIOS INT 13 calls also used by
 .IR pbslba .
 It does not understand any form of partition table;
-see the EXAMPLES in
+see the
+.B EXAMPLES
+in
 .IR prep (8)
 for how to format such a device.
-This is mostly useful for booting from USB devices so far.
+This has been mostly useful for booting from USB devices so far.
 .TP
 .B sdB0
 (Not in
@@ -290,11 +304,11 @@ Only devices which can be automatically configured,
 e.g. most PCI ethernet adapters,
 will be recognised.
 If the file
-.BI /cfg/pxe/ XXXXXXXXXXXX
+.BI /cfg/pxe/ ether
 can be located via a DHCP server,
 where
-.I XXXXXXXXXXXX
-is the MAC address of a recognised ethernet adapter,
+.I ether
+is the lower-case MAC address of a recognised ethernet adapter,
 the contents are obtained and used as a
 .IR plan9.ini .
 .PP

+ 7 - 7
sys/man/8/prep

@@ -65,7 +65,7 @@ prep, fdisk, format, mbr \- prepare disks, floppies and flashes
 ]
 .I disk
 .SH DESCRIPTION
-A partition table is stored on a hard disk to specify the division of
+A partition table is stored on a non-floppy disk to specify the division of
 the physical disk into a set of logical units.
 On PCs, the partition table is stored at the end of the master boot record
 of the disk.
@@ -480,12 +480,12 @@ will display a list of choices and then prompt for it.
 .PD
 .PP
 .I Format
-prepares for use the floppy diskette or hard disk partition in the file named
+prepares for use the disk partition or the floppy diskette in the file named
 .IR disk ,
 for example
-.B /dev/fd0disk
+.B /dev/sdC0/9fat
 or
-.BR /dev/sdC0/9fat .
+.BR /dev/fd0disk .
 The options are:
 .TP
 .B -f
@@ -654,8 +654,8 @@ The partition boot block then loads a bootstrap
 program such as
 .IR 9load (8),
 which then loads the operating system.
-If MS-DOS or Windows 9[58] is already installed
-on your hard disk, the master boot record
+If MS-DOS or Windows is already installed
+on your disk, the master boot record
 already has a suitable boot block.
 Otherwise,
 .B /386/mbr
@@ -698,7 +698,7 @@ disk/format -b /386/pbs -df /dev/fd0disk \e
 	/386/9load /tmp/plan9.ini /386/9pcf.gz
 .EE
 .PP
-Initialize the blank hard disk
+Initialize the blank disk
 .BR /dev/sdC0/data .
 .IP
 .EX

+ 5 - 8
sys/src/cmd/eqn/text.c

@@ -1,6 +1,7 @@
 #include "e.h"
 #include "y.tab.h"
 #include <ctype.h>
+#include <utf.h>
 
 #define	CSSIZE	1000
 char	cs[CSSIZE+20];	/* text string converted into this */
@@ -42,14 +43,14 @@ int textc(void)	/* read next UTF rune from psp */
 	wchar_t r;
 	int w;
 
-	w = mbtowc(&r, psp, 3);
+	w = mbtowc(&r, psp, UTFmax);
 	if(w == 0){
 		psp++;
 		return 0;
 	}
 	if(w < 0){
 		psp += 1;
-		return 0x80;	/* Plan 9-ism */
+		return Runeerror;	/* Plan 9-ism */
 	}
 	psp += w;
 	return r;
@@ -112,17 +113,13 @@ void text(int t, char *p1)	/* convert text string p1 of type t */
 	printf(".ds %d \"%s\n", yyval, p);
 }
 
-int isalpharune(int c)
-{
-	return ('a'<=c && c<='z') || ('A'<=c && c<='Z');
-}
-
 int isdigitrune(int c)
 {
 	return ('0'<=c && c<='9');
 }
 
-trans(int c, char *p1)
+int
+trans(int c, char *)
 {
 	int f;
 

+ 8 - 5
sys/src/cmd/fossil/cache.c

@@ -9,6 +9,9 @@ typedef struct FreeList FreeList;
 typedef struct BAddr BAddr;
 
 enum {
+	Nowaitlock,
+	Waitlock,
+
 	BadHeap = ~0,
 };
 
@@ -112,14 +115,12 @@ static void heapIns(Block*);
 static void cacheCheck(Cache*);
 static void unlinkThread(void *a);
 static void flushThread(void *a);
-static void flushBody(Cache *c);
 static void unlinkBody(Cache *c);
 static int cacheFlushBlock(Cache *c);
 static void cacheSync(void*);
 static BList *blistAlloc(Block*);
 static void blistFree(Cache*, BList*);
 static void doRemoveLink(Cache*, BList*);
-static void doRemoveLinkList(Cache*, BList*);
 
 /*
  * Mapping from local block type to Venti type
@@ -473,7 +474,7 @@ _cacheLocalLookup(Cache *c, int part, u32int addr, u32int vers,
 static Block*
 cacheLocalLookup(Cache *c, int part, u32int addr, u32int vers)
 {
-	return _cacheLocalLookup(c, part, addr, vers, 1, 0);
+	return _cacheLocalLookup(c, part, addr, vers, Waitlock, 0);
 }
 
 
@@ -1194,7 +1195,8 @@ blockWrite(Block *b)
 		}
 
 		lockfail = 0;
-		bb = _cacheLocalLookup(c, p->part, p->addr, p->vers, 0, &lockfail);
+		bb = _cacheLocalLookup(c, p->part, p->addr, p->vers, Nowaitlock,
+			&lockfail);
 		if(bb == nil){
 			if(lockfail)
 				return 0;
@@ -2003,7 +2005,8 @@ cacheFlushBlock(Cache *c)
 			return 0;
 		p = c->baddr + c->br;
 		c->br++;
-		b = _cacheLocalLookup(c, p->part, p->addr, p->vers, 0, &lockfail);
+		b = _cacheLocalLookup(c, p->part, p->addr, p->vers, Nowaitlock,
+			&lockfail);
 
 		if(b && blockWrite(b)){
 			c->nflush++;

+ 0 - 1
sys/src/cmd/fossil/flfmt.c

@@ -8,7 +8,6 @@
 static void usage(void);
 static u64int fdsize(int fd);
 static void partition(int fd, int bsize, Header *h);
-static void writeBlock(int fd, uchar *buf, int bsize, ulong bn);
 static u64int unittoull(char *s);
 static u32int blockAlloc(int type, u32int tag);
 static void blockRead(int part, u32int addr);

+ 0 - 1
sys/src/cmd/fossil/source.c

@@ -7,7 +7,6 @@
 static int	sizeToDepth(uvlong s, int psize, int dsize);
 static u32int 	tagGen(void);
 static Block 	*sourceLoad(Source *r, Entry *e);
-static Block	*sourceLoadUnlocked(Source *r, Entry *e);
 static int	sourceShrinkDepth(Source*, Block*, Entry*, int);
 static int	sourceShrinkSize(Source*, Entry*, uvlong);
 static int	sourceGrowDepth(Source*, Block*, Entry*, int);