shithub: riscv

Download patch

ref: 61e9d23eb24ce2e1fda045f74752a825f0545aa1
parent: 12d6eb0ce3d6701a7a5e44083e18a3cb32a64539
author: cinap_lenrek <[email protected]>
date: Fri Aug 21 19:22:59 EDT 2015

cpu, import: remove old9p support

--- a/sys/man/1/cpu
+++ b/sys/man/1/cpu
@@ -36,8 +36,6 @@
 .I address
 ] [
 .B -R
-|
-.B -O
 ]
 .SH DESCRIPTION
 .I Cpu
@@ -183,12 +181,6 @@
 It is run from service files such as
 .BR /bin/service/tcp17010 .
 The
-.B -O
-flag is similar but simulates the pre-9P2000 version
-of the 
-.I cpu
-protocol.
-The
 .B -n
 option allows using the
 .B none
@@ -195,9 +187,7 @@
 authentication method for incoming connections and must be
 specified before the
 .B -R
-and
-.B -O
-flags.
+flag.
 .PP
 The
 .B -p
--- a/sys/man/4/srv
+++ b/sys/man/4/srv
@@ -1,6 +1,6 @@
 .TH SRV 4 
 .SH NAME
-srv, srvold9p, 9fs, srvssh \- start network file service
+srv, srvssh, 9fs \- start network file service
 .SH SYNOPSIS
 .B srv
 [
@@ -41,35 +41,6 @@
 .B 9fs
 .RI [ net !] system
 .RI [ mountpoint ]
-.PP
-.in +0.5i
-.ti -0.5i
-.B srvold9p
-[
-.B -abcCdF
-] [
-.B -p
-.I servicename
-] [
-.B -s
-|
-.B -m
-.I mountpoint
-] [
-.B -u
-.I user
-] [
-.B -x
-.I command
-|
-.B -n
-.I network-addr
-|
-.B -f
-.I file
-]
-.br
-.in -0.5i
 .SH DESCRIPTION
 .I Srv
 dials the given machine and initializes the connection to serve the
@@ -208,67 +179,6 @@
 .BR /rc/bin/srvssh .
 The arguments are the same as
 .IR srv .
-.PP
-.I Srvold9p
-is a compatibilty hack to allow Fourth Edition Plan 9 systems
-to connect to older 9P servers.
-It functions as a variant of
-.I srv
-that performs a version translation on the 9P messages on the underlying connection.
-Some of its options are the same as those of
-.IR srv ;
-the special ones are:
-.TF "-x commandxx"
-.PD
-.TP
-.B -d
-Enable debugging.
-.TP
-.B -F
-Insert a special (internal) filter process to the connection to maintain
-message boundaries; usually only needed on TCP connections.
-.TP
-.BI -p\  servicename
-Post the service under
-.IR srv (3)
-as
-.BI /srv/ servicename\f1.
-.TP
-.BI -u\  user
-When connecting to the remote server, log in as
-.IR user .
-Since
-.I srvold9p
-does no authentication, and since new kernels cannot authenticate to
-old services, the likeliest value of
-.I user
-is
-.BR none .
-.TP
-.BI -x\  command
-Run
-.I command
-and use its standard input and output as the 9P service connection.
-If the
-.I command
-string contains blanks, it should be quoted.
-.TP
-.BI -n\  network-addr
-Dial
-.I network-addr
-to establish the connection.
-.TP
-.BI -f\  file
-Use
-.I file
-(typically an existing
-.IR srv (3)
-file) as the connection.
-.PP
-.I Srvold9p
-is run automatically when a
-.IR cpu (1)
-call is received on the service port for the old protocol.
 .SH EXAMPLES
 To see kremvax's and deepthought's files in
 .B /n/kremvax
@@ -280,20 +190,6 @@
 9fs hhgttg /n/deepthought
 .EE
 .PP
-To mount as user
-.B none
-a connection to an older server kgbsun:
-.IP
-.EX
-srvold9p -u none -m /n/kgbsun -p kgbsun -n il!kgbsun
-.EE
-.PP
-Other windows may then mount the connection directly:
-.IP
-.EX
-mount /srv/kgbsun /n/kgbsun
-.EE
-.PP
 To connect to an instance of the Unix server
 .IR u9fs (4)
 started via
@@ -316,8 +212,6 @@
 .B /rc/bin/9fs
 .br
 .B /rc/bin/srvssh
-.br
-.B /sys/src/cmd/srvold9p
 .SH "SEE ALSO"
 .IR bind (1),
 .IR auth (2),
--- a/sys/src/cmd/cpu.c
+++ b/sys/src/cmd/cpu.c
@@ -14,7 +14,7 @@
 #define	Maxfdata 8192
 #define MaxStr 128
 
-void	remoteside(int);
+void	remoteside(void);
 void	fatal(char*, ...);
 void	lclnoteproc(int);
 void	rmtnoteproc(void);
@@ -69,8 +69,6 @@
 };
 AuthMethod *am = authmethod;	/* default is p9 */
 
-char *p9authproto = "p9any";
-
 int setam(char*);
 
 char	*aan = "/bin/aan";
@@ -188,12 +186,8 @@
 	case 'A':
 		anstring = EARGF(usage());
 		break;
-	case 'O':
-		p9authproto = "p9sk2";
-		remoteside(1);				/* From listen */
-		break;
 	case 'R':				/* From listen */
-		remoteside(0);
+		remoteside();
 		break;
 	case 'h':
 		system = EARGF(usage());
@@ -297,47 +291,9 @@
 
 char *negstr = "negotiating authentication method";
 
-int
-old9p(int fd)
-{
-	int p[2];
-
-	if(pipe(p) < 0)
-		fatal("pipe: %r");
-
-	switch(rfork(RFPROC|RFMEM|RFFDG|RFNAMEG|RFREND)) {
-	case -1:
-		fatal("rfork srvold9p: %r");
-	case 0:
-		if(fd != 1){
-			dup(fd, 1);
-			close(fd);
-		}
-		if(p[0] != 0){
-			dup(p[0], 0);
-			close(p[0]);
-		}
-		close(p[1]);
-		if(0){
-			fd = open("/sys/log/cpu", OWRITE);
-			if(fd != 2){
-				dup(fd, 2);
-				close(fd);
-			}
-			execl("/bin/srvold9p", "srvold9p", "-ds", nil);
-		} else
-			execl("/bin/srvold9p", "srvold9p", "-s", nil);
-		fatal("exec srvold9p: %r");
-	default:
-		close(fd);
-		close(p[0]);
-	}
-	return p[1];	
-}
-
 /* Invoked with stdin and stdout connected to the network connection */
 void
-remoteside(int old)
+remoteside(void)
 {
 	char user[MaxStr], buf[MaxStr], xdir[MaxStr], cmd[MaxStr];
 	int i, n, fd, badchdir, gotcmd;
@@ -351,7 +307,7 @@
 	if(n < 0)
 		fatal("authenticating: %r");
 	filterp = nil;
-	if(!old && strcmp(cmd, "aan") == 0){
+	if(strcmp(cmd, "aan") == 0){
 		filterp = aan;
 		writestr(fd, "", nil, 1);
 		n = readstr(fd, cmd, sizeof(cmd));
@@ -396,9 +352,6 @@
 	if(n != 2 || buf[0] != 'O' || buf[1] != 'K')
 		exits("remote tree");
 
-	if(old)
-		fd = old9p(fd);
-
 	/* make sure buffers are big by doing fversion explicitly; pick a huge number; other side will trim */
 	strcpy(buf, VERSION9P);
 	if(fversion(fd, 64*1024, buf, sizeof buf) < 0)
@@ -666,7 +619,7 @@
 {
 	AuthInfo *ai;
 
-	ai = auth_proxy(fd, auth_getkey, "proto=%q role=client %s", p9authproto, keyspec);
+	ai = auth_proxy(fd, auth_getkey, "proto=p9any role=client %s", keyspec);
 	if(ai == nil)
 		return -1;
 	fd = sslsetup(fd, ai->secret, ai->nsecret, 1);
@@ -695,7 +648,7 @@
 {
 	AuthInfo *ai;
 
-	ai = auth_proxy(fd, nil, "proto=%q role=server %s", p9authproto, keyspec);
+	ai = auth_proxy(fd, nil, "proto=p9any role=server %s", keyspec);
 	if(ai == nil)
 		return -1;
 	if(auth_chuid(ai, nil) < 0)
--- a/sys/src/cmd/import.c
+++ b/sys/src/cmd/import.c
@@ -28,9 +28,8 @@
 int		timedout;
 int		skiptree;
 
-int	connect(char*, char*, int);
+int	connect(char*, char*);
 int	passive(void);
-int	old9p(int);
 void	catcher(void*, char*);
 void	sysfatal(char*, ...);
 void	usage(void);
@@ -94,11 +93,10 @@
 main(int argc, char **argv)
 {
 	char *mntpt, *srvpost, srvfile[64];
-	int backwards = 0, fd, mntflags, oldserver;
+	int backwards = 0, fd, mntflags;
 
 	quotefmtinstall();
 	srvpost = nil;
-	oldserver = 0;
 	mntflags = MREPL;
 	ARGBEGIN{
 	case 'A':
@@ -122,10 +120,6 @@
 	case 'f':
 		/* ignored but allowed for compatibility */
 		break;
-	case 'O':
-	case 'o':
-		oldserver = 1;
-		break;
 	case 'E':
 		if ((encproto = lookup(EARGF(usage()), encprotos)) < 0)
 			usage();
@@ -188,11 +182,9 @@
 	if (backwards)
 		fd = passive();
 	else
-		fd = connect(argv[0], argv[1], oldserver);
+		fd = connect(argv[0], argv[1]);
 
-	if (!oldserver)
-		fprint(fd, "impo %s %s\n", filterp? "aan": "nofilter",
-			encprotos[encproto]);
+	fprint(fd, "impo %s %s\n", filterp? "aan": "nofilter", encprotos[encproto]);
 
 	if (encproto != Encnone && ealgs && ai) {
 		uchar key[16], digest[SHA1dlen];
@@ -259,50 +251,10 @@
 }
 
 int
-old9p(int fd)
+connect(char *system, char *tree)
 {
-	int p[2];
-
-	procsetname("old9p");
-	if(pipe(p) < 0)
-		sysfatal("pipe: %r");
-
-	switch(rfork(RFPROC|RFMEM|RFFDG|RFNAMEG)) {
-	case -1:
-		sysfatal("rfork srvold9p: %r");
-	case 0:
-		if(fd != 1){
-			dup(fd, 1);
-			close(fd);
-		}
-		if(p[0] != 0){
-			dup(p[0], 0);
-			close(p[0]);
-		}
-		close(p[1]);
-		if(0){
-			fd = open("/sys/log/cpu", OWRITE);
-			if(fd != 2){
-				dup(fd, 2);
-				close(fd);
-			}
-			execl("/bin/srvold9p", "srvold9p", "-ds", nil);
-		} else
-			execl("/bin/srvold9p", "srvold9p", "-s", nil);
-		sysfatal("exec srvold9p: %r");
-	default:
-		close(fd);
-		close(p[0]);
-	}
-	return p[1];
-}
-
-int
-connect(char *system, char *tree, int oldserver)
-{
 	char buf[ERRMAX], dir[128], *na;
 	int fd, n;
-	char *authp;
 
 	na = netmkaddr(system, 0, "exportfs");
 	procsetname("dial %s", na);
@@ -310,15 +262,8 @@
 		sysfatal("can't dial %s: %r", system);
 
 	if(doauth){
-		if(oldserver)
-			authp = "p9sk2";
-		else
-			authp = "p9any";
-
-		procsetname("auth_proxy auth_getkey proto=%q role=client %s",
-			authp, keyspec);
-		ai = auth_proxy(fd, auth_getkey, "proto=%q role=client %s",
-			authp, keyspec);
+		procsetname("auth_proxy auth_getkey proto=p9any role=client %s", keyspec);
+		ai = auth_proxy(fd, auth_getkey, "proto=p9any role=client %s", keyspec);
 		if(ai == nil)
 			sysfatal("%r: %s", system);
 	}
@@ -340,9 +285,6 @@
 			sysfatal("bad remote tree: %s", buf);
 		}
 	}
-
-	if(oldserver)
-		return old9p(fd);
 	return fd;
 }