View | Details | Raw Unified | Return to bug 151976
Collapse All | Expand All

(-)sbin/mount_nullfs/mount_nullfs.8 (+9 lines)
Lines 73-78 Link Here
73
.Pp
73
.Pp
74
The options are as follows:
74
The options are as follows:
75
.Bl -tag -width indent
75
.Bl -tag -width indent
76
.It Fl i
77
Expose sockets and fifos across the nullfs mounted filesystem.
76
.It Fl o
78
.It Fl o
77
Options are specified with a
79
Options are specified with a
78
.Fl o
80
.Fl o
Lines 80-85 Link Here
80
See the
82
See the
81
.Xr mount 8
83
.Xr mount 8
82
man page for possible options and their meanings.
84
man page for possible options and their meanings.
85
The following nullfs specific options are available:
86
.Pp
87
.Bl -tag -width "ipc" -compact
88
.It Cm ipc
89
Same as
90
.Fl i .
91
.El
83
.El
92
.El
84
.Pp
93
.Pp
85
The null layer has two purposes.
94
The null layer has two purposes.
(-)sbin/mount_nullfs/mount_nullfs.c (-18 / +23 lines)
Lines 48-53 Link Here
48
#include <sys/mount.h>
48
#include <sys/mount.h>
49
#include <sys/uio.h>
49
#include <sys/uio.h>
50
50
51
#include <fs/nullfs/null.h>
52
51
#include <err.h>
53
#include <err.h>
52
#include <stdio.h>
54
#include <stdio.h>
53
#include <stdlib.h>
55
#include <stdlib.h>
Lines 68-83 Link Here
68
int
70
int
69
main(int argc, char *argv[])
71
main(int argc, char *argv[])
70
{
72
{
71
	struct iovec iov[6];
73
	struct iovec *iov;
72
	int ch, mntflags;
73
	char source[MAXPATHLEN];
74
	char source[MAXPATHLEN];
74
	char target[MAXPATHLEN];
75
	char target[MAXPATHLEN];
76
	char fstype[] = "nullfs";
77
	int ch, iovlen, mntflags, nullfs_flags;
75
78
76
	mntflags = 0;
79
	iov = NULL;
77
	while ((ch = getopt(argc, argv, "o:")) != -1)
80
	getmnt_silent = 1;
81
	iovlen = mntflags = nullfs_flags = 0;
82
	while ((ch = getopt(argc, argv, "io:")) != -1)
78
		switch(ch) {
83
		switch(ch) {
84
		case 'i':
85
			nullfs_flags |= NULLFSMNT_IPC;
86
			break;
79
		case 'o':
87
		case 'o':
80
			getmntopts(optarg, mopts, &mntflags, 0);
88
			getmntopts(optarg, mopts, &mntflags, 0);
89
			if (strncmp(optarg, "ipc", 3) == 0)
90
				nullfs_flags |= NULLFSMNT_IPC;
91
81
			break;
92
			break;
82
		case '?':
93
		case '?':
83
		default:
94
		default:
Lines 97-116 Link Here
97
		errx(EX_USAGE, "%s (%s) and %s are not distinct paths",
108
		errx(EX_USAGE, "%s (%s) and %s are not distinct paths",
98
		    argv[0], target, argv[1]);
109
		    argv[0], target, argv[1]);
99
110
100
	iov[0].iov_base = strdup("fstype");
111
	build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1);
101
	iov[0].iov_len = sizeof("fstype");
112
	build_iovec(&iov, &iovlen, "fspath", source, (size_t)-1);
102
	iov[1].iov_base = strdup("nullfs");
113
	build_iovec(&iov, &iovlen, "target", target, (size_t)-1);
103
	iov[1].iov_len = strlen(iov[1].iov_base) + 1;
114
104
	iov[2].iov_base = strdup("fspath");
115
	if (nullfs_flags & NULLFSMNT_IPC)
105
	iov[2].iov_len = sizeof("fspath");
116
		build_iovec(&iov, &iovlen, "ipc", NULL, 0);
106
	iov[3].iov_base = source;
107
	iov[3].iov_len = strlen(source) + 1;
108
	iov[4].iov_base = strdup("target");
109
	iov[4].iov_len = sizeof("target");
110
	iov[5].iov_base = target;
111
	iov[5].iov_len = strlen(target) + 1;
112
117
113
	if (nmount(iov, 6, mntflags))
118
	if (nmount(iov, iovlen, mntflags))
114
		err(1, NULL);
119
		err(1, NULL);
115
	exit(0);
120
	exit(0);
116
}
121
}
Lines 134-139 Link Here
134
usage(void)
139
usage(void)
135
{
140
{
136
	(void)fprintf(stderr,
141
	(void)fprintf(stderr,
137
		"usage: mount_nullfs [-o options] target mount-point\n");
142
		"usage: mount_nullfs [-o options] [-i] target mount-point\n");
138
	exit(1);
143
	exit(1);
139
}
144
}
(-)sys/fs/nullfs/null.h (+2 lines)
Lines 39-44 Link Here
39
	struct vnode	*nullm_rootvp;	/* Reference to root null_node */
39
	struct vnode	*nullm_rootvp;	/* Reference to root null_node */
40
};
40
};
41
41
42
#define	NULLFSMNT_IPC	0x00000001
43
42
#ifdef _KERNEL
44
#ifdef _KERNEL
43
/*
45
/*
44
 * A cache of vnode references
46
 * A cache of vnode references
(-)sys/fs/nullfs/null_subr.c (+5 lines)
Lines 230-235 Link Here
230
	xp->null_vnode = vp;
230
	xp->null_vnode = vp;
231
	xp->null_lowervp = lowervp;
231
	xp->null_lowervp = lowervp;
232
	vp->v_type = lowervp->v_type;
232
	vp->v_type = lowervp->v_type;
233
234
	if (vp->v_type == VSOCK || vp->v_type == VFIFO)
235
		if (vfs_getopt(mp->mnt_optnew, "ipc", NULL, NULL) == 0)
236
	 		vp->v_un = lowervp->v_un;
237
233
	vp->v_data = xp;
238
	vp->v_data = xp;
234
	vp->v_vnlock = lowervp->v_vnlock;
239
	vp->v_vnlock = lowervp->v_vnlock;
235
	if (vp->v_vnlock == NULL)
240
	if (vp->v_vnlock == NULL)

Return to bug 151976