| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: puffs_portal.c,v 1.10 2019/05/23 11:13:17 kre Exp $ */ | | 1 | /* $NetBSD: puffs_portal.c,v 1.11 2023/04/04 20:39:36 rillig Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2007 Antti Kantee. All Rights Reserved. | | 4 | * Copyright (c) 2007 Antti Kantee. All Rights Reserved. |
5 | * Development was supported by the Finnish Cultural Foundation. | | 5 | * Development was supported by the Finnish Cultural Foundation. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -18,27 +18,27 @@ | | | @@ -18,27 +18,27 @@ |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 19 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
26 | * SUCH DAMAGE. | | 26 | * SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | #ifndef lint | | 30 | #ifndef lint |
31 | __RCSID("$NetBSD: puffs_portal.c,v 1.10 2019/05/23 11:13:17 kre Exp $"); | | 31 | __RCSID("$NetBSD: puffs_portal.c,v 1.11 2023/04/04 20:39:36 rillig Exp $"); |
32 | #endif /* !lint */ | | 32 | #endif /* !lint */ |
33 | | | 33 | |
34 | #include <sys/types.h> | | 34 | #include <sys/types.h> |
35 | #include <sys/wait.h> | | 35 | #include <sys/wait.h> |
36 | #include <sys/socket.h> | | 36 | #include <sys/socket.h> |
37 | | | 37 | |
38 | #include <assert.h> | | 38 | #include <assert.h> |
39 | #include <err.h> | | 39 | #include <err.h> |
40 | #include <errno.h> | | 40 | #include <errno.h> |
41 | #include <mntopts.h> | | 41 | #include <mntopts.h> |
42 | #include <paths.h> | | 42 | #include <paths.h> |
43 | #include <poll.h> | | 43 | #include <poll.h> |
44 | #include <puffs.h> | | 44 | #include <puffs.h> |
| @@ -47,27 +47,27 @@ __RCSID("$NetBSD: puffs_portal.c,v 1.10 | | | @@ -47,27 +47,27 @@ __RCSID("$NetBSD: puffs_portal.c,v 1.10 |
47 | #include <string.h> | | 47 | #include <string.h> |
48 | #include <unistd.h> | | 48 | #include <unistd.h> |
49 | #include <util.h> | | 49 | #include <util.h> |
50 | | | 50 | |
51 | #include "portald.h" | | 51 | #include "portald.h" |
52 | | | 52 | |
53 | struct portal_node { | | 53 | struct portal_node { |
54 | char *path; | | 54 | char *path; |
55 | int fd; | | 55 | int fd; |
56 | }; | | 56 | }; |
57 | | | 57 | |
58 | __dead static void usage(void); | | 58 | __dead static void usage(void); |
59 | | | 59 | |
60 | PUFFSOP_PROTOS(portal); | | 60 | PUFFSOP_PROTOS(portal) |
61 | | | 61 | |
62 | #define PORTAL_ROOT NULL | | 62 | #define PORTAL_ROOT NULL |
63 | #define METADATASIZE (sizeof(int) + sizeof(size_t)) | | 63 | #define METADATASIZE (sizeof(int) + sizeof(size_t)) |
64 | | | 64 | |
65 | qelem q; | | 65 | qelem q; |
66 | int readcfg, sigchild; | | 66 | int readcfg, sigchild; |
67 | const char *cfg; | | 67 | const char *cfg; |
68 | | | 68 | |
69 | static void | | 69 | static void |
70 | usage(void) | | 70 | usage(void) |
71 | { | | 71 | { |
72 | | | 72 | |
73 | errx(1, "usage: %s [-o options] /path/portal.conf mount_point", | | 73 | errx(1, "usage: %s [-o options] /path/portal.conf mount_point", |
| @@ -386,28 +386,26 @@ provide(struct puffs_usermount *pu, stru | | | @@ -386,28 +386,26 @@ provide(struct puffs_usermount *pu, stru |
386 | | | 386 | |
387 | portn->fd = fd; | | 387 | portn->fd = fd; |
388 | return 0; | | 388 | return 0; |
389 | } | | 389 | } |
390 | | | 390 | |
391 | bad: | | 391 | bad: |
392 | puffs_framebuf_destroy(pufbuf); | | 392 | puffs_framebuf_destroy(pufbuf); |
393 | return errno; | | 393 | return errno; |
394 | } | | 394 | } |
395 | | | 395 | |
396 | int | | 396 | int |
397 | main(int argc, char *argv[]) | | 397 | main(int argc, char *argv[]) |
398 | { | | 398 | { |
399 | extern char *optarg; | | | |
400 | extern int optind; | | | |
401 | struct puffs_usermount *pu; | | 399 | struct puffs_usermount *pu; |
402 | struct puffs_ops *pops; | | 400 | struct puffs_ops *pops; |
403 | mntoptparse_t mp; | | 401 | mntoptparse_t mp; |
404 | int pflags, mntflags; | | 402 | int pflags, mntflags; |
405 | int detach; | | 403 | int detach; |
406 | int ch; | | 404 | int ch; |
407 | | | 405 | |
408 | setprogname(argv[0]); | | 406 | setprogname(argv[0]); |
409 | | | 407 | |
410 | mntflags = pflags = 0; | | 408 | mntflags = pflags = 0; |
411 | detach = 1; | | 409 | detach = 1; |
412 | while ((ch = getopt(argc, argv, "o:s")) != -1) { | | 410 | while ((ch = getopt(argc, argv, "o:s")) != -1) { |
413 | switch (ch) { | | 411 | switch (ch) { |