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(int scan_devices);
/* Returns:
* 0: no UUID= or LABEL= prefix found
int blkid_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int blkid_main(int argc UNUSED_PARAM, char **argv)
{
+ int scan_devices = 1;
+
while (*++argv) {
/* Note: bogus device names don't cause any error messages */
add_to_uuid_cache(*argv);
+ scan_devices = 0;
}
- display_uuid_cache();
+ display_uuid_cache(scan_devices);
return 0;
}
}
static struct uuidCache_s*
-uuidcache_init(void)
+uuidcache_init(int scan_devices)
{
dbg("DBG: uuidCache=%x, uuidCache");
if (uuidCache)
* 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;
}
{
struct uuidCache_s *uc;
- uc = uuidcache_init();
+ uc = uuidcache_init(/*scan_devices:*/ 1);
while (uc) {
switch (n) {
case UUID:
#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])
{
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);
{
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) {