tvacfs: implement -m flag - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit be3e351464e9c656eae8644727060f3d458a2984
 (DIR) parent 6bcc5ae9851fc3db44144b4f07d77b3e1224232e
 (HTM) Author: Russ Cox <rsc@swtch.com>
       Date:   Thu, 17 Apr 2008 16:12:34 -0400
       
       vacfs: implement -m flag
       
       Diffstat:
         M man/man4/vacfs.4                    |      15 +++++++--------
         M src/cmd/vac/vacfs.c                 |      20 +++++++-------------
       
       2 files changed, 14 insertions(+), 21 deletions(-)
       ---
 (DIR) diff --git a/man/man4/vacfs.4 b/man/man4/vacfs.4
       t@@ -14,10 +14,10 @@ vacfs \- a Venti-based file system
        .B -h
        .I host
        ]
       -.\" [
       -.\" .B -m
       -.\" .I mtpt
       -.\" ]
       +[
       +.B -m
       +.I mtpt
       +]
        [
        .B -s
        .I srvname
       t@@ -59,10 +59,9 @@ metaname
        .TP
        .B -i
        Use file descriptors 0 and 1 as the 9P communication channel rather than create a pipe.
       -.\" .TP
       -.\" .BI -m " mtpt
       -.\" The location to mount the file system. The default is
       -.\" .BR /n/vac .
       +.TP
       +.BI -m " mtpt
       +The location to mount the file system. The default is not to mount.
        .TP
        .BI -p
        Disables permission checking.
 (DIR) diff --git a/src/cmd/vac/vacfs.c b/src/cmd/vac/vacfs.c
       t@@ -62,6 +62,7 @@ VtConn  *conn;
        /* VtSession *session; */
        int        noperm;
        int        dotu;
       +char *defmnt;
        
        Fid *        newfid(int);
        void        error(char*);
       t@@ -166,6 +167,9 @@ threadmain(int argc, char *argv[])
                case 's':
                        defsrv = EARGF(usage());
                        break;
       +        case 'm':
       +                defmnt = EARGF(usage());
       +                break;
                case 'p':
                        noperm = 1;
                        break;
       t@@ -189,7 +193,7 @@ threadmain(int argc, char *argv[])
                mfd[1] = p[0];
                proccreate(srv, 0, 32 * 1024);
        
       -        if(defsrv == nil){
       +        if(defsrv == nil && defmnt == nil){
                        q = strrchr(argv[0], '/');
                        if(q)
                                q++;
       t@@ -203,7 +207,7 @@ threadmain(int argc, char *argv[])
                                defsrv[l-4] = 0;
                }
        
       -        if(post9pservice(p[1], defsrv) != 0) 
       +        if(post9pservice(p[1], defsrv, defmnt) != 0) 
                        sysfatal("post9pservice");
        
                threadexits(0);
       t@@ -814,18 +818,8 @@ io(void)
                int n;
        
                for(;;){
       -                /*
       -                 * reading from a pipe or a network device
       -                 * will give an error after a few eof reads
       -                 * however, we cannot tell the difference
       -                 * between a zero-length read and an interrupt
       -                 * on the processes writing to us,
       -                 * so we wait for the error
       -                 */
                        n = read9pmsg(mfd[0], mdata, sizeof mdata);
       -                if(n == 0)
       -                        continue;
       -                if(n < 0)
       +                if(n <= 0)
                                break;
                        if(convM2Su(mdata, n, &rhdr, dotu) != n)
                                sysfatal("convM2S conversion error");