In data mercoledì 24 giugno 2015 15:54:06, Chen Hanxiao ha scritto:
 Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
 ---
  daemon/daemon.h |  3 +++
  daemon/uuids.c  | 13 +------------
  2 files changed, 4 insertions(+), 12 deletions(-)
 
 diff --git a/daemon/daemon.h b/daemon/daemon.h
 index aba6ef2..c887cfd 100644
 --- a/daemon/daemon.h
 +++ b/daemon/daemon.h
 @@ -275,6 +275,9 @@ extern int btrfstune_set_uuid (const char *device, const char
*uuid);
  /*-- in ntfs.c --*/
  extern char *ntfs_get_label (const char *device);
  
 +/*-- in swap.c --*/
 +extern int do_mkswap_U (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/uuids.c b/daemon/uuids.c
 index 0520113..704906d 100644
 --- a/daemon/uuids.c
 +++ b/daemon/uuids.c
 @@ -27,8 +27,6 @@
  #include "actions.h"
  #include "optgroups.h"
  
 -GUESTFSD_EXT_CMD(str_swaplabel, swaplabel);
 -
  static int
  e2uuid (const char *device, const char *uuid)
  {
 @@ -59,16 +57,7 @@ xfsuuid (const char *device, const char *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;
 +  return do_mkswap_U (device, uuid);
  } 
This is actually wrong: swaplabel prints or changes the label/UUID of
an existing swap area, while mkswap creates a new swap area trashing
the previous content of the device/file.
Just move swapuuid to daemon/swap.c, renaming it to swap_set_uuid.
Thanks,
-- 
Pino Toscano