daemon: Generalize the implementation of vfs-type.
[libguestfs.git] / daemon / blkid.c
index 4e14881..1ddc8cd 100644 (file)
 #include "daemon.h"
 #include "actions.h"
 
-char *
-do_vfs_type (const char *device)
+static char *
+get_blkid_tag (const char *device, const char *tag)
 {
   char *out, *err;
   int r;
 
   r = command (&out, &err,
-               "/sbin/blkid", "-o", "value", "-s", "TYPE", device, NULL);
+               "blkid", "-o", "value", "-s", tag, device, NULL);
   if (r == -1) {
-    reply_with_error ("vfs_type: %s: %s", device, err);
+    reply_with_error ("%s: %s", device, err);
     free (out);
     free (err);
     return NULL;
@@ -51,3 +51,9 @@ do_vfs_type (const char *device)
 
   return out;                   /* caller frees */
 }
+
+char *
+do_vfs_type (const char *device)
+{
+  return get_blkid_tag (device, "TYPE");
+}