[Libguestfs] Patch that implements support to create UFS1 partitions with mkfs-opts
Richard W.M. Jones
rjones at redhat.com
Wed Jan 26 15:37:42 UTC 2011
On Wed, Jan 26, 2011 at 06:06:54PM +0300, Nikita A Menkovich wrote:
> + if (optargs_bitmask & GUESTFS_MKFS_OPTS_FEATURES_BITMASK) {
> + if (STREQ (fstype, "ufs")) {
> + argv[i++] = "-O";
> + argv[i++] = features;
> + }
> + }
Is there a reason to restrict this to ufs? ext2/3/4 also has features
which can be configured through the -O option. I removed the inner
'if' statement.
> +For UFS the C<blocksize> parameter by default is C<16384>, minimal is C<4096>.
This is interesting information, but by declaring it here it ties us
our ABI to some particular feature of Debian 'ufsutils'. I have made
this into a separate patch and changed the wording a bit so that we
aren't promising anything.
Please see the attached 2 x patches. If these are suitable for you, I
will commit them.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
-------------- next part --------------
>From dd653336cc34c2e8640aa7e19174a3e339049dc2 Mon Sep 17 00:00:00 2001
From: Nikita A Menkovich <menkovich at gmail.com>
Date: Wed, 26 Jan 2011 15:32:18 +0000
Subject: [PATCH 1/2] mkfs-opts: Add a note about blocksize param and UFS filesystems.
---
generator/generator_actions.ml | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml
index 7cb8c1e..94ad559 100644
--- a/generator/generator_actions.ml
+++ b/generator/generator_actions.ml
@@ -5708,6 +5708,8 @@ for Linux ext2/3 filesystems.
For VFAT and NTFS the C<blocksize> parameter is treated as
the requested cluster size.
+For UFS block sizes, please see L<mkfs.ufs(8)>.
+
=back");
("getxattr", (RBufferOut "xattr", [Pathname "path"; String "name"], []), 279, [Optional "linuxxattrs"],
--
1.7.3.5
-------------- next part --------------
>From 92b74729e2608a0266fff3a36d87cebefe66d833 Mon Sep 17 00:00:00 2001
From: Nikita A Menkovich <menkovich at gmail.com>
Date: Wed, 26 Jan 2011 15:34:01 +0000
Subject: [PATCH 2/2] 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.
---
daemon/mkfs.c | 11 ++++++++---
generator/generator_actions.ml | 15 +++++++++++++--
2 files changed, 21 insertions(+), 5 deletions(-)
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<guestfs_is_lv>.");
- ("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<mkfs.ufs(8)>.
+=item C<features>
+
+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<mke2fs(8)> and L<mkfs.ufs(8)>
+for more details.
+
+You cannot use this optional parameter with the C<gfs> or
+C<gfs2> filesystem type.
+
=back");
("getxattr", (RBufferOut "xattr", [Pathname "path"; String "name"], []), 279, [Optional "linuxxattrs"],
--
1.7.3.5
More information about the Libguestfs
mailing list