CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: christos Date: Sun Aug 30 21:12:45 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: Makefile Log Message: include bsd.init.mk to avoid: make: Bad conditional expression ` != "no"' in != "no"? -DINET6 : To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/puffs/mount_9p/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/Makefile diff -u src/usr.sbin/puffs/mount_9p/Makefile:1.5 src/usr.sbin/puffs/mount_9p/Makefile:1.6 --- src/usr.sbin/puffs/mount_9p/Makefile:1.5 Thu Jun 18 21:19:50 2020 +++ src/usr.sbin/puffs/mount_9p/Makefile Sun Aug 30 17:12:45 2020 @@ -1,6 +1,8 @@ -# $NetBSD: Makefile,v 1.5 2020/06/19 01:19:50 uwe Exp $ +# $NetBSD: Makefile,v 1.6 2020/08/30 21:12:45 christos Exp $ # +.include + PROG= mount_9p SRCS= ninepuffs.c ninebuf.c nineproto.c fs.c node.c subr.c LDADD+= -lpuffs -lutil
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Fri Jun 19 01:19:51 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: Makefile Log Message: Use ?:: modifier instead of .if to check for ipv6. This way we don't have to include bsd.init.mk early. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/puffs/mount_9p/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/Makefile diff -u src/usr.sbin/puffs/mount_9p/Makefile:1.4 src/usr.sbin/puffs/mount_9p/Makefile:1.5 --- src/usr.sbin/puffs/mount_9p/Makefile:1.4 Sat Jun 13 13:45:06 2020 +++ src/usr.sbin/puffs/mount_9p/Makefile Fri Jun 19 01:19:50 2020 @@ -1,6 +1,5 @@ -# $NetBSD: Makefile,v 1.4 2020/06/13 13:45:06 uwe Exp $ +# $NetBSD: Makefile,v 1.5 2020/06/19 01:19:50 uwe Exp $ # -.include # include early to pick up USE_* PROG= mount_9p SRCS= ninepuffs.c ninebuf.c nineproto.c fs.c node.c subr.c @@ -8,8 +7,6 @@ LDADD+= -lpuffs -lutil MAN= mount_9p.8 -.if (${USE_INET6} != "no") -CPPFLAGS += -DINET6 -.endif +CPPFLAGS += ${${USE_INET6} != "no":? -DINET6 :} .include
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Sun Jun 14 00:30:20 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: mount_9p.8 ninepuffs.c Log Message: Support optional square brackets around the host name. The brackets are required when using numeric IPv6 addresses as they contain colons as part of their syntax. We do not enforce that the thing in the brackets is a numeric IPv6 address - this matches scp syntax and behavior. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/puffs/mount_9p/mount_9p.8 cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/puffs/mount_9p/ninepuffs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/mount_9p.8 diff -u src/usr.sbin/puffs/mount_9p/mount_9p.8:1.14 src/usr.sbin/puffs/mount_9p/mount_9p.8:1.15 --- src/usr.sbin/puffs/mount_9p/mount_9p.8:1.14 Sat Jun 13 13:45:06 2020 +++ src/usr.sbin/puffs/mount_9p/mount_9p.8 Sun Jun 14 00:30:20 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: mount_9p.8,v 1.14 2020/06/13 13:45:06 uwe Exp $ +.\" $NetBSD: mount_9p.8,v 1.15 2020/06/14 00:30:20 uwe Exp $ .\" .\" Copyright (c) 2007 Antti Kantee. All rights reserved. .\" @@ -58,6 +58,10 @@ is supplied, it is used as the mount roo .Ar path must be an absolute path. .Pp +The host name may be optionally enclosed in square brackets. +This is required when using numeric IPv6 addresses as they contain +colons as part of their syntax. +.Pp The .Fl c option enables to mount a file system exported by a VM host through Index: src/usr.sbin/puffs/mount_9p/ninepuffs.c diff -u src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.32 src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.33 --- src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.32 Sat Jun 13 21:23:27 2020 +++ src/usr.sbin/puffs/mount_9p/ninepuffs.c Sun Jun 14 00:30:20 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ninepuffs.c,v 1.32 2020/06/13 21:23:27 uwe Exp $ */ +/* $NetBSD: ninepuffs.c,v 1.33 2020/06/14 00:30:20 uwe Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ninepuffs.c,v 1.32 2020/06/13 21:23:27 uwe Exp $"); +__RCSID("$NetBSD: ninepuffs.c,v 1.33 2020/06/14 00:30:20 uwe Exp $"); #endif /* !lint */ #include @@ -262,16 +262,34 @@ main(int argc, char *argv[]) user = pw->pw_name; } - /* :/mountpath */ - if ((p = strchr(srvhost, ':')) != NULL) { - *p = '\0'; - srvpath = p+1; - if (*srvpath != '/') - errx(1, "%s is not an absolute path", srvpath); - } else { - srvpath = "/"; + /* [host] or [host]:/path with square brackets around host */ + if (server == P9P_SERVER_TCP && *srvhost == '[') { + ++srvhost; + if ((p = strchr(srvhost, ']')) == NULL) + errx(EXIT_FAILURE, "Missing bracket after the host name"); + *p++ = '\0'; + if (*p == '\0') /* [host] */ + srvpath = "/"; + else if (*p == ':') /* [host]:path */ + srvpath = p+1; + else /* [foo]bar */ + errx(EXIT_FAILURE, "Invalid brackets in the host name"); + + } else { /* host or host:/path without brackets around host */ + if ((p = strchr(srvhost, ':')) != NULL) { + *p = '\0'; + srvpath = p+1; + } else { + srvpath = "/"; + } } + if (*srvpath == '\0') + errx(1, "Empty path"); + if (*srvpath != '/') + errx(1, "%s: Not an absolute path", srvpath); + + if (p9p.server == P9P_SERVER_TCP) { p9p.servsock = serverconnect(srvhost, port, family); } else {
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Sat Jun 13 21:23:28 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: ninepuffs.c Log Message: Remove -46 from the -c usage. While here, sync usage with man page (s/devfile/device). To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/puffs/mount_9p/ninepuffs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/ninepuffs.c diff -u src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.31 src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.32 --- src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.31 Sat Jun 13 16:56:46 2020 +++ src/usr.sbin/puffs/mount_9p/ninepuffs.c Sat Jun 13 21:23:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ninepuffs.c,v 1.31 2020/06/13 16:56:46 wiz Exp $ */ +/* $NetBSD: ninepuffs.c,v 1.32 2020/06/13 21:23:27 uwe Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ninepuffs.c,v 1.31 2020/06/13 16:56:46 wiz Exp $"); +__RCSID("$NetBSD: ninepuffs.c,v 1.32 2020/06/13 21:23:27 uwe Exp $"); #endif /* !lint */ #include @@ -61,7 +61,7 @@ usage(void) fprintf(stderr, "usage: %s [-46su] [-o mntopts] [-p port] " "[user@]server[:path] mountpoint\n", getprogname()); - fprintf(stderr, " %s -c [-46su] [-o mntopts] devfile mountpoint\n", + fprintf(stderr, " %s -c [-su] [-o mntopts] device mountpoint\n", getprogname()); exit(1); }
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: wiz Date: Sat Jun 13 16:56:46 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: ninepuffs.c Log Message: Add -46 to usage. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/puffs/mount_9p/ninepuffs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/ninepuffs.c diff -u src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.30 src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.31 --- src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.30 Sat Jun 13 13:45:06 2020 +++ src/usr.sbin/puffs/mount_9p/ninepuffs.c Sat Jun 13 16:56:46 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ninepuffs.c,v 1.30 2020/06/13 13:45:06 uwe Exp $ */ +/* $NetBSD: ninepuffs.c,v 1.31 2020/06/13 16:56:46 wiz Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ninepuffs.c,v 1.30 2020/06/13 13:45:06 uwe Exp $"); +__RCSID("$NetBSD: ninepuffs.c,v 1.31 2020/06/13 16:56:46 wiz Exp $"); #endif /* !lint */ #include @@ -59,9 +59,9 @@ __dead static void usage(void) { - fprintf(stderr, "usage: %s [-su] [-o mntopts] [-p port] " + fprintf(stderr, "usage: %s [-46su] [-o mntopts] [-p port] " "[user@]server[:path] mountpoint\n", getprogname()); - fprintf(stderr, " %s -c [-su] [-o mntopts] devfile mountpoint\n", + fprintf(stderr, " %s -c [-46su] [-o mntopts] devfile mountpoint\n", getprogname()); exit(1); }
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Sat Jun 13 13:45:06 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: Makefile mount_9p.8 ninepuffs.c Log Message: Support IPv6. Use getaddrinfo(3). Add -4 and -6 command line options. Obey USE_INET6. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/puffs/mount_9p/Makefile cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/puffs/mount_9p/mount_9p.8 cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/puffs/mount_9p/ninepuffs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/Makefile diff -u src/usr.sbin/puffs/mount_9p/Makefile:1.3 src/usr.sbin/puffs/mount_9p/Makefile:1.4 --- src/usr.sbin/puffs/mount_9p/Makefile:1.3 Wed Apr 22 15:23:06 2009 +++ src/usr.sbin/puffs/mount_9p/Makefile Sat Jun 13 13:45:06 2020 @@ -1,5 +1,6 @@ -# $NetBSD: Makefile,v 1.3 2009/04/22 15:23:06 lukem Exp $ +# $NetBSD: Makefile,v 1.4 2020/06/13 13:45:06 uwe Exp $ # +.include # include early to pick up USE_* PROG= mount_9p SRCS= ninepuffs.c ninebuf.c nineproto.c fs.c node.c subr.c @@ -7,4 +8,8 @@ LDADD+= -lpuffs -lutil MAN= mount_9p.8 +.if (${USE_INET6} != "no") +CPPFLAGS += -DINET6 +.endif + .include Index: src/usr.sbin/puffs/mount_9p/mount_9p.8 diff -u src/usr.sbin/puffs/mount_9p/mount_9p.8:1.13 src/usr.sbin/puffs/mount_9p/mount_9p.8:1.14 --- src/usr.sbin/puffs/mount_9p/mount_9p.8:1.13 Sat May 30 00:00:35 2020 +++ src/usr.sbin/puffs/mount_9p/mount_9p.8 Sat Jun 13 13:45:06 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: mount_9p.8,v 1.13 2020/05/30 00:00:35 uwe Exp $ +.\" $NetBSD: mount_9p.8,v 1.14 2020/06/13 13:45:06 uwe Exp $ .\" .\" Copyright (c) 2007 Antti Kantee. All rights reserved. .\" @@ -31,7 +31,7 @@ .Nd mount a file server using the 9P resource sharing protocol .Sh SYNOPSIS .Nm -.Op Fl su +.Op Fl 46su .Op Fl o Ar options .Op Fl p Ar port .Oo Ar user Ns Li \&@ Oc Ns Ar host Ns Op Li \&: Ns Ar path @@ -72,6 +72,14 @@ for more information. .Pp The following options are available: .Bl -tag -width "Fl o Ar options" +.It Fl 4 +Forces +.Nm +to use IPv4 addresses only. +.It Fl 6 +Forces +.Nm +to use IPv6 addresses only. .It Fl c Interpret .Ar special Index: src/usr.sbin/puffs/mount_9p/ninepuffs.c diff -u src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.29 src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.30 --- src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.29 Sat May 30 02:53:30 2020 +++ src/usr.sbin/puffs/mount_9p/ninepuffs.c Sat Jun 13 13:45:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ninepuffs.c,v 1.29 2020/05/30 02:53:30 uwe Exp $ */ +/* $NetBSD: ninepuffs.c,v 1.30 2020/06/13 13:45:06 uwe Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ninepuffs.c,v 1.29 2020/05/30 02:53:30 uwe Exp $"); +__RCSID("$NetBSD: ninepuffs.c,v 1.30 2020/06/13 13:45:06 uwe Exp $"); #endif /* !lint */ #include @@ -42,6 +42,7 @@ __RCSID("$NetBSD: ninepuffs.c,v 1.29 202 #include #include +#include #include #include #include @@ -52,7 +53,7 @@ __RCSID("$NetBSD: ninepuffs.c,v 1.29 202 #include "ninepuffs.h" #include "nineproto.h" -#define DEFPORT_9P 564 +#define DEFPORT_9P "564" /* "9pfs", but don't depend on it being in services */ __dead static void usage(void) @@ -66,39 +67,58 @@ usage(void) } /* - * TCPv4 connection to 9P file server, forget IL and IPv6 for now. + * TCP connection to 9P file server. * Return connected socket or exit with error. */ static int -serverconnect(const char *addr, unsigned short port) +serverconnect(const char *hostname, const char *portname, int family) { - struct sockaddr_in mysin; - struct hostent *he; - int s, ret, opt; - - he = gethostbyname2(addr, AF_INET); - if (he == NULL) { - herror("gethostbyname"); - exit(1); + int ret; + + struct addrinfo hints; + memset(&hints, 0, sizeof(hints)); + hints.ai_family = family; + hints.ai_socktype = SOCK_STREAM; + + if (portname == NULL) { + portname = DEFPORT_9P; + hints.ai_flags |= AI_NUMERICSERV; } - s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); - if (s == -1) - err(1, "socket"); + struct addrinfo *ai0; + ret = getaddrinfo(hostname, portname, &hints, &ai0); + if (ret != 0) + errx(EXIT_FAILURE, "%s", gai_strerror(ret)); + + int s = -1; + const char *cause = NULL; + for (struct addrinfo *ai = ai0; ai != NULL; ai = ai->ai_next) { + s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); + if (s < 0) { + cause = "socket"; + continue; + } + + const int opt = 1; + ret = setsockopt(s, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt)); + if (ret < 0) { + cause = "SO_NOSIGPIPE"; + continue; + } - opt = 1; - ret = setsockopt(s, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof(opt)); - if (ret == -1) - err(1, "setsockopt(SO_NOSIGPIPE)"); - - memset(&mysin, 0, sizeof(struct sockaddr_in)); - mysin.sin_family = AF_INET; - mysin.sin_port = htons(port); - memcpy(&mysin.sin_ad
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Mon Jun 1 13:30:52 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: node.c Log Message: Fix extra whitespace added by accident. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/puffs/mount_9p/node.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/node.c diff -u src/usr.sbin/puffs/mount_9p/node.c:1.28 src/usr.sbin/puffs/mount_9p/node.c:1.29 --- src/usr.sbin/puffs/mount_9p/node.c:1.28 Wed May 27 03:25:13 2020 +++ src/usr.sbin/puffs/mount_9p/node.c Mon Jun 1 13:30:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: node.c,v 1.28 2020/05/27 03:25:13 uwe Exp $ */ +/* $NetBSD: node.c,v 1.29 2020/06/01 13:30:52 uwe Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include #ifndef lint -__RCSID("$NetBSD: node.c,v 1.28 2020/05/27 03:25:13 uwe Exp $"); +__RCSID("$NetBSD: node.c,v 1.29 2020/06/01 13:30:52 uwe Exp $"); #endif /* !lint */ #include @@ -595,7 +595,7 @@ puffs9p_node_rename(struct puffs_usermou if (targ) { struct puffs_node *pn_targ = targ; - rv = noderemove(pu, pn_targ); + rv = noderemove(pu, pn_targ); if (rv) goto out; }
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Sat May 30 02:53:30 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: ninepuffs.c Log Message: Initialize puffs9p::server (though it's not used anywhere). To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/puffs/mount_9p/ninepuffs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/ninepuffs.c diff -u src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.28 src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.29 --- src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.28 Fri May 29 23:49:08 2020 +++ src/usr.sbin/puffs/mount_9p/ninepuffs.c Sat May 30 02:53:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ninepuffs.c,v 1.28 2020/05/29 23:49:08 uwe Exp $ */ +/* $NetBSD: ninepuffs.c,v 1.29 2020/05/30 02:53:30 uwe Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ninepuffs.c,v 1.28 2020/05/29 23:49:08 uwe Exp $"); +__RCSID("$NetBSD: ninepuffs.c,v 1.29 2020/05/30 02:53:30 uwe Exp $"); #endif /* !lint */ #include @@ -207,6 +207,7 @@ main(int argc, char *argv[]) p9p.maxreq = P9P_DEFREQLEN; p9p.nextfid = 1; p9p.protover = protover; + p9p.server = server; /* user@ */ if ((p = strchr(argv[0], '@')) != NULL) { @@ -233,7 +234,7 @@ main(int argc, char *argv[]) srvpath = "/"; } - if (server == P9P_SERVER_TCP) { + if (p9p.server == P9P_SERVER_TCP) { p9p.servsock = serverconnect(srvhost, port); } else { /* path to a vio9p(4) device, e.g., /dev/vio9p0 */
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Sat May 30 00:00:35 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: mount_9p.8 Log Message: Provide list of options for ease of reference. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/puffs/mount_9p/mount_9p.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/mount_9p.8 diff -u src/usr.sbin/puffs/mount_9p/mount_9p.8:1.12 src/usr.sbin/puffs/mount_9p/mount_9p.8:1.13 --- src/usr.sbin/puffs/mount_9p/mount_9p.8:1.12 Mon Oct 28 13:42:28 2019 +++ src/usr.sbin/puffs/mount_9p/mount_9p.8 Sat May 30 00:00:35 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: mount_9p.8,v 1.12 2019/10/28 13:42:28 wiz Exp $ +.\" $NetBSD: mount_9p.8,v 1.13 2020/05/30 00:00:35 uwe Exp $ .\" .\" Copyright (c) 2007 Antti Kantee. All rights reserved. .\" @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd October 24, 2019 +.Dd May 30, 2020 .Dt MOUNT_9P 8 .Os .Sh NAME @@ -32,21 +32,21 @@ .Sh SYNOPSIS .Nm .Op Fl su -.Op Fl o Ar mntopts +.Op Fl o Ar options .Op Fl p Ar port -.Ar [user@]host[:path] +.Oo Ar user Ns Li \&@ Oc Ns Ar host Ns Op Li \&: Ns Ar path .Ar mount_point .Nm .Fl c .Op Fl su -.Op Fl o Ar mntopts -.Ar devfile +.Op Fl o Ar options +.Ar device .Ar mount_point .Sh DESCRIPTION The .Nm program is used to mount a file hierarchy served with the Plan 9 -file sharing protocol: 9P. +resource sharing protocol 9P. After the file system is mounted, the files on the remote .Ar host will be accessed using the credentials of the user named @@ -60,9 +60,9 @@ must be an absolute path. .Pp The .Fl c -opiton enables to mount a file system exported by a VM host through +option enables to mount a file system exported by a VM host through a character device file -.Ar devfile +.Ar device backed by the .Xr vio9p 4 driver. @@ -70,31 +70,46 @@ See .Xr vio9p 4 for more information. .Pp +The following options are available: +.Bl -tag -width "Fl o Ar options" +.It Fl c +Interpret +.Ar special +as a device name. +See +.Xr vio9p 4 . +.It Fl o Ar options +Mount options. +See documentation for the +.Fl o +option to +.Xr mount 8 . +.It Fl p Ar port +Use the specified TCP port. By default .Nm -runs in the background with -.Xr daemon 3 . -With the -.Fl s -option -.Nm -runs in the forground. -.Pp -By default -.Nm -follows the 9P2000 protocol. -With the -.Fl u -option -.Nm -follows the 9P2000.u protocol that includes extensions to better support Unix +uses port 564 +.Li ( 9pfs ) . +Another useful port is +.Li ( styx ) , +used by Inferno operating system. +.It Fl s +Run in the foreground. +Useful for debugging. +.It Fl u +Use 9P2000.u protocol that includes extensions to better support Unix environments. +.El .Sh SEE ALSO .Xr puffs 3 , .Xr puffs 4 , .Xr vio9p 4 , .Xr mount 8 .Rs +.%T 9P: The Simple Distributed File System from Bell Labs +.%U http://9p.cat-v.org/ +.Re +.Rs .%T RFC and standards documents relating the 9P protocol .%U http://ericvh.github.io/9p-rfc/ .Re @@ -108,16 +123,14 @@ Experimental 9P2000.u support appeared i .Nx 9.0 . .Pp The -.Fl c -option appeared in +.Xr vio9p 4 +support appeared in .Nx 10.0 . .Sh CAVEATS -Permissions are not handled well. +Authentication is not supported. .Pp -Authentication support is missing. +Permissions are not handled well. .Pp Error code handling is missing for 9P2000. .Pp -Under construction. -.Pp 9P2000.u support doesn't use extension fields.
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Fri May 29 23:49:09 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: ninepuffs.c Log Message: Fix vio9p device name in a comment. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/puffs/mount_9p/ninepuffs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/ninepuffs.c diff -u src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.27 src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.28 --- src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.27 Mon Oct 28 02:59:25 2019 +++ src/usr.sbin/puffs/mount_9p/ninepuffs.c Fri May 29 23:49:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ninepuffs.c,v 1.27 2019/10/28 02:59:25 ozaki-r Exp $ */ +/* $NetBSD: ninepuffs.c,v 1.28 2020/05/29 23:49:08 uwe Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -31,7 +31,7 @@ #include #ifndef lint -__RCSID("$NetBSD: ninepuffs.c,v 1.27 2019/10/28 02:59:25 ozaki-r Exp $"); +__RCSID("$NetBSD: ninepuffs.c,v 1.28 2020/05/29 23:49:08 uwe Exp $"); #endif /* !lint */ #include @@ -236,7 +236,7 @@ main(int argc, char *argv[]) if (server == P9P_SERVER_TCP) { p9p.servsock = serverconnect(srvhost, port); } else { - /* path to a viop9fs chardev file, e.g., /dev/viop9fs0 */ + /* path to a vio9p(4) device, e.g., /dev/vio9p0 */ p9p.servsock = open_cdev(argv[0]); }
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Thu May 28 14:00:05 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: fs.c Log Message: Do not send dummy Tauth, it's completely unnecessary. The best way to not use authentication is to not use authentication. Cf. http://man.cat-v.org/plan_9/5/attach To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/puffs/mount_9p/fs.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/fs.c diff -u src/usr.sbin/puffs/mount_9p/fs.c:1.10 src/usr.sbin/puffs/mount_9p/fs.c:1.11 --- src/usr.sbin/puffs/mount_9p/fs.c:1.10 Fri May 17 08:48:04 2019 +++ src/usr.sbin/puffs/mount_9p/fs.c Thu May 28 14:00:05 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fs.c,v 1.10 2019/05/17 08:48:04 ozaki-r Exp $ */ +/* $NetBSD: fs.c,v 1.11 2020/05/28 14:00:05 uwe Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include #ifndef lint -__RCSID("$NetBSD: fs.c,v 1.10 2019/05/17 08:48:04 ozaki-r Exp $"); +__RCSID("$NetBSD: fs.c,v 1.11 2020/05/28 14:00:05 uwe Exp $"); #endif /* !lint */ #include @@ -109,27 +109,6 @@ p9p_handshake(struct puffs_usermount *pu /* Should downgrade from 9P2000.u to 9P2000 if the server request? */ } - /* tell the server we don't support authentication */ - p9pbuf_recycleout(pb); - tagid = NEXTTAG(p9p); - p9pbuf_put_1(pb, P9PROTO_T_AUTH); - p9pbuf_put_2(pb, tagid); - p9pbuf_put_4(pb, P9PROTO_NOFID); - p9pbuf_put_str(pb, username); - p9pbuf_put_str(pb, ""); - if (p9p->protover == P9PROTO_VERSION_U) - p9pbuf_put_4(pb, P9PROTO_NUNAME_UNSPECIFIED); /* n_uname[4] */ - DO_IO(p9pbuf_write, pu, pb, p9p->servsock, &done, rv); - - puffs_framebuf_recycle(pb); - DO_IO(p9pbuf_read, pu, pb, p9p->servsock, &done, rv); - - /* assume all Rerror is "no auth" */ - if (p9pbuf_get_type(pb) != P9PROTO_R_ERROR) - errx(1, "mount_9p supports only NO auth"); - if ((rtagid = p9pbuf_get_tag(pb)) != tagid) - errx(1, "server invalid tag: %d vs. %d", tagid, rtagid); - /* build attach message */ p9pbuf_recycleout(pb); tagid = NEXTTAG(p9p);
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Wed May 27 03:25:13 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: node.c Log Message: puffs9p_node_rename - 9P rename is done with Twstat and can only change the last pathname component. Return EXDEV for attempts to move a file to a different directory to make mv(1) fall back to copying. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/puffs/mount_9p/node.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/node.c diff -u src/usr.sbin/puffs/mount_9p/node.c:1.27 src/usr.sbin/puffs/mount_9p/node.c:1.28 --- src/usr.sbin/puffs/mount_9p/node.c:1.27 Wed May 27 00:36:07 2020 +++ src/usr.sbin/puffs/mount_9p/node.c Wed May 27 03:25:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: node.c,v 1.27 2020/05/27 00:36:07 uwe Exp $ */ +/* $NetBSD: node.c,v 1.28 2020/05/27 03:25:13 uwe Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include #ifndef lint -__RCSID("$NetBSD: node.c,v 1.27 2020/05/27 00:36:07 uwe Exp $"); +__RCSID("$NetBSD: node.c,v 1.28 2020/05/27 03:25:13 uwe Exp $"); #endif /* !lint */ #include @@ -572,22 +572,22 @@ puffs9p_node_rmdir(struct puffs_usermoun return rv; } -/* - * 9P supports renames only for files within a directory - * from what I could tell. So just support in-directory renames - * for now. - */ -int -puffs9p_node_rename(struct puffs_usermount *pu, void *opc, void *src, - const struct puffs_cn *pcn_src, void *targ_dir, void *targ, - const struct puffs_cn *pcn_targ) +int +puffs9p_node_rename(struct puffs_usermount *pu, + void *src_dir, void *src, const struct puffs_cn *pcn_src, + void *targ_dir, void *targ, const struct puffs_cn *pcn_targ) { AUTOVAR(pu); struct puffs_node *pn_src = src; struct p9pnode *p9n_src = pn_src->pn_data; - if (opc != targ_dir) { - rv = EOPNOTSUPP; + /* + * 9P rename can only change the last pathname component. + * Return EXDEV for attempts to move a file to a different + * directory to make mv(1) fall back to copying. + */ + if (src_dir != targ_dir) { + rv = EXDEV; goto out; }
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Wed May 27 00:36:08 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: node.c Log Message: noderemove - do not call puffs_setback here. noderemove is called from rename (for existing target) and calling setback is not appropriate in that context. Do that call instead directly in the callers (remove, rmdir). >From Nicola Girardi, part of PR/54829. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/puffs/mount_9p/node.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/node.c diff -u src/usr.sbin/puffs/mount_9p/node.c:1.26 src/usr.sbin/puffs/mount_9p/node.c:1.27 --- src/usr.sbin/puffs/mount_9p/node.c:1.26 Wed May 27 00:05:22 2020 +++ src/usr.sbin/puffs/mount_9p/node.c Wed May 27 00:36:07 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: node.c,v 1.26 2020/05/27 00:05:22 uwe Exp $ */ +/* $NetBSD: node.c,v 1.27 2020/05/27 00:36:07 uwe Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include #ifndef lint -__RCSID("$NetBSD: node.c,v 1.26 2020/05/27 00:05:22 uwe Exp $"); +__RCSID("$NetBSD: node.c,v 1.27 2020/05/27 00:36:07 uwe Exp $"); #endif /* !lint */ #include @@ -533,9 +533,6 @@ noderemove(struct puffs_usermount *pu, s } out: - if (rv == 0) - puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2); - RETURN(rv); } @@ -543,24 +540,36 @@ int puffs9p_node_remove(struct puffs_usermount *pu, void *opc, void *targ, const struct puffs_cn *pcn) { + struct puffs_cc *pcc = puffs_cc_getcc(pu); struct puffs_node *pn = targ; + int rv; if (pn->pn_va.va_type == VDIR) return EISDIR; - return noderemove(pu, pn); + rv = noderemove(pu, pn); + if (rv == 0) + puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2); + + return rv; } int puffs9p_node_rmdir(struct puffs_usermount *pu, void *opc, void *targ, const struct puffs_cn *pcn) { + struct puffs_cc *pcc = puffs_cc_getcc(pu); struct puffs_node *pn = targ; + int rv; if (pn->pn_va.va_type != VDIR) return ENOTDIR; - return noderemove(pu, pn); + rv = noderemove(pu, pn); + if (rv == 0) + puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2); + + return rv; } /*
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Wed May 27 00:05:22 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: node.c Log Message: puffs9p_node_rename - noderename takes puffs_node, not p9pnode, but this goes undetected b/c pn_data we pass is a pointer to void. >From Nicola Girardi, part of PR/54829. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/puffs/mount_9p/node.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/node.c diff -u src/usr.sbin/puffs/mount_9p/node.c:1.25 src/usr.sbin/puffs/mount_9p/node.c:1.26 --- src/usr.sbin/puffs/mount_9p/node.c:1.25 Tue May 26 22:54:43 2020 +++ src/usr.sbin/puffs/mount_9p/node.c Wed May 27 00:05:22 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: node.c,v 1.25 2020/05/26 22:54:43 uwe Exp $ */ +/* $NetBSD: node.c,v 1.26 2020/05/27 00:05:22 uwe Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include #ifndef lint -__RCSID("$NetBSD: node.c,v 1.25 2020/05/26 22:54:43 uwe Exp $"); +__RCSID("$NetBSD: node.c,v 1.26 2020/05/27 00:05:22 uwe Exp $"); #endif /* !lint */ #include @@ -586,7 +586,7 @@ puffs9p_node_rename(struct puffs_usermou if (targ) { struct puffs_node *pn_targ = targ; - rv = noderemove(pu, pn_targ->pn_data); + rv = noderemove(pu, pn_targ); if (rv) goto out; }
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Tue May 26 22:54:43 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: ninepuffs.h node.c Log Message: Use the typedef to declare tag in AUTOVAR. Do not allocate 9P tags in advance in AUTOVAR, do it right before we need them. Do no reuse tags. If we are going to use sequential tags, we might as well try to make them really sequential. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/puffs/mount_9p/ninepuffs.h cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/puffs/mount_9p/node.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/ninepuffs.h diff -u src/usr.sbin/puffs/mount_9p/ninepuffs.h:1.15 src/usr.sbin/puffs/mount_9p/ninepuffs.h:1.16 --- src/usr.sbin/puffs/mount_9p/ninepuffs.h:1.15 Mon Oct 28 02:59:25 2019 +++ src/usr.sbin/puffs/mount_9p/ninepuffs.h Tue May 26 22:54:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ninepuffs.h,v 1.15 2019/10/28 02:59:25 ozaki-r Exp $ */ +/* $NetBSD: ninepuffs.h,v 1.16 2020/05/26 22:54:43 uwe Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -64,7 +64,7 @@ typedef uint32_t p9pfid_t; #define AUTOVAR(pu) \ struct puffs_cc *pcc = puffs_cc_getcc(pu); \ struct puffs9p *p9p = puffs_getspecific(pu); \ - uint16_t tag = NEXTTAG(p9p); \ + p9ptag_t tag; \ struct puffs_framebuf *pb = p9pbuf_makeout(); \ int rv = 0 Index: src/usr.sbin/puffs/mount_9p/node.c diff -u src/usr.sbin/puffs/mount_9p/node.c:1.24 src/usr.sbin/puffs/mount_9p/node.c:1.25 --- src/usr.sbin/puffs/mount_9p/node.c:1.24 Tue May 26 22:08:11 2020 +++ src/usr.sbin/puffs/mount_9p/node.c Tue May 26 22:54:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: node.c,v 1.24 2020/05/26 22:08:11 uwe Exp $ */ +/* $NetBSD: node.c,v 1.25 2020/05/26 22:54:43 uwe Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include #ifndef lint -__RCSID("$NetBSD: node.c,v 1.24 2020/05/26 22:08:11 uwe Exp $"); +__RCSID("$NetBSD: node.c,v 1.25 2020/05/26 22:54:43 uwe Exp $"); #endif /* !lint */ #include @@ -57,6 +57,7 @@ do_getattr(struct puffs_usermount *pu, s AUTOVAR(pu); struct p9pnode *p9n = pn->pn_data; + tag = NEXTTAG(p9p); p9pbuf_put_1(pb, P9PROTO_T_STAT); p9pbuf_put_2(pb, tag); p9pbuf_put_4(pb, p9n->fid_base); @@ -97,6 +98,7 @@ puffs9p_node_lookup(struct puffs_usermou struct qid9p newqid; uint16_t nqid; + tag = NEXTTAG(p9p); p9pbuf_put_1(pb, P9PROTO_T_WALK); p9pbuf_put_2(pb, tag); p9pbuf_put_4(pb, p9n_dir->fid_base); @@ -232,6 +234,7 @@ puffs9p_node_setattr(struct puffs_usermo struct puffs_node *pn = opc; struct p9pnode *p9n = pn->pn_data; + tag = NEXTTAG(p9p); p9pbuf_put_1(pb, P9PROTO_T_WSTAT); p9pbuf_put_2(pb, tag); p9pbuf_put_4(pb, p9n->fid_base); @@ -327,6 +330,7 @@ puffs9p_node_read(struct puffs_usermount nread = 0; while (*resid > 0 && (uint64_t)(offset+nread) < pn->pn_va.va_size) { + tag = NEXTTAG(p9p); p9pbuf_put_1(pb, P9PROTO_T_READ); p9pbuf_put_2(pb, tag); p9pbuf_put_4(pb, p9n->fid_read); @@ -374,6 +378,7 @@ puffs9p_node_write(struct puffs_usermoun while (*resid > 0) { chunk = MIN(*resid, p9p->maxreq-32); + tag = NEXTTAG(p9p); p9pbuf_put_1(pb, P9PROTO_T_WRITE); p9pbuf_put_2(pb, tag); p9pbuf_put_4(pb, p9n->fid_write); @@ -425,6 +430,7 @@ nodecreate(struct puffs_usermount *pu, s if (rv) goto out; + tag = NEXTTAG(p9p); p9pbuf_put_1(pb, P9PROTO_T_CREATE); p9pbuf_put_2(pb, tag); p9pbuf_put_4(pb, nfid); @@ -448,6 +454,7 @@ nodecreate(struct puffs_usermount *pu, s nfid = NEXTFID(p9p); p9pbuf_recycleout(pb); + tag = NEXTTAG(p9p); p9pbuf_put_1(pb, P9PROTO_T_WALK); p9pbuf_put_2(pb, tag); p9pbuf_put_4(pb, p9n->fid_base); @@ -506,6 +513,7 @@ noderemove(struct puffs_usermount *pu, s if (rv) goto out; + tag = NEXTTAG(p9p); p9pbuf_put_1(pb, P9PROTO_T_REMOVE); p9pbuf_put_2(pb, tag); p9pbuf_put_4(pb, testfid); @@ -583,6 +591,7 @@ puffs9p_node_rename(struct puffs_usermou goto out; } + tag = NEXTTAG(p9p); p9pbuf_put_1(pb, P9PROTO_T_WSTAT); p9pbuf_put_2(pb, tag); p9pbuf_put_4(pb, p9n_src->fid_base);
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Tue May 26 22:33:05 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: nineproto.c Log Message: Do not allocate 9P tags in advance, do it right before we need them. If we are going to use sequential tags, we might as well try to make them really sequential. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/puffs/mount_9p/nineproto.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/nineproto.c diff -u src/usr.sbin/puffs/mount_9p/nineproto.c:1.12 src/usr.sbin/puffs/mount_9p/nineproto.c:1.13 --- src/usr.sbin/puffs/mount_9p/nineproto.c:1.12 Tue May 26 19:41:36 2020 +++ src/usr.sbin/puffs/mount_9p/nineproto.c Tue May 26 22:33:04 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nineproto.c,v 1.12 2020/05/26 19:41:36 uwe Exp $ */ +/* $NetBSD: nineproto.c,v 1.13 2020/05/26 22:33:04 uwe Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include #ifndef lint -__RCSID("$NetBSD: nineproto.c,v 1.12 2020/05/26 19:41:36 uwe Exp $"); +__RCSID("$NetBSD: nineproto.c,v 1.13 2020/05/26 22:33:04 uwe Exp $"); #endif /* !lint */ #include @@ -233,11 +233,12 @@ proto_cc_dupfid(struct puffs_usermount * struct puffs_cc *pcc = puffs_cc_getcc(pu); struct puffs9p *p9p = puffs_getspecific(pu); struct puffs_framebuf *pb; - p9ptag_t tag = NEXTTAG(p9p); + p9ptag_t tag; uint16_t qids; int rv = 0; pb = p9pbuf_makeout(); + tag = NEXTTAG(p9p); p9pbuf_put_1(pb, P9PROTO_T_WALK); p9pbuf_put_2(pb, tag); p9pbuf_put_4(pb, oldfid); @@ -260,10 +261,11 @@ proto_cc_clunkfid(struct puffs_usermount struct puffs_cc *pcc = puffs_cc_getcc(pu); struct puffs9p *p9p = puffs_getspecific(pu); struct puffs_framebuf *pb; - p9ptag_t tag = NEXTTAG(p9p); + p9ptag_t tag; int rv = 0; pb = p9pbuf_makeout(); + tag = NEXTTAG(p9p); p9pbuf_put_1(pb, P9PROTO_T_CLUNK); p9pbuf_put_2(pb, tag); p9pbuf_put_4(pb, fid); @@ -294,7 +296,7 @@ proto_cc_open(struct puffs_usermount *pu struct puffs_cc *pcc = puffs_cc_getcc(pu); struct puffs9p *p9p = puffs_getspecific(pu); struct puffs_framebuf *pb; - p9ptag_t tag = NEXTTAG(p9p); + p9ptag_t tag; int rv; rv = proto_cc_dupfid(pu, fid, newfid); @@ -302,6 +304,7 @@ proto_cc_open(struct puffs_usermount *pu return rv; pb = p9pbuf_makeout(); + tag = NEXTTAG(p9p); p9pbuf_put_1(pb, P9PROTO_T_OPEN); p9pbuf_put_2(pb, tag); p9pbuf_put_4(pb, newfid);
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Tue May 26 22:08:11 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: node.c Log Message: puffs9p_node_lookup - use the right type for tfid. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/puffs/mount_9p/node.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/node.c diff -u src/usr.sbin/puffs/mount_9p/node.c:1.23 src/usr.sbin/puffs/mount_9p/node.c:1.24 --- src/usr.sbin/puffs/mount_9p/node.c:1.23 Fri Jun 7 05:34:34 2019 +++ src/usr.sbin/puffs/mount_9p/node.c Tue May 26 22:08:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: node.c,v 1.23 2019/06/07 05:34:34 ozaki-r Exp $ */ +/* $NetBSD: node.c,v 1.24 2020/05/26 22:08:11 uwe Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include #ifndef lint -__RCSID("$NetBSD: node.c,v 1.23 2019/06/07 05:34:34 ozaki-r Exp $"); +__RCSID("$NetBSD: node.c,v 1.24 2020/05/26 22:08:11 uwe Exp $"); #endif /* !lint */ #include @@ -93,7 +93,7 @@ puffs9p_node_lookup(struct puffs_usermou struct vattr va; struct puffs_node *pn, *pn_dir = opc; struct p9pnode *p9n_dir = pn_dir->pn_data; - p9ptag_t tfid = NEXTFID(p9p); + p9pfid_t tfid = NEXTFID(p9p); struct qid9p newqid; uint16_t nqid;
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Tue May 26 19:41:36 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: nineproto.c Log Message: proto_getstat - g/c debug printfs. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/puffs/mount_9p/nineproto.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/nineproto.c diff -u src/usr.sbin/puffs/mount_9p/nineproto.c:1.11 src/usr.sbin/puffs/mount_9p/nineproto.c:1.12 --- src/usr.sbin/puffs/mount_9p/nineproto.c:1.11 Fri Jun 7 05:34:34 2019 +++ src/usr.sbin/puffs/mount_9p/nineproto.c Tue May 26 19:41:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nineproto.c,v 1.11 2019/06/07 05:34:34 ozaki-r Exp $ */ +/* $NetBSD: nineproto.c,v 1.12 2020/05/26 19:41:36 uwe Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include #ifndef lint -__RCSID("$NetBSD: nineproto.c,v 1.11 2019/06/07 05:34:34 ozaki-r Exp $"); +__RCSID("$NetBSD: nineproto.c,v 1.12 2020/05/26 19:41:36 uwe Exp $"); #endif /* !lint */ #include @@ -138,8 +138,6 @@ proto_getstat(struct puffs_usermount *pu *rs = size+2; /* compensate for size field itself */ GETFIELD(p9pbuf_get_2, &v16, 2); - if (v16) - printf("%d\n", v16); GETFIELD(p9pbuf_get_4, &rdev, 4); GETFIELD(proto_getqid, &qid, 13); GETFIELD(p9pbuf_get_4, &mode, 4); @@ -150,8 +148,6 @@ proto_getstat(struct puffs_usermount *pu GETSTR(&uid, &v16); GETSTR(&gid, &v16); - if (rdev) - printf("%d\n", rdev); vap->va_rdev = rdev; vap->va_mode = mode & 0777; /* may contain other uninteresting bits */ vap->va_atime.tv_sec = atime;
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: uwe Date: Tue May 26 19:38:14 UTC 2020 Modified Files: src/usr.sbin/puffs/mount_9p: subr.c Log Message: getdfwithoffset - do not issue dummy read to seek to offset zero on a newly opened fid as it's already there. This is redundant and also seems to confuse inferno when issued against the root directory. Now you can ls the mount point of styxlisten -A 'tcp!*!styx' export / While here fix the seek logic to actually repeatedly seek forward instead of always doing it from zero. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/puffs/mount_9p/subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/subr.c diff -u src/usr.sbin/puffs/mount_9p/subr.c:1.7 src/usr.sbin/puffs/mount_9p/subr.c:1.8 --- src/usr.sbin/puffs/mount_9p/subr.c:1.7 Fri Jun 7 05:34:34 2019 +++ src/usr.sbin/puffs/mount_9p/subr.c Tue May 26 19:38:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: subr.c,v 1.7 2019/06/07 05:34:34 ozaki-r Exp $ */ +/* $NetBSD: subr.c,v 1.8 2020/05/26 19:38:14 uwe Exp $ */ /* * Copyright (c) 2007 Antti Kantee. All Rights Reserved. @@ -27,7 +27,7 @@ #include #ifndef lint -__RCSID("$NetBSD: subr.c,v 1.7 2019/06/07 05:34:34 ozaki-r Exp $"); +__RCSID("$NetBSD: subr.c,v 1.8 2020/05/26 19:38:14 uwe Exp $"); #endif /* !lint */ #include @@ -104,11 +104,7 @@ getdfwithoffset(struct puffs_usermount * { struct puffs_cc *pcc = puffs_cc_getcc(pu); struct puffs9p *p9p = puffs_getspecific(pu); - struct puffs_framebuf *pb; struct dirfid *dfp = NULL; - p9ptag_t tag = NEXTTAG(p9p); - off_t curoff, advance; - uint32_t count; int rv; LIST_FOREACH(dfp, &p9n->dir_openlist, entries) { @@ -120,52 +116,57 @@ getdfwithoffset(struct puffs_usermount * } /* didn't get off easy? damn, do manual labour */ - pb = p9pbuf_makeout(); dfp = ecalloc(1, sizeof(struct dirfid)); dfp->fid = NEXTFID(p9p); rv = proto_cc_open(pu, p9n->fid_base, dfp->fid, P9PROTO_OMODE_READ); if (rv) goto out; - for (curoff = 0;;) { - advance = wantoff - curoff; + off_t curoff = 0; + if (wantoff != 0) { + struct puffs_framebuf *pb = p9pbuf_makeout(); + for (;;) { + off_t advance = wantoff - curoff; + + p9ptag_t tag = NEXTTAG(p9p); + p9pbuf_put_1(pb, P9PROTO_T_READ); + p9pbuf_put_2(pb, tag); + p9pbuf_put_4(pb, dfp->fid); + p9pbuf_put_8(pb, curoff); + p9pbuf_put_4(pb, advance); + GETRESPONSE(pb); + + if (p9pbuf_get_type(pb) != P9PROTO_R_READ) { +rv = proto_handle_rerror(pu, pb); +puffs_framebuf_destroy(pb); +goto out; + } + + /* + * Check how many bytes we got. If we got the + * amount we wanted, we are at the correct position. + * If we got zero bytes, either the directory + * doesn't "support" the seek offset we want + * (someone has probably inserted an entry + * meantime) or we at the end of directory. + * Either way, let the upper layer deal with it. + */ + uint32_t count; + p9pbuf_get_4(pb, &count); + curoff += count; + if (count == advance || count == 0) +break; - tag = NEXTTAG(p9p); - p9pbuf_put_1(pb, P9PROTO_T_READ); - p9pbuf_put_2(pb, tag); - p9pbuf_put_4(pb, dfp->fid); - p9pbuf_put_8(pb, 0); - p9pbuf_put_4(pb, advance); - GETRESPONSE(pb); - - if (p9pbuf_get_type(pb) != P9PROTO_R_READ) { - rv = proto_handle_rerror(pu, pb); - goto out; + p9pbuf_recycleout(pb); } - - /* - * Check how many bytes we got. If we got the amount we - * wanted, we are at the correct position. If we got - * zero bytes, either the directory doesn't "support" the - * seek offset we want (someone has probably inserted an - * entry meantime) or we at the end of directory. Either - * way, let the upper layer deal with it. - */ - p9pbuf_get_4(pb, &count); - curoff += count; - if (count == advance || count == 0) - break; - - p9pbuf_recycleout(pb); + puffs_framebuf_destroy(pb); } - puffs_framebuf_destroy(pb); dfp->seekoff = curoff; *rfid = dfp; return 0; out: - puffs_framebuf_destroy(pb); free(dfp); return rv; }
CVS commit: src/usr.sbin/puffs/mount_9p
Module Name:src Committed By: christos Date: Sun Nov 4 22:38:19 UTC 2012 Modified Files: src/usr.sbin/puffs/mount_9p: ninebuf.c Log Message: add missing header To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/puffs/mount_9p/ninebuf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/puffs/mount_9p/ninebuf.c diff -u src/usr.sbin/puffs/mount_9p/ninebuf.c:1.7 src/usr.sbin/puffs/mount_9p/ninebuf.c:1.8 --- src/usr.sbin/puffs/mount_9p/ninebuf.c:1.7 Thu Sep 6 12:09:09 2007 +++ src/usr.sbin/puffs/mount_9p/ninebuf.c Sun Nov 4 17:38:19 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ninebuf.c,v 1.7 2007/09/06 16:09:09 pooka Exp $ */ +/* $NetBSD: ninebuf.c,v 1.8 2012/11/04 22:38:19 christos Exp $ */ /* * Copyright (c) 2006, 2007 Antti Kantee. All Rights Reserved. @@ -27,12 +27,13 @@ #include #ifndef lint -__RCSID("$NetBSD: ninebuf.c,v 1.7 2007/09/06 16:09:09 pooka Exp $"); +__RCSID("$NetBSD: ninebuf.c,v 1.8 2012/11/04 22:38:19 christos Exp $"); #endif /* !lint */ #include #include #include +#include #include #include