On Fri, Sep 13, 2013 at 07:32:23PM +0800, Anand Jain wrote:
> Further, this patch adds new parameters mounted and
> group profile info in the filesystem show output

Sorry to bother you, but the 'further' part of the patch should be
separated out. The core change of the patch is to use libblkid and the
ioctl.

> ---------------
> btrfs fi show
> Label: none  uuid: a2446ecf-68c5-4815-8b63-099d10fc373c mounted: /btrfs
>       Group profile: metadata: single  metadata: DUP  data: single

I didn't notice that before, this does not bring much information
without the numbers as 'fi df' does. Please drop the printf lines

> @@ -246,34 +338,73 @@ static int cmd_show(int argc, char **argv)
>       struct list_head *cur_uuid;
>       char *search = NULL;
>       int ret;
> -     int where = BTRFS_SCAN_PROC;
> +     int where = 0;
>       int searchstart = 1;
>  
>       if( argc > 1 && !strcmp(argv[1],"--all-devices")){
>               where = BTRFS_SCAN_DEV;
>               searchstart += 1;
> +     } else if (argc > 1 && !strcmp(argv[1], "--mounted")) {
> +             where = BTRFS_SCAN_MOUNTED;
> +             searchstart += 1;

getopt was not used here, but with the new options it probably should
be, because

> -     if (check_argc_max(argc, searchstart + 1))
> -             usage(cmd_show_usage);
> -
> -     ret = scan_for_btrfs(where, 0);
> -
> -     if (ret){
> -             fprintf(stderr, "ERROR: error %d while scanning\n", ret);
> -             return 1;
> +     if (where == BTRFS_SCAN_DEV) {
> +             if (check_argc_max(argc, searchstart + 1))
> +                     usage(cmd_show_usage);
> +     } else if (where == BTRFS_SCAN_MOUNTED) {
> +             if (check_argc_max(argc, searchstart))
> +                     usage(cmd_show_usage);
> +     } else {
> +             if (check_argc_max(argc, searchstart))
> +                     usage(cmd_show_usage);

this stops to work:

$ btrfs fi show SOME-UUID
btrfs filesystem show: too many arguments


thanks,
david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to