Re: [PATCH] Btrfs: Add get/set label ioctl

Anand Jain
Thu, 30 Aug 2012 06:28:58 -0000

> The original patch could be revised with this support easily.
> How about using one structure and one ioctl number for both of them? i.e,
>
> #define BTRFS_IOC_FSLABEL_CTL    _IOW(BTRFS_IOCTL_MAGIC, 50, struct
> btrfs_ioctl_fslabel_ctl_args)
>
> #define BTRFS_FSLABEL_CTL_GET    0
> #define BTRFS_FSLABEL_CTL_SET    1
>
> struct btrfs_ioctl_fslabel_ctl_args {
>          char label[BTRFS_LABEL_SIZE];
>          u32  flags;
> };
>
> so that get/set label from user tools would looks like,
>
> struct btrfs_ioctl_fslabel_ctl_args arg;
> arg.flags = BTRFS_FSLABEL_CTL_GET;  /* get label */
> or
> arg.flags = BTRFS_FSLABEL_CTL_SET; /* set label */
> ....
>
> ioctl(fd, BTRFS_FSLABEL_CTL,&arg);


  I would prefer separating GET and SET label ioctl,
  (to have one operation with an ioctl define) that
  will be similar to rest of the ioctl in btrfs.
  Further we don''t need ioctl-arg-struct here, unless
  if you are keeping the flags.

  And in my understanding in kernel memcpy are better
  instead of strcpy.

  If you could add GET that will be nicer.

  I would need this for an experiment to add the label
  for the subvol/snapshots.

Thanks, Anand