diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2012-03-03 15:09:07 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2012-03-03 15:09:07 +0100 |
commit | e8cfc3f693e8a0cbfc489564c76e00c074f63066 (patch) | |
tree | 6b89cd91d9fc4b8138b3c5ea08c7c619f1bc0017 /util-linux/volume_id | |
parent | 97e528164183c9a9b4768b0d078b3039a1a6ae36 (diff) | |
download | busybox-e8cfc3f693e8a0cbfc489564c76e00c074f63066.tar.gz |
blkid: if parameters are given, do not scan /dev
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/volume_id')
-rw-r--r-- | util-linux/volume_id/get_devname.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c index d81e24438..230102d89 100644 --- a/util-linux/volume_id/get_devname.c +++ b/util-linux/volume_id/get_devname.c @@ -115,7 +115,7 @@ uuidcache_check_device(const char *device, } static struct uuidCache_s* -uuidcache_init(void) +uuidcache_init(int scan_devices) { dbg("DBG: uuidCache=%x, uuidCache"); if (uuidCache) @@ -131,12 +131,12 @@ uuidcache_init(void) * This is unacceptably complex. Let's just scan /dev. * (Maybe add scanning of /sys/block/XXX/dev for devices * somehow not having their /dev/XXX entries created?) */ - - recursive_action("/dev", ACTION_RECURSE, - uuidcache_check_device, /* file_action */ - NULL, /* dir_action */ - NULL, /* userData */ - 0 /* depth */); + if (scan_devices) + recursive_action("/dev", ACTION_RECURSE, + uuidcache_check_device, /* file_action */ + NULL, /* dir_action */ + NULL, /* userData */ + 0 /* depth */); return uuidCache; } @@ -150,7 +150,7 @@ get_spec_by_x(int n, const char *t, int *majorPtr, int *minorPtr) { struct uuidCache_s *uc; - uc = uuidcache_init(); + uc = uuidcache_init(/*scan_devices:*/ 1); while (uc) { switch (n) { case UUID: @@ -215,11 +215,11 @@ get_spec_by_volume_label(const char *s, int *major, int *minor) #endif // UNUSED /* Used by blkid */ -void display_uuid_cache(void) +void display_uuid_cache(int scan_devices) { struct uuidCache_s *uc; - uc = uuidcache_init(); + uc = uuidcache_init(scan_devices); while (uc) { printf("%s:", uc->device); if (uc->label[0]) @@ -264,7 +264,7 @@ char *get_devname_from_label(const char *spec) { struct uuidCache_s *uc; - uc = uuidcache_init(); + uc = uuidcache_init(/*scan_devices:*/ 1); while (uc) { if (uc->label[0] && strcmp(spec, uc->label) == 0) { return xstrdup(uc->device); @@ -278,7 +278,7 @@ char *get_devname_from_uuid(const char *spec) { struct uuidCache_s *uc; - uc = uuidcache_init(); + uc = uuidcache_init(/*scan_devices:*/ 1); while (uc) { /* case of hex numbers doesn't matter */ if (strcasecmp(spec, uc->uc_uuid) == 0) { |