Browse Source

Plan 9 from Bell Labs 2003-04-09

David du Colombier 21 years ago
parent
commit
2dde166b2f
6 changed files with 101 additions and 22 deletions
  1. 6 6
      dist/replica/plan9.db
  2. 6 0
      dist/replica/plan9.log
  3. 1 1
      sys/man/1/ls
  4. 73 9
      sys/man/4/nfs
  5. 1 1
      sys/src/cmd/aux/portmap.c
  6. 14 5
      sys/src/cmd/nfs.c

+ 6 - 6
dist/replica/plan9.db

@@ -124,7 +124,7 @@
 386/bin/aux/p9bitpost - 775 sys sys 1047307246 128070
 386/bin/aux/pcmcia - 775 sys sys 1039758543 46790
 386/bin/aux/pcnfsd - 775 sys sys 1045537955 126750
-386/bin/aux/portmap - 775 sys sys 1046368787 140955
+386/bin/aux/portmap - 775 sys sys 1049840989 141624
 386/bin/aux/portmapper - 775 sys sys 1045537955 125638
 386/bin/aux/postgif - 775 sys sys 1048745022 174648
 386/bin/aux/postprint - 775 sys sys 1048745023 159149
@@ -309,7 +309,7 @@
 386/bin/netkey - 775 sys sys 1039758579 70753
 386/bin/netstat - 775 sys sys 1045538036 81379
 386/bin/news - 775 sys sys 1045538036 70512
-386/bin/nfs - 775 sys sys 1048745058 316048
+386/bin/nfs - 775 sys sys 1049840990 316945
 386/bin/nm - 775 sys sys 1045538037 123227
 386/bin/nntpfs - 775 sys sys 1048745059 162301
 386/bin/ns - 775 sys sys 1039758580 63830
@@ -4487,7 +4487,7 @@ sys/man/1/lens - 664 sys sys 1029431866 1230
 sys/man/1/lex - 664 sys sys 1032058565 1520
 sys/man/1/look - 664 sys sys 944959673 1348
 sys/man/1/lp - 664 sys sys 1015024739 3304
-sys/man/1/ls - 664 sys sys 1027260860 2791
+sys/man/1/ls - 664 sys sys 1049813576 2791
 sys/man/1/mail - 664 sys sys 1035832988 2159
 sys/man/1/man - 664 sys sys 954378836 1611
 sys/man/1/marshal - 664 sys sys 1045501381 3308
@@ -4768,7 +4768,7 @@ sys/man/4/kfs - 664 sys sys 1019058716 2159
 sys/man/4/lnfs - 664 sys sys 1048643973 1215
 sys/man/4/mntgen - 664 sys sys 1043680799 473
 sys/man/4/namespace - 664 sys sys 1018386777 6916
-sys/man/4/nfs - 664 sys sys 1049135219 2740
+sys/man/4/nfs - 664 sys sys 1049776970 4475
 sys/man/4/nntpfs - 664 sys sys 1032632346 2771
 sys/man/4/paqfs - 664 sys sys 1017723482 1541
 sys/man/4/plumber - 664 sys sys 944959699 2748
@@ -6683,7 +6683,7 @@ sys/src/cmd/aux/na/na.y - 775 sys sys 1015008889 25158
 sys/src/cmd/aux/nfsmount.c - 664 sys sys 1045589268 6202
 sys/src/cmd/aux/olefs.c - 664 sys sys 1014925094 9627
 sys/src/cmd/aux/pcmcia.c - 664 sys sys 1014925094 8223
-sys/src/cmd/aux/portmap.c - 664 sys sys 1045589269 3617
+sys/src/cmd/aux/portmap.c - 664 sys sys 1049776133 3617
 sys/src/cmd/aux/rdwr.c - 664 sys sys 1016833876 811
 sys/src/cmd/aux/reboot.c - 664 sys sys 1014925091 1411
 sys/src/cmd/aux/searchfs.c - 664 sys sys 1014925091 18176
@@ -9328,7 +9328,7 @@ sys/src/cmd/ndb/query.c - 664 sys sys 957402054 1133
 sys/src/cmd/ndb/time.c - 664 sys sys 957402055 321
 sys/src/cmd/netstat.c - 664 sys sys 1038237140 3796
 sys/src/cmd/news.c - 664 sys sys 1014926614 3778
-sys/src/cmd/nfs.c - 664 sys sys 1048644535 30830
+sys/src/cmd/nfs.c - 664 sys sys 1049839711 31035
 sys/src/cmd/nm.c - 664 sys sys 1014926696 4908
 sys/src/cmd/nntpfs.c - 664 sys sys 1048644540 18869
 sys/src/cmd/ns.c - 664 sys sys 984717934 3558

+ 6 - 0
dist/replica/plan9.log

@@ -19068,3 +19068,9 @@
 1049428865 4 c 386/bin/upas/smtpd - 775 sys sys 1049428259 312341
 1049509869 0 c sys/src/9/pc/mmu.c - 664 sys sys 1049509456 10014
 1049581902 0 c sys/lib/acid/port - 664 sys sys 1049580489 8902
+1049776284 0 c sys/src/cmd/aux/portmap.c - 664 sys sys 1049776133 3617
+1049778086 0 c sys/man/4/nfs - 664 sys sys 1049776970 4475
+1049814060 0 c sys/man/1/ls - 664 sys sys 1049813576 2791
+1049839789 0 c sys/src/cmd/nfs.c - 664 sys sys 1049839711 31035
+1049841089 0 c 386/bin/aux/portmap - 775 sys sys 1049840989 141624
+1049841089 1 c 386/bin/nfs - 775 sys sys 1049840990 316945

+ 1 - 1
sys/man/1/ls

@@ -42,7 +42,7 @@ List in long format, giving mode (see below), file system type
 (e.g., for devices, the
 .B #
 code letter that names it; see
-.IR Intro (4)),
+.IR intro (3)),
 the instance or subdevice number, owner, group,
 size in bytes, and time of last modification
 for each file.

+ 73 - 9
sys/man/4/nfs

@@ -32,7 +32,7 @@ nfs \- Sun network file system client
 .I cmd
 ...
 .PP
-.B aux/nfsmonut
+.B aux/nfsmount
 [
 .B -R
 ]
@@ -51,7 +51,7 @@ If one address is given, it is taken to be the address of a port mapper service;
 .I nfs
 queries the port mapper to find the addresses
 of the NFS mount service and file service.
-If two addresses are given, the port mapper is bypassed;
+If two addresses are given, the port mapper is bypasswd;
 .I addr1
 is used as the address of the NFS mount service,
 and
@@ -106,13 +106,77 @@ on most Unix systems).
 and
 .I nfsmount
 are test programs to perform port mapper and NFS mount RPCs.
-Run
-.B aux/portmap
-.B -?
-and
-.B aux/nfsmount
-.B -?
-for lists of commands.
+They
+are useful mainly to help debug problems with
+starting 
+.I nfs
+itself.
+The 
+.B -R
+option causes them to print all RPC messages sent and received.
+.PP
+.I Portmap
+queries a Sun RPC portmap server, which maps integer
+(program, version, protocol) triples to port numbers.
+Program and version are Sun RPC defined, while protocol
+is typically TCP (6) or UDP (17).
+The commands are:
+.TP
+.B null
+a no-op
+.TP
+.B dump
+print the entire map
+.TP
+.B set \fIprog\fP \fIvers\fP \fIproto\fP \fIport\fP
+add an entry to (or replace an entry in) the map
+.TP
+.B unset \fIprog\fP \fIvers\fP \fIproto\fP \fIport\fP
+remove an entry from the map
+.TP
+.B getport \fIprog\fP \fIvers\fP \fIproto\fP
+look for an entry with \fIprog\fP, \fIvers\fP, \fIproto\fP
+in the map, and return the corresponding port
+.PD
+The default command is
+.BR dump .
+For running NFS over UDP, there must be an entry
+for the NFS v3 mount daemon (100005, 3, 17) and the
+NFS v3 server itself (100003, 3, 17).  
+.PP
+.I Nfsmount
+queries a Sun NFS mount server, which authenticates (ha!)
+connections and hands out file handles naming the root of
+an exported file system.  This handle is used as the basis
+for a conversation with the NFS service daemon itself.
+The commands are:
+.TP
+.B null
+a no-op
+.TP
+.B export
+dump the export table;
+each line is a path followed by a list of machines or groups
+allowed to mount that path
+.TP
+.B mnt \fIpath\fR
+attempt to acquire a file handle for \fIpath\fR.
+the request has user and group id 1001 and
+.L gnot
+as the system name.
+.TP
+.B umnt \fIpath\fR
+notify the mount daemon that a particular path is being
+unmounted by the requesting system
+.TP
+.B umntall
+notify the mount daemon that all paths mounted by the
+requesting system are being unmounted
+.TP
+.B dump
+should also dump an export table, but typically 
+does nothing
+.PD
 .SH EXAMPLE
 We use this in our
 .B /rc/bin/9fs

+ 1 - 1
sys/src/cmd/aux/portmap.c

@@ -166,7 +166,7 @@ threadmain(int argc, char **argv)
 		break;
 	}ARGEND
 
-	if(argc < 2)
+	if(argc < 1)
 		usage();
 
 	fmtinstall('B', sunRpcFmt);

+ 14 - 5
sys/src/cmd/nfs.c

@@ -840,7 +840,8 @@ readmap(char *passwd, char *group)
 				continue;
 			}
 			if(u->ng >= nelem(u->g)){
-				fprint(2, "%s:%d: user %s is in too many groups; ignoring %s\n", group, line, p, name);
+				if(verbose)
+					fprint(2, "%s:%d: user %s is in too many groups; ignoring %s\n", group, line, p, name);
 				continue;
 			}
 			u->g[u->ng++] = gid;
@@ -1016,6 +1017,7 @@ fsopen(Req *r)
 {
 	FidAux *aux;
 	Nfs3Attr attr;
+	Nfs3SetAttr sa;
 	u1int have;
 	ulong a, b;
 
@@ -1023,26 +1025,33 @@ fsopen(Req *r)
 	a = 0;
 	switch(r->ifcall.mode&OMASK){
 	case OREAD:
-		a = 1;
+		a = 0x0001;
 		break;
 	case OWRITE:
-		a = 2;
+		a = 0x0004;
 		break;
 	case ORDWR:
-		a = 3;
+		a = 0x0001|0x0004;
 		break;
 	case OEXEC:
 		a = 0x20;
 		break;
 	}
 	if(r->ifcall.mode&OTRUNC)
-		a = 0x10;
+		a |= 0x0004;
 
 	if(nfsAccess(aux->auth, r->tag, &aux->handle, a, &b, &have, &attr) < 0
 	|| (!have && nfsGetattr(aux->auth, r->tag, &aux->handle, &attr) < 0)){
+    Error:
 		responderrstr(r);
 		return;
 	}
+	if(r->ifcall.mode&OTRUNC){
+		memset(&sa, 0, sizeof sa);
+		sa.setSize = 1;
+		if(nfsSetattr(aux->auth, r->tag, &aux->handle, &sa) < 0)
+			goto Error;
+	}
 	attrToQid(&attr, &r->fid->qid);
 	r->ofcall.qid = r->fid->qid;
 	respond(r, nil);