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

(-)mdmfs.8 (+6 lines)
Lines 46-51 driver Link Here
46
.Op Fl F Ar file
46
.Op Fl F Ar file
47
.Op Fl f Ar frag-size
47
.Op Fl f Ar frag-size
48
.Op Fl i Ar bytes
48
.Op Fl i Ar bytes
49
.Op Fl k Ar skel
49
.Op Fl m Ar percent-free
50
.Op Fl m Ar percent-free
50
.Op Fl n Ar rotational-positions
51
.Op Fl n Ar rotational-positions
51
.Op Fl O Ar optimization
52
.Op Fl O Ar optimization
Lines 170-175 memory disk backed by Link Here
170
The fragment size of the file system in bytes.
171
The fragment size of the file system in bytes.
171
.It Fl i Ar bytes
172
.It Fl i Ar bytes
172
Number of bytes per inode.
173
Number of bytes per inode.
174
.It Fl k Ar skel
175
Copy the content of directory
176
.Ar skel
177
into
178
.Ar mount-point .
173
.It Fl l
179
.It Fl l
174
Enable multilabel MAC on the new file system.
180
Enable multilabel MAC on the new file system.
175
.It Fl L
181
.It Fl L
(-)mdmfs.c (-5 / +29 lines)
Lines 78-83 static void do_mdconfig_detach(void); Link Here
78
static void	 do_mount(const char *, const char *);
78
static void	 do_mount(const char *, const char *);
79
static void	 do_mtptsetup(const char *, struct mtpt_info *);
79
static void	 do_mtptsetup(const char *, struct mtpt_info *);
80
static void	 do_newfs(const char *);
80
static void	 do_newfs(const char *);
81
static void	 do_copy(const char *, const char *);
81
static void	 extract_ugid(const char *, struct mtpt_info *);
82
static void	 extract_ugid(const char *, struct mtpt_info *);
82
static int	 run(int *, const char *, ...) __printflike(2, 3);
83
static int	 run(int *, const char *, ...) __printflike(2, 3);
83
static void	 usage(void);
84
static void	 usage(void);
Lines 91-97 main(int argc, char **argv) Link Here
91
	enum md_types mdtype;		/* The type of our memory disk. */
92
	enum md_types mdtype;		/* The type of our memory disk. */
92
	bool have_mdtype;
93
	bool have_mdtype;
93
	bool detach, softdep, autounit, newfs;
94
	bool detach, softdep, autounit, newfs;
94
	char *mtpoint, *unitstr;
95
	char *mtpoint, *unitstr, *skel;
95
	char *p;
96
	char *p;
96
	int ch;
97
	int ch;
97
	void *set;
98
	void *set;
Lines 104-109 main(int argc, char **argv) Link Here
104
	autounit = false;
105
	autounit = false;
105
	newfs = true;
106
	newfs = true;
106
	have_mdtype = false;
107
	have_mdtype = false;
108
	skel = NULL;
107
	mdtype = MD_SWAP;
109
	mdtype = MD_SWAP;
108
	mdname = MD_NAME;
110
	mdname = MD_NAME;
109
	mdnamelen = strlen(mdname);
111
	mdnamelen = strlen(mdname);
Lines 123-129 main(int argc, char **argv) Link Here
123
		compat = true;
125
		compat = true;
124
126
125
	while ((ch = getopt(argc, argv,
127
	while ((ch = getopt(argc, argv,
126
	    "a:b:Cc:Dd:E:e:F:f:hi:LlMm:Nn:O:o:Pp:Ss:t:Uv:w:X")) != -1)
128
	    "a:b:Cc:Dd:E:e:F:f:hi:k:LlMm:Nn:O:o:Pp:Ss:t:Uv:w:X")) != -1)
127
		switch (ch) {
129
		switch (ch) {
128
		case 'a':
130
		case 'a':
129
			argappend(&newfs_arg, "-a %s", optarg);
131
			argappend(&newfs_arg, "-a %s", optarg);
Lines 169-174 main(int argc, char **argv) Link Here
169
		case 'i':
171
		case 'i':
170
			argappend(&newfs_arg, "-i %s", optarg);
172
			argappend(&newfs_arg, "-i %s", optarg);
171
			break;
173
			break;
174
		case 'k':
175
			skel = optarg;
176
			break;
172
		case 'L':
177
		case 'L':
173
			if (compat)
178
			if (compat)
174
				usage();
179
				usage();
Lines 287-292 main(int argc, char **argv) Link Here
287
		do_newfs(newfs_arg);
292
		do_newfs(newfs_arg);
288
	do_mount(mount_arg, mtpoint);
293
	do_mount(mount_arg, mtpoint);
289
	do_mtptsetup(mtpoint, &mi);
294
	do_mtptsetup(mtpoint, &mi);
295
	if (skel)
296
		do_copy(mtpoint, skel);
290
297
291
	return (0);
298
	return (0);
292
}
299
}
Lines 501-506 do_newfs(const char *args) Link Here
501
		errx(1, "newfs exited with error code %d", rv);
508
		errx(1, "newfs exited with error code %d", rv);
502
}
509
}
503
510
511
512
/*
513
 * Copy skel into the mountpoint.
514
 */
515
static void
516
do_copy(const char *mtpoint, const char *skel)
517
{
518
	int rv;
519
520
	rv = chdir(skel);
521
	if (rv)
522
		err(1, "chdir to %s", skel);
523
	rv = run(NULL, "/bin/pax -rw -pe . %s", mtpoint);
524
	if (rv)
525
		errx(1, "skel copy failed");
526
}
527
504
/*
528
/*
505
 * 'str' should be a user and group name similar to the last argument
529
 * 'str' should be a user and group name similar to the last argument
506
 * to chown(1); i.e., a user, followed by a colon, followed by a
530
 * to chown(1); i.e., a user, followed by a colon, followed by a
Lines 681-689 usage(void) Link Here
681
		fprintf(stderr,
705
		fprintf(stderr,
682
"usage: %s [-DLlMNPSUX] [-a maxcontig] [-b block-size] [-c cylinders]\n"
706
"usage: %s [-DLlMNPSUX] [-a maxcontig] [-b block-size] [-c cylinders]\n"
683
"\t[-d rotdelay] [-E path-mdconfig] [-e maxbpg] [-F file] [-f frag-size]\n"
707
"\t[-d rotdelay] [-E path-mdconfig] [-e maxbpg] [-F file] [-f frag-size]\n"
684
"\t[-i bytes] [-m percent-free] [-n rotational-positions] [-O optimization]\n"
708
"\t[-i bytes] [-k skel] [-m percent-free] [-n rotational-positions]\n"
685
"\t[-o mount-options] [-p permissions] [-s size] [-v version]\n"
709
"\t[-O optimization] [-o mount-options] [-p permissions] [-s size]\n"
686
"\t[-w user:group] md-device mount-point\n", name);
710
"\t[-v version] [-w user:group] md-device mount-point\n", name);
687
	fprintf(stderr,
711
	fprintf(stderr,
688
"usage: %s -C [-lNU] [-a maxcontig] [-b block-size] [-c cylinders]\n"
712
"usage: %s -C [-lNU] [-a maxcontig] [-b block-size] [-c cylinders]\n"
689
"\t[-d rotdelay] [-E path-mdconfig] [-e maxbpg] [-F file] [-f frag-size]\n"
713
"\t[-d rotdelay] [-E path-mdconfig] [-e maxbpg] [-F file] [-f frag-size]\n"

Return to bug 146254