[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 1/5] labels: move btrfslabel to btrfs.c



Signed-off-by: Chen Hanxiao <chenhanxiao cn fujitsu com>
---
 daemon/btrfs.c  | 16 ++++++++++++++++
 daemon/daemon.h |  1 +
 daemon/labels.c | 19 +------------------
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 8fcfd81..ee3464d 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -70,6 +70,22 @@ btrfs_get_label (const char *device)
   return out;
 }
 
+int
+btrfs_set_label (const char *device, const char *label)
+{
+  int r;
+  CLEANUP_FREE char *err = NULL;
+
+  r = command (NULL, &err, str_btrfs, "filesystem", "label",
+               device, label, NULL);
+  if (r == -1) {
+    reply_with_error ("%s", err);
+    return -1;
+  }
+
+  return 0;
+}
+
 /* Takes optional arguments, consult optargs_bitmask. */
 int
 do_btrfs_filesystem_resize (const char *filesystem, int64_t size)
diff --git a/daemon/daemon.h b/daemon/daemon.h
index a4a4361..783d739 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -275,6 +275,7 @@ extern char *debug_bmap_device (const char *subcmd, size_t argc, char *const *co
 
 /*-- in btrfs.c --*/
 extern char *btrfs_get_label (const char *device);
+extern int btrfs_set_label (const char *device, const char *label);
 extern int btrfs_set_uuid (const char *device, const char *uuid);
 extern int btrfs_set_uuid_random (const char *device);
 
diff --git a/daemon/labels.c b/daemon/labels.c
index cfcb4df..eec5b96 100644
--- a/daemon/labels.c
+++ b/daemon/labels.c
@@ -27,29 +27,12 @@
 #include "actions.h"
 #include "optgroups.h"
 
-GUESTFSD_EXT_CMD(str_btrfs, btrfs);
 GUESTFSD_EXT_CMD(str_dosfslabel, dosfslabel);
 GUESTFSD_EXT_CMD(str_e2label, e2label);
 GUESTFSD_EXT_CMD(str_ntfslabel, ntfslabel);
 GUESTFSD_EXT_CMD(str_xfs_admin, xfs_admin);
 
 static int
-btrfslabel (const char *device, const char *label)
-{
-  int r;
-  CLEANUP_FREE char *err = NULL;
-
-  r = command (NULL, &err, str_btrfs, "filesystem", "label",
-               device, label, NULL);
-  if (r == -1) {
-    reply_with_error ("%s", err);
-    return -1;
-  }
-
-  return 0;
-}
-
-static int
 dosfslabel (const char *device, const char *label)
 {
   int r;
@@ -144,7 +127,7 @@ do_set_label (const mountable_t *mountable, const char *label)
     return -1;
 
   if (STREQ (vfs_type, "btrfs"))
-    r = btrfslabel (mountable->device, label);
+    r = btrfs_set_label (mountable->device, label);
 
   else if (STREQ (vfs_type, "msdos") ||
            STREQ (vfs_type, "fat") ||
-- 
2.1.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]