[Libguestfs] [PATCH 2/5] labels: move e2label to ext2.c and call it locally

Pino Toscano ptoscano at redhat.com
Wed Jul 8 07:59:00 UTC 2015


Hi,

On Wednesday 08 July 2015 11:07:48 Chen Hanxiao wrote:
>  int
> +ext_set_label (const char *device, const char *label)
> +{
> +  int r;
> +  CLEANUP_FREE char *err = NULL;
> +
> +  if (strlen (label) > EXT2_LABEL_MAX) {
> +    reply_with_error ("%s: ext2 labels are limited to %d bytes",
> +                      label, EXT2_LABEL_MAX);
> +    return -1;
> +  }
> +
> +  r = command (NULL, &err, str_e2label, device, label, NULL);
> +  if (r == -1) {
> +    reply_with_error ("%s", err);
> +    return -1;
> +  }
> +
> +  return 0;
> +}

I'd say you can just put all the implementation ...

> +int
>  do_set_e2label (const char *device, const char *label)
>  {
> -  const mountable_t mountable = {
> -    .type = MOUNTABLE_DEVICE,
> -    .device = /* not really ... */ (char *) device,
> -    .volume = NULL,
> -  };
> -  return do_set_label (&mountable, label);
> +  return ext_set_label (device, label);
>  }

... directly here, and just call do_set_e2label in do_set_label.

Thanks,
-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20150708/7e078068/attachment.sig>


More information about the Libguestfs mailing list