From: Nikita A Menkovich Date: Wed, 26 Jan 2011 15:34:01 +0000 (+0000) Subject: mkfs-opts: Add optional "features" parameter. X-Git-Tag: 1.9.7~12 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=92b74729e2608a0266fff3a36d87cebefe66d833;p=libguestfs.git mkfs-opts: Add optional "features" parameter. This allows the -O parameter to be added to the mkfs command line. This is used to select filesystem features. --- diff --git a/daemon/mkfs.c b/daemon/mkfs.c index cc0ead1..07eefb2 100644 --- a/daemon/mkfs.c +++ b/daemon/mkfs.c @@ -33,7 +33,7 @@ /* Takes optional arguments, consult optargs_bitmask. */ int -do_mkfs_opts (const char *fstype, const char *device, int blocksize) +do_mkfs_opts (const char *fstype, const char *device, int blocksize, const char *features) { const char *argv[MAX_ARGS]; size_t i = 0; @@ -115,6 +115,11 @@ do_mkfs_opts (const char *fstype, const char *device, int blocksize) } } + if (optargs_bitmask & GUESTFS_MKFS_OPTS_FEATURES_BITMASK) { + argv[i++] = "-O"; + argv[i++] = features; + } + argv[i++] = device; argv[i++] = NULL; @@ -136,12 +141,12 @@ int do_mkfs (const char *fstype, const char *device) { optargs_bitmask = 0; - return do_mkfs_opts (fstype, device, 0); + return do_mkfs_opts (fstype, device, 0, 0); } int do_mkfs_b (const char *fstype, int blocksize, const char *device) { optargs_bitmask = GUESTFS_MKFS_OPTS_BLOCKSIZE_BITMASK; - return do_mkfs_opts (fstype, device, blocksize); + return do_mkfs_opts (fstype, device, blocksize, 0); } diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index 94ad559..77f1358 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -5683,10 +5683,10 @@ not refer to a logical volume. See also C."); - ("mkfs_opts", (RErr, [String "fstype"; Device "device"], [Int "blocksize"]), 278, [], + ("mkfs_opts", (RErr, [String "fstype"; Device "device"], [Int "blocksize"; String "features"]), 278, [], [InitEmpty, Always, TestOutput ( [["part_disk"; "/dev/sda"; "mbr"]; - ["mkfs_opts"; "ext2"; "/dev/sda1"; "4096"]; + ["mkfs_opts"; "ext2"; "/dev/sda1"; "4096"; ""]; ["mount_options"; ""; "/dev/sda1"; "/"]; ["write"; "/new"; "new file contents"]; ["cat"; "/new"]], "new file contents")], @@ -5710,6 +5710,17 @@ the requested cluster size. For UFS block sizes, please see L. +=item C + +This passes the C<-O> parameter to the external mkfs program. + +For certain filesystem types, this allows extra filesystem +features to be selected. See L and L +for more details. + +You cannot use this optional parameter with the C or +C filesystem type. + =back"); ("getxattr", (RBufferOut "xattr", [Pathname "path"; String "name"], []), 279, [Optional "linuxxattrs"],