Resolve device first, like do_umount. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> --- daemon/xfs.c | 24 +++++++++++------------- generator/generator_actions.ml | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/daemon/xfs.c b/daemon/xfs.c index 3efc14f..d0cfacc 100644 --- a/daemon/xfs.c +++ b/daemon/xfs.c @@ -311,28 +311,26 @@ error: } guestfs_int_xfsinfo * -do_xfs_info (const char *path) +do_xfs_info (const char *pathordevice) { int r; char *buf; char *out = NULL, *err = NULL; char **lines = NULL; guestfs_int_xfsinfo *ret = NULL; + int is_dev; - if (do_is_dir (path)) { - buf = sysroot_path (path); - if (!buf) { - reply_with_perror ("malloc"); - return NULL; - } - } else { - buf = strdup(path); - if (!buf) { - reply_with_perror ("strdup"); - return NULL; - } + is_dev = STREQLEN (pathordevice, "/dev/", 5); + buf = is_dev ? strdup (pathordevice) + : sysroot_path (pathordevice); + if (buf == NULL) { + reply_with_perror ("malloc"); + return NULL; } + if (is_dev) + RESOLVE_DEVICE (buf, , { free (buf); return NULL; }); + r = command (&out, &err, "xfs_info", buf, NULL); free (buf); if (r == -1) { diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index 1a89b0e..4c1e80b 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -8931,7 +8931,7 @@ call C<guestfs_max_disks>." }; { defaults with name = "xfs_info"; - style = RStruct ("info", "xfsinfo"), [Pathname "path"], []; + style = RStruct ("info", "xfsinfo"), [String "pathordevice"], []; proc_nr = Some 337; optional = Some "xfs"; tests = [ -- 1.7.11.3.287.ge771946