On Wed, Aug 29, 2012 at 03:32:48PM +0800, Wanlong Gao wrote:
On 08/28/2012 09:06 PM, Richard W.M. Jones wrote:
+ if (!(optargs_bitmask & GUESTFS_XFS_REPAIR_IMGFILE_BITMASK)) + imgfile = 0; This xfs_repair -f option is annoying! Also the way you've defined the "device" parameter (as type Device) means it won't work -- the caller would never be able to use a non-device as a parameter.
Instead, can we check for the input being file or device and add the option automatically? It should be sufficient to change the code to something like:
... Dev_or_path "device" ...
if (STRPREFIX (device, "/dev/")) is_device = 1;
if (!is_device) { /* do the sysroot adjustment, and add -f parameter */ } else { /* just add device parameter */ }
Sorry, I can't understand here, since the original xfs_repair command just receive "device" as its parameter, I wonder why do you suggest to use "Dev_or_path" here.
Not sure I understand the question, but it looks like 'xfs_repair -f' is used to repair a filesystem stored inside a file, not a device. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw