Index: head/sbin/mdmfs/mdmfs.8 =================================================================== --- head/sbin/mdmfs/mdmfs.8 +++ head/sbin/mdmfs/mdmfs.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 4, 2011 +.Dd December 12, 2015 .Dt MDMFS 8 .Os .Sh NAME @@ -36,7 +36,7 @@ driver .Sh SYNOPSIS .Nm -.Op Fl DLlMNPStUX +.Op Fl DLlMNPStTUX .Op Fl a Ar maxcontig .Op Fl b Ar block-size .Op Fl c Ar blocks-per-cylinder-group @@ -52,6 +52,7 @@ .Op Fl o Ar mount-options .Op Fl p Ar permissions .Op Fl s Ar size +.Op Fl T Ar fstype .Op Fl v Ar version .Op Fl w Ar user : Ns Ar group .Ar md-device @@ -227,10 +228,24 @@ .It Fl t Turn on the TRIM enable flag for .Xr newfs 8 . +When used with a filesystem that issue BIO_DELETE bio requests, +.Xr md 4 +returns deleted blocks to the system memory pool. +.It Fl T Ar fstype +Specify a file system type for a vnode-backed memory disk. The -.Xr md 4 -device supports the BIO_DELETE command, enabling the TRIM on created -filesystem allows return of freed memory to the system pool. +.Cm cd9660 , +.Cm ext2fs , +.Cm msdosfs , +and +.Cm udf +file systems are supported. +.Fl T +only applies when +.Fl F +and +.Fl P +are used. .It Fl U Enable soft-updates on the file system. This is the default, and is accepted only @@ -293,7 +308,13 @@ .Fl o option is passed to .Xr mount 8 -with the same letter. +with the same letter; +the +.Fl T +option is passed to +.Xr mount 8 +as +.Fl t . See the programs that the options are passed to for more information on their semantics. .Sh EXAMPLES @@ -334,6 +355,10 @@ using automatic device numbering: .Pp .Dl "mdmfs -P -F foo.img mds1a /tmp/" +.Pp +Mount a vnode-backed cd9660 file system using automatic device numbering: +.Pp +.Dl "mdmfs -T cd9660 -P -F foo.iso md /tmp" .Sh COMPATIBILITY The .Nm Index: head/sbin/mdmfs/mdmfs.c =================================================================== --- head/sbin/mdmfs/mdmfs.c +++ head/sbin/mdmfs/mdmfs.c @@ -80,6 +80,7 @@ static void do_mdconfig_detach(void); static void do_mount(const char *, const char *); static void do_mtptsetup(const char *, struct mtpt_info *); +static int valid_fstype(const char *fstype); static void do_newfs(const char *); static void extract_ugid(const char *, struct mtpt_info *); static int run(int *, const char *, ...) __printflike(2, 3); @@ -129,7 +130,7 @@ } while ((ch = getopt(argc, argv, - "a:b:Cc:Dd:E:e:F:f:hi:LlMm:NnO:o:Pp:Ss:tUv:w:X")) != -1) + "a:b:Cc:Dd:E:e:F:f:hi:LlMm:NnO:o:Pp:Ss:tT:Uv:w:X")) != -1) switch (ch) { case 'a': argappend(&newfs_arg, "-a %s", optarg); @@ -218,6 +219,11 @@ case 't': argappend(&newfs_arg, "-t"); break; + case 'T': + if (!valid_fstype(optarg)) + usage(); + argappend(&mount_arg, "-t %s", optarg); + break; case 'U': softdep = true; break; @@ -500,6 +506,23 @@ } } +static int +valid_fstype(const char *fstype) +{ + unsigned int i; + static const char *fs[] = { + "cd9660", "ext2fs", "msdosfs", "udf", + NULL + }; + + for (i = 0; fs[i] != NULL; ++i) { + if (strcmp(fstype, fs[i]) == 0) + return (1); + } + + return (0); +} + /* * Put a file system on the memory disk. */