Browse Source

Plan 9 from Bell Labs 2009-02-20

David du Colombier 15 years ago
parent
commit
558b1dc93f

+ 2 - 4
sys/man/8/boot

@@ -16,7 +16,6 @@ boot \- connect to the root file server
 .I args
 ]
 .SH DESCRIPTION
-.PP
 .I Boot
 is the first program run after a kernel has been loaded.
 It connects to the file server that will serve the
@@ -106,7 +105,6 @@ The other interactions depend on whether the system
 is a
 terminal or a CPU server.
 .SS Terminal
-.PP
 The terminal must have a
 .I username
 to set.
@@ -202,7 +200,6 @@ flag commands
 .B cfs
 to reformat the cache partition.
 .SS CPU Servers
-.PP
 The user owning devices and console processes on CPU servers
 and that user's domain and encryption key are
 read from NVRAM on all machines except PC's.
@@ -230,7 +227,6 @@ behaves as on the terminal except for
 .B /$objtype/init
 .BR -c .
 .SS Booting Methods
-.PP
 The methods available to any system depend on what was
 compiled into the kernel.
 The complete list of booting methods are listed below.
@@ -273,6 +269,7 @@ contact the named
 .IR venti (8)
 server.
 The variable's value can take the following forms:
+.RS
 .TP
 .B /dev/sdC0/arenas
 the file should be a venti partition with a configuration
@@ -311,6 +308,7 @@ will configure the IP stack by passing
 .IR args ,
 if any, to
 .IR ipconfig (8).
+.RE
 .PP
 If the disk is not a
 .IR fossil (4)

+ 4 - 1
sys/src/cmd/aquarela/smbcomcreatedir.c

@@ -5,6 +5,7 @@ smbcomcreatedirectory(SmbSession *s, SmbHeader *h, uchar *, SmbBuffer *b)
 {
 	int fd;
 	char *path;
+	char *fullpath = nil;
 	uchar fmt;
 
 	if (h->wordcount != 0)
@@ -12,7 +13,8 @@ smbcomcreatedirectory(SmbSession *s, SmbHeader *h, uchar *, SmbBuffer *b)
 	if (!smbbuffergetb(b, &fmt) || fmt != 0x04 || !smbbuffergetstring(b, h, SMB_STRING_PATH, &path))
 		return SmbProcessResultFormat;
 	smblogprint(h->command, "smbcomcreatedirectory: %s\n", path);
-	fd = create(path, OREAD, DMDIR | 0775);
+        smbstringprint(&fullpath, "%s%s", s->serv->path, path);
+	fd = create(fullpath, OREAD, DMDIR | 0775);
 	if (fd < 0) {
 		smblogprint(h->command, "smbcomcreatedirectory failed: %r\n");
 		smbseterror(s, ERRDOS, ERRnoaccess);
@@ -20,6 +22,7 @@ smbcomcreatedirectory(SmbSession *s, SmbHeader *h, uchar *, SmbBuffer *b)
 		return SmbProcessResultError;
 	}
 	close(fd);
+	free(fullpath);
 	free(path);
 	return smbbufferputack(s->response, h, &s->peerinfo);
 }

+ 5 - 1
sys/src/cmd/aquarela/smbcomdeletedir.c

@@ -5,6 +5,7 @@ smbcomdeletedirectory(SmbSession *s, SmbHeader *h, uchar *, SmbBuffer *b)
 {
 	int rv;
 	char *path;
+	char *fullpath = nil;
 	uchar fmt;
 
 	if (h->wordcount != 0)
@@ -12,13 +13,16 @@ smbcomdeletedirectory(SmbSession *s, SmbHeader *h, uchar *, SmbBuffer *b)
 	if (!smbbuffergetb(b, &fmt) || fmt != 0x04 || !smbbuffergetstring(b, h, SMB_STRING_PATH, &path))
 		return SmbProcessResultFormat;
 	smblogprint(h->command, "smbcomdeletedirectory: %s\n", path);
-	rv = remove(path);
+        smbstringprint(&fullpath, "%s%s", s->serv->path, path);
+	rv = remove(fullpath);
 	if (rv < 0) {
 		smblogprint(h->command, "smbcomdeletedirectory failed: %r\n");
 		smbseterror(s, ERRDOS, ERRnoaccess);
 		free(path);
+		free(fullpath);
 		return SmbProcessResultError;
 	}
 	free(path);
+	free(fullpath);
 	return smbbufferputack(s->response, h, &s->peerinfo);
 }

+ 9 - 3
sys/src/cmd/aquarela/smbcomrename.c

@@ -4,7 +4,9 @@ SmbProcessResult
 smbcomrename(SmbSession *s, SmbHeader *h, uchar *, SmbBuffer *b)
 {
 	int rv;
-	char *oldpath, *newpath;
+	char *old,     *new;
+	char *oldpath = nil;
+	char *newpath = nil;
 	char *olddir, *newdir;
 	char *oldname, *newname;
 	uchar oldfmt, newfmt;
@@ -13,9 +15,13 @@ smbcomrename(SmbSession *s, SmbHeader *h, uchar *, SmbBuffer *b)
 
 	if (h->wordcount != 1)
 		return SmbProcessResultFormat;
-	if (!smbbuffergetb(b, &oldfmt) || oldfmt != 0x04 || !smbbuffergetstring(b, h, SMB_STRING_PATH, &oldpath)
-		|| !smbbuffergetb(b, &newfmt) || newfmt != 0x04 || !smbbuffergetstring(b, h, SMB_STRING_PATH, &newpath))
+	if (!smbbuffergetb(b, &oldfmt) || oldfmt != 0x04 || !smbbuffergetstring(b, h, SMB_STRING_PATH, &old)
+		|| !smbbuffergetb(b, &newfmt) || newfmt != 0x04 || !smbbuffergetstring(b, h, SMB_STRING_PATH, &new))
 		return SmbProcessResultFormat;
+
+	smbstringprint(&oldpath, "%s%s", s->serv->path, old);
+	smbstringprint(&newpath, "%s%s", s->serv->path, new);
+
 	smblogprint(h->command, "smbcomrename: %s to %s\n", oldpath, newpath);
 	smbpathsplit(oldpath, &olddir, &oldname);
 	smbpathsplit(newpath, &newdir, &newname);

+ 1 - 1
sys/src/cmd/aquarela/smbcomwrite.c

@@ -180,7 +180,7 @@ smbcomwriteandx(SmbSession *s, SmbHeader *h, uchar *pdata, SmbBuffer *b)
 	count = ((long)smbnhgets(pdata) << 16); pdata += 2; // MSBs of length or zero 
 	count |= smbnhgets(pdata); pdata += 2;		// LSBs of length
 	dataoff = smbnhgets(pdata); pdata += 2;		// offset to data in packet
-	if (h->wordcount != 14)
+	if (h->wordcount == 14)
 		offset = ((long)smbnhgets(pdata) << 16); pdata += 2; // MSBs of offset in file, if long pkt 
 	pdata += 4;					// data bytes to write (including those not sent yet)
 

+ 2 - 1
sys/src/cmd/aquarela/smbtrans2query.c

@@ -239,7 +239,8 @@ smbtrans2queryfsinformation(SmbSession *s, SmbHeader *h)
 	case SMB_QUERY_FS_SIZE_INFO:
 		translogprint(s->transaction.in.setup[0], "SMB_QUERY_FS_SIZE_INFO\n");
 		if (!smbbufferputv(s->transaction.out.data, 0xffffffffffffffffLL)
-			|| !smbbufferputv(s->transaction.out.data, 0xffffffffffffffffLL)
+                        /* Windows sees 0xffffffffffffffffLL as "Nnot enough space" */
+			|| !smbbufferputv(s->transaction.out.data, 0x0000ffffffffffffLL)
 			|| !smbbufferputl(s->transaction.out.data, 1 << (smbglobals.l2allocationsize - smbglobals.l2sectorsize))
 			|| !smbbufferputl(s->transaction.out.data, 1 << smbglobals.l2sectorsize))
 			goto misc;

+ 18 - 18
sys/src/cmd/tr.c

@@ -32,7 +32,6 @@ void	complement(void);
 void	delete(void);
 void	squeeze(void);
 void	translit(void);
-void	error(char*);
 long	canon(Pcb*);
 char	*getrune(char*, Rune*);
 void	Pinit(Pcb*, char*);
@@ -41,6 +40,13 @@ int	readrune(int, long*);
 void	wflush(int);
 void	writerune(int, Rune);
 
+static void
+usage(void)
+{
+	fprint(2, "usage: %s [-cds] [string1 [string2]]\n", argv0);
+	exits("usage");
+}
+
 void
 main(int argc, char **argv)
 {
@@ -48,21 +54,21 @@ main(int argc, char **argv)
 	case 's':	sflag++; break;
 	case 'd':	dflag++; break;
 	case 'c':	cflag++; break;
-	default:	error("bad option");
+	default:	usage();
 	}ARGEND
 	if(argc>0)
 		Pinit(&pfrom, argv[0]);
 	if(argc>1)
 		Pinit(&pto, argv[1]);
 	if(argc>2)
-		error("arg count");
+		usage();
 	if(dflag) {
 		if ((sflag && argc != 2) || (!sflag && argc != 1))
-			error("arg count");
+			usage();
 		delete();
 	} else {
 		if (argc != 2)
-			error("arg count");
+			usage();
 		if (cflag)
 			complement();
 		else translit();
@@ -117,7 +123,7 @@ complement(void)
 	}
 	Prewind(&pto);
 	if ((p = (Rune *) malloc((high+1)*sizeof(Rune))) == 0)
-		error("can't allocate memory");
+		sysfatal("no memory");
 	for (i = 0; i <= high; i++){
 		if (!BITSET(f,i)) {
 			if ((to = canon(&pto)) < 0)
@@ -165,7 +171,7 @@ translit(void)
 		if (from > high) high = from;
 	Prewind(&pfrom);
 	if ((p = (Rune *) malloc((high+1)*sizeof(Rune))) == 0)
-		error("can't allocate memory");
+		sysfatal("no memory");
 	for (i = 0; i <= high; i++)
 		p[i] = i;
 	while ((from = canon(&pfrom)) >= 0) {
@@ -173,7 +179,7 @@ translit(void)
 			to = lastc;
 		else lastc = to;
 		if (BITSET(f,from) && p[from] != to)
-			error("ambiguous translation");
+			sysfatal("ambiguous translation");
 		SETBIT(f,from);
 		p[from] = to;
 		SETBIT(t,to);
@@ -219,7 +225,7 @@ readrune(int fd, long *rp)
 			i = n-j;
 			n = read(fd, &buf[i], sizeof(buf)-i);
 			if (n < 0)
-				error("read error");
+				sysfatal("read error: %r");
 			if (n == 0)
 				return 0;
 			j = 0;
@@ -254,7 +260,7 @@ wflush(int fd)
 {
 	if (wptr && wptr > wbuf)
 		if (write(fd, wbuf, wptr-wbuf) != wptr-wbuf)
-			error("write error");
+			sysfatal("write error: %r");
 	wptr = wbuf;
 }
 
@@ -303,7 +309,7 @@ getrune(char *s, Rune *rp)
 				}
 			}
 			if(n > 0377)
-				error("char>0377");
+				sysfatal("character > 0377");
 		}
 		*rp = n;
 	}
@@ -325,7 +331,7 @@ canon(Pcb *p)
 	if(*p->current == '-' && p->last >= 0 && p->current[1]){
 		p->current = getrune(p->current+1, &r);
 		if (r < p->last)
-			error ("Invalid range specification");
+			sysfatal("invalid range specification");
 		if (r > p->last) {
 			p->final = r;
 			return ++p->last;
@@ -348,9 +354,3 @@ Prewind(Pcb *p)
 	p->current = p->base;
 	p->last = p->final = -1;
 }
-void
-error(char *s)
-{
-	fprint(2, "%s: %s\n", argv0, s);
-	exits(s);
-}