On Saturday 30 May 2009 13:21, Hans Ulli Kroll wrote:
> Signed-off-by: Hans Ulli Kroll <[email protected]>
> ---
>  include/usage.h                           |    6 +++-
>  include/volume_id.h                       |    2 +-
>  util-linux/blkid.c                        |   15 ++++++++++-
>  util-linux/volume_id/get_devname.c        |   38 
> +++++++++++++++++++----------
>  util-linux/volume_id/volume_id_internal.h |    8 +++---
>  5 files changed, 47 insertions(+), 22 deletions(-)
> 
> diff --git a/include/usage.h b/include/usage.h
> index e606925..8e23ad7 100644
> --- a/include/usage.h
> +++ b/include/usage.h
> @@ -1174,9 +1174,11 @@
>       "\n     -S SECTORS" \
>  
>  #define blkid_trivial_usage \
> -       ""
> +       "[dev ...]\n"
> +

"[DEV...]". Without \n and without extra empty line.

>  #define blkid_full_usage "\n\n" \
> -       "Print UUIDs of all filesystems."
> +       "Print UUIDs of all filesystems.\n" \

Not all now, right?

> +       "\n     dev specify device(s) to probe (default: all devices)"

(5 spaces)"\n<TAB>DEV<TAB>Device to probe (default: all)"

>  char *get_devname_from_label(const char *spec);
>  char *get_devname_from_uuid(const char *spec);
> -void display_uuid_cache(void);
> +void display_uuid_cache(const char *dev_name);
> diff --git a/util-linux/blkid.c b/util-linux/blkid.c
> index ec699d1..a728c1b 100644
> --- a/util-linux/blkid.c
> +++ b/util-linux/blkid.c
> @@ -11,8 +11,19 @@
>  #include "volume_id.h"
>  
>  int blkid_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
> -int blkid_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
> +int blkid_main(int argc, char **argv)
>  {
> -     display_uuid_cache();
> +     argv++;
> +     argc--;
> +
> +     if (argc > 1) {
> +             while (argc >= 1) {
> +                     display_uuid_cache (*argv);
> +                     argv++;
> +                     argc--;
> +             }
> +     } else {
> +             display_uuid_cache (NULL);
> +     }
>       return 0;
>  }

How about this instead?

        argv++;
        do {
                display_uuid_cache(*argv);
        } while (*++argv);

But there is a problem which will make it necessary
to do it differently anyway:

> -/* Used by blkid */
> -void display_uuid_cache(void)
> +/* Used by blkid, if *dev is NULL show all, otherwise only one */
> +void display_uuid_cache(const char *devname)
>  {
>       struct uuidCache_s *u;
>  
>       uuidcache_init();

Above call scans all devices even if devname != NULL.
Can it be fixed? I suggest passing argv (the whole list, that is,
not one-by-one), and making uuidcache_init scan only
devices in the list.


> diff --git a/util-linux/volume_id/volume_id_internal.h 
> b/util-linux/volume_id/volume_id_internal.h
> index af58883..d0a56d5 100644
> --- a/util-linux/volume_id/volume_id_internal.h
> +++ b/util-linux/volume_id/volume_id_internal.h
> @@ -77,10 +77,10 @@ struct volume_id {
>  //   size_t          uuid_raw_len;
>       /* uuid is stored in ASCII (not binary) form here: */
>       char            uuid[VOLUME_ID_UUID_SIZE+1];
> -//   char            type_version[VOLUME_ID_FORMAT_SIZE];
> +     char            type_version[VOLUME_ID_FORMAT_SIZE];
>  //   smallint        usage_id;
> -//   const char      *usage;
> -//   const char      *type;
> +//   char    usage;
> +//   char    *type;
>  };

Some stray changes crept in, it seems.

>  void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum 
> endian endianess, size_t count);
> -//void volume_id_set_usage(struct volume_id *id, enum volume_id_usage 
> usage_id);
> +// void volume_id_set_usage(struct volume_id *id, enum volume_id_usage 
> usage_id);

ditto.

Can you respin the patch?
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to