summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorWanlong Gao <gaowanlong@cn.fujitsu.com>2012-07-24 16:47:22 +0800
committerRichard W.M. Jones <rjones@redhat.com>2012-07-24 10:10:30 +0100
commitf4094b91d2cdb7635c79269f4534f18a153a4828 (patch)
tree67fa4e26954f83f8d84d726dcbafadb01a5767bb /daemon
parentbda974e64cabddde33227a678a984c37cd135f39 (diff)
downloadlibguestfs-f4094b91d2cdb7635c79269f4534f18a153a4828.tar.gz
libguestfs-f4094b91d2cdb7635c79269f4534f18a153a4828.tar.xz
libguestfs-f4094b91d2cdb7635c79269f4534f18a153a4828.zip
xfs_info: resolve device when doing xfs_info on a device
Resolve device first, like do_umount. Use Dev_or_Path. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Diffstat (limited to 'daemon')
-rw-r--r--daemon/xfs.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/daemon/xfs.c b/daemon/xfs.c
index 3efc14f7..e0f0062a 100644
--- a/daemon/xfs.c
+++ b/daemon/xfs.c
@@ -311,26 +311,21 @@ 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;
}
r = command (&out, &err, "xfs_info", buf, NULL);