]> git.lizzy.rs Git - plan9front.git/commitdiff
add import -z option to skip initial tree negotiation (from mycroftiv)
authorcinap_lenrek <cinap_lenrek@gmx.de>
Tue, 2 Apr 2013 02:23:26 +0000 (04:23 +0200)
committercinap_lenrek <cinap_lenrek@gmx.de>
Tue, 2 Apr 2013 02:23:26 +0000 (04:23 +0200)
sys/man/4/import
sys/src/cmd/import.c

index d8026c7af9c5ce50796c7f04a9933739e319b56c..17ebe95fb039fece7928a3f62fdf442dec6ffcea 100644 (file)
@@ -68,6 +68,19 @@ is a directory.
 Skip the authentication protocol.
 This is useful for connecting to foreign systems like Inferno.
 .TP
+.B -z
+Bypass the initial protocol request for which remote tree to serve.
+This is necessary when the remote 
+.IR exportfs (4) 
+is running with the 
+.B -r 
+or 
+.B -S 
+options which pre-select a file tree to serve. The exception is if both sides are
+operating in the
+.B -B
+backwards mode.
+.TP
 .B -B
 Run in ``backwards'' mode, described below.
 .TP
index f834db929e4f37da9b6dd849afabe590f314df83..07ed96fe636c479b435b5212fbb802de6f2361d7 100644 (file)
@@ -25,6 +25,7 @@ AuthInfo      *ai;
 int            debug;
 int            doauth = 1;
 int            timedout;
+int            skiptree;
 
 int    connect(char*, char*, int);
 int    passive(void);
@@ -145,6 +146,9 @@ main(int argc, char **argv)
        case 'B':
                backwards = 1;
                break;
+       case 'z':
+               skiptree = 1;
+               break;
        default:
                usage();
        }ARGEND;
@@ -315,20 +319,22 @@ connect(char *system, char *tree, int oldserver)
                        sysfatal("%r: %s", system);
        }
 
-       procsetname("writing tree name %s", tree);
-       n = write(fd, tree, strlen(tree));
-       if(n < 0)
-               sysfatal("can't write tree: %r");
-
-       strcpy(buf, "can't read tree");
-
-       procsetname("awaiting OK for %s", tree);
-       n = read(fd, buf, sizeof buf - 1);
-       if(n!=2 || buf[0]!='O' || buf[1]!='K'){
-               if (timedout)
-                       sysfatal("timed out connecting to %s", na);
-               buf[sizeof buf - 1] = '\0';
-               sysfatal("bad remote tree: %s", buf);
+       if(!skiptree){
+               procsetname("writing tree name %s", tree);
+               n = write(fd, tree, strlen(tree));
+               if(n < 0)
+                       sysfatal("can't write tree: %r");
+
+               strcpy(buf, "can't read tree");
+
+               procsetname("awaiting OK for %s", tree);
+               n = read(fd, buf, sizeof buf - 1);
+               if(n!=2 || buf[0]!='O' || buf[1]!='K'){
+                       if (timedout)
+                               sysfatal("timed out connecting to %s", na);
+                       buf[sizeof buf - 1] = '\0';
+                       sysfatal("bad remote tree: %s", buf);
+               }
        }
 
        if(oldserver)
@@ -366,7 +372,7 @@ void
 usage(void)
 {
        fprint(2, "usage: import [-abcC] [-A] [-E clear|ssl|tls] "
-"[-e 'crypt auth'|clear] [-k keypattern] [-p] host remotefs [mountpoint]\n");
+"[-e 'crypt auth'|clear] [-k keypattern] [-p] [-z] host remotefs [mountpoint]\n");
        exits("usage");
 }