[Pkg-libvirt-commits] [libguestfs] 12/29: uuid: use newly introduced swap_set_uuid

Hilko Bengen bengen at moszumanska.debian.org
Sun Nov 1 17:15:03 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag upstream/1.29.49
in repository libguestfs.

commit 4e8ef1ae37d1517a08409b80af337b511770f38f
Author: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
Date:   Wed Jul 1 17:21:13 2015 +0800

    uuid: use newly introduced swap_set_uuid
    
    Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
 daemon/daemon.h |  3 +++
 daemon/swap.c   | 16 ++++++++++++++++
 daemon/uuids.c  | 18 +-----------------
 3 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/daemon/daemon.h b/daemon/daemon.h
index f9e8d45..f8441d1 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -278,6 +278,9 @@ extern int btrfs_set_uuid (const char *device, const char *uuid);
 /*-- in ntfs.c --*/
 extern char *ntfs_get_label (const char *device);
 
+/*-- in swap.c --*/
+extern int swap_set_uuid (const char *device, const char *uuid);
+
 /* ordinary daemon functions use these to indicate errors
  * NB: you don't need to prefix the string with the current command,
  * it is added automatically by the client-side RPC stubs.
diff --git a/daemon/swap.c b/daemon/swap.c
index 83f4d7c..26fe30d 100644
--- a/daemon/swap.c
+++ b/daemon/swap.c
@@ -33,6 +33,7 @@
 GUESTFSD_EXT_CMD(str_mkswap, mkswap);
 GUESTFSD_EXT_CMD(str_swapon, swapon);
 GUESTFSD_EXT_CMD(str_swapoff, swapoff);
+GUESTFSD_EXT_CMD(str_swaplabel, swaplabel);
 
 /* Confirmed this is true for Linux swap partitions from the Linux sources. */
 #define SWAP_LABEL_MAX 16
@@ -239,3 +240,18 @@ do_swapoff_uuid (const char *uuid)
 {
   return swaponoff (str_swapoff, "-U", uuid);
 }
+
+int
+swap_set_uuid (const char *device, const char *uuid)
+{
+  int r;
+  CLEANUP_FREE char *err = NULL;
+
+  r = command (NULL, &err, str_swaplabel, "-U", uuid, device, NULL);
+  if (r == -1) {
+    reply_with_error ("%s", err);
+    return -1;
+  }
+
+  return 0;
+}
diff --git a/daemon/uuids.c b/daemon/uuids.c
index dce0d60..5238f3e 100644
--- a/daemon/uuids.c
+++ b/daemon/uuids.c
@@ -27,7 +27,6 @@
 #include "actions.h"
 #include "optgroups.h"
 
-GUESTFSD_EXT_CMD(str_swaplabel, swaplabel);
 
 static int
 e2uuid (const char *device, const char *uuid)
@@ -56,21 +55,6 @@ xfsuuid (const char *device, const char *uuid)
   return xfs_set_uuid (device, uuid);
 }
 
-static int
-swapuuid (const char *device, const char *uuid)
-{
-  int r;
-  CLEANUP_FREE char *err = NULL;
-
-  r = command (NULL, &err, str_swaplabel, "-U", uuid, device, NULL);
-  if (r == -1) {
-    reply_with_error ("%s", err);
-    return -1;
-  }
-
-  return 0;
-}
-
 int
 do_set_uuid (const char *device, const char *uuid)
 {
@@ -88,7 +72,7 @@ do_set_uuid (const char *device, const char *uuid)
     r = xfsuuid (device, uuid);
 
   else if (STREQ (vfs_type, "swap"))
-    r = swapuuid (device, uuid);
+    r = swap_set_uuid (device, uuid);
 
   else if (STREQ (vfs_type, "btrfs"))
     r = btrfs_set_uuid (device, uuid);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list