[Libguestfs] [PATCH 2/5] uuid: use existed function of ext2

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Wed Jun 24 07:54:04 UTC 2015


Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
 daemon/daemon.h |  1 +
 daemon/uuids.c  | 12 +-----------
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/daemon/daemon.h b/daemon/daemon.h
index ee0c96f..eeb4ff7 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -219,6 +219,7 @@ extern int sync_disks (void);
 /* Confirmed this is true up to ext4 from the Linux sources. */
 #define EXT2_LABEL_MAX 16
 extern int fstype_is_extfs (const char *fstype);
+extern int do_set_e2uuid (const char *device, const char *uuid);
 
 /*-- in blkid.c --*/
 extern char *get_blkid_tag (const char *device, const char *tag);
diff --git a/daemon/uuids.c b/daemon/uuids.c
index f7791ab..8626884 100644
--- a/daemon/uuids.c
+++ b/daemon/uuids.c
@@ -27,16 +27,12 @@
 #include "actions.h"
 #include "optgroups.h"
 
-GUESTFSD_EXT_CMD(str_tune2fs, tune2fs);
 GUESTFSD_EXT_CMD(str_xfs_admin, xfs_admin);
 GUESTFSD_EXT_CMD(str_swaplabel, swaplabel);
 
 static int
 e2uuid (const char *device, const char *uuid)
 {
-  int r;
-  CLEANUP_FREE char *err = NULL;
-
   /* Don't allow the magic values here.  If callers want to do this
    * we'll add alternate set_uuid_* calls.
    */
@@ -46,13 +42,7 @@ e2uuid (const char *device, const char *uuid)
     return -1;
   }
 
-  r = command (NULL, &err, str_tune2fs, "-U", uuid, device, NULL);
-  if (r == -1) {
-    reply_with_error ("%s", err);
-    return -1;
-  }
-
-  return 0;
+  return do_set_e2uuid (device, uuid);
 }
 
 static int
-- 
2.1.0




More information about the Libguestfs mailing list