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

Pino Toscano ptoscano at redhat.com
Wed Jun 24 10:33:46 UTC 2015


Hi,

in commit message, s/existed/existing/.

In data mercoledì 24 giugno 2015 15:54:04, Chen Hanxiao ha scritto:
> 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);

You don't need to declare prototypes of do_* functions of the daemon,
they are generated automatically in daemon/actions.h.

>  /*-- 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
> 

The rest would seem okay.

Thanks,
-- 
Pino Toscano




More information about the Libguestfs mailing list