This requires changing the generator so it can handle passing optional
arguments all thr way through to the daemon, changing the protocol
(see previous patch set), and implementing the new mkfs-opts call.
At the moment there is just an optional blocksize argument, thus
mimicking what you can already do with 'mkfs-b'. But this change will
allow us in future to encode much of the rest of the /sbin/mkfs
command line.
Here is how it works from guestfish (with verbose & trace):
<fs> mkfs-opts ext2 /dev/vda1 blocksize:1024
mkfs_opts
"ext2" "/dev/vda1" "blocksize:1024"send_to_daemon: 0x2393bc0
g->state = 3, n = 72
proc 210 (part_disk) took 0.18 seconds
recv_from_daemon: 0x2393bc0 g->state = 3, size_rtn = 0x7fffd24c565c, buf_rtn =
0x7fffd24c5650
mkfs -t ext2 -b 1024 /dev/vda1
mke2fs 1.41.12 (17-May-2010)
= 0
<fs> mkfs-opts ext2 /dev/vda1
mkfs_opts "ext2"
"/dev/vda1"send_to_daemon: 0x2393bc0 g->state = 3, n = 72
proc 278 (mkfs_opts) took 0.19 seconds
recv_from_daemon: 0x2393bc0 g->state = 3, size_rtn = 0x7fffd24c565c, buf_rtn =
0x7fffd24c5650
mkfs -t ext2 /dev/vda1
mke2fs 1.41.12 (17-May-2010)
= 0
<fs> mkfs-opts ext2 /dev/vda1 blocksize:4096
mkfs_opts
"ext2" "/dev/vda1" "blocksize:4096"send_to_daemon: 0x2393bc0
g->state = 3, n = 72
proc 278 (mkfs_opts) took 0.30 seconds
recv_from_daemon: 0x2393bc0 g->state = 3, size_rtn = 0x7fffd24c565c, buf_rtn =
0x7fffd24c5650
mkfs -t ext2 -b 4096 /dev/vda1
mke2fs 1.41.12 (17-May-2010)
= 0
<fs> mkfs-opts ext2 /dev/vda1 blocksize:4096 blocksize:1024
mkfs-opts should have 2-3 parameter(s)
type 'help mkfs-opts' for help on mkfs-opts
<fs> mkfs-opts vfat /dev/vda1 blocksize:32768
mkfs_opts
"vfat" "/dev/vda1" "blocksize:32768"send_to_daemon:
0x2393bc0 g->state = 3, n = 72
proc 278 (mkfs_opts) took 0.30 seconds
recv_from_daemon: 0x2393bc0 g->state = 3, size_rtn = 0x7fffd24c565c, buf_rtn =
0x7fffd24c5650
blockdev --getss /dev/vda1
mkfs -t vfat -s 64 /dev/vda1
= 0
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://et.redhat.com/~rjones/libguestfs/
See what it can do:
http://et.redhat.com/~rjones/libguestfs/recipes.html