From d25c33f186c7cf3618c34ce79af94fe156f9ab02 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 17 Mar 2008 09:25:05 +0000 Subject: volume_id: disable detection routines which are not setting label and uuid anyway function old new delta static.warn 1 - -1 static.drive_name_string 14 12 -2 static.offsets 8 - -8 static.sectors 10 - -10 fs2 60 48 -12 raid2 16 - -16 uuidcache_init 704 677 -27 raid1 32 - -32 volume_id_probe_all 198 158 -40 volume_id_probe_lvm1 58 - -58 volume_id_probe_highpoint_37x_raid 63 - -63 volume_id_probe_hpfs 67 - -67 volume_id_probe_minix 74 - -74 volume_id_probe_lvm2 78 - -78 volume_id_probe_silicon_medley_raid 97 - -97 volume_id_probe_via_raid 101 - -101 volume_id_probe_highpoint_45x_raid 104 - -104 volume_id_probe_nvidia_raid 108 - -108 volume_id_probe_lsi_mega_raid 108 - -108 volume_id_probe_intel_software_raid 108 - -108 volume_id_probe_ufs 126 - -126 volume_id_probe_promise_fasttrack_raid 144 - -144 ------------------------------------------------------------------------------ (add/remove: 0/18 grow/shrink: 0/4 up/down: 0/-1384) Total: -1384 bytes text data bss dec hex filename 794244 662 7420 802326 c3e16 busybox_old 792698 662 7420 800780 c380c busybox_unstripped --- util-linux/volume_id/get_devname.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'util-linux/volume_id/get_devname.c') diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c index bb3043cd6..b46aad4a2 100644 --- a/util-linux/volume_id/get_devname.c +++ b/util-linux/volume_id/get_devname.c @@ -243,8 +243,8 @@ dev_get_major_minor(char *device_name, int *major, int *minor) colon = strchr(dev, ':'); if (!colon) goto ret; - *major = strtol(dev, NULL, 10); - *minor = strtol(colon + 1, NULL, 10); + *major = bb_strtou(dev, NULL, 10); + *minor = bb_strtou(colon + 1, NULL, 10); ret: free(dev_path); @@ -261,27 +261,28 @@ uuidcache_init_cdroms(void) proccd = fopen(PROC_CDROMS, "r"); if (!proccd) { - static smallint warn = 0; - if (!warn) { - warn = 1; - bb_error_msg("mount: could not open %s, so UUID and LABEL " - "conversion cannot be done for CD-Roms.", - PROC_CDROMS); - } +// static smallint warn = 0; +// if (!warn) { +// warn = 1; +// bb_error_msg("can't open %s, UUID and LABEL " +// "conversion cannot be done for CD-Roms", +// PROC_CDROMS); +// } return; } while (fgets(line, sizeof(line), proccd)) { - static const char drive_name_string[] ALIGN1 = "drive name:\t\t"; + static const char drive_name_string[] ALIGN1 = "drive name:"; if (strncmp(line, drive_name_string, sizeof(drive_name_string) - 1) == 0) { char *device_name; - device_name = strtok(line + sizeof(drive_name_string) - 1, "\t\n"); - while (device_name) { + + device_name = strtok(skip_whitespace(line + sizeof(drive_name_string) - 1), " \t\n"); + while (device_name && device_name[0]) { ma = mi = -1; dev_get_major_minor(device_name, &ma, &mi); uuidcache_check_device(device_name, ma, mi, 1); - device_name = strtok(NULL, "\t\n"); + device_name = strtok(NULL, " \t\n"); } break; } @@ -418,7 +419,8 @@ char *get_devname_from_uuid(const char *spec) uuidcache_init(); uc = uuidCache; while (uc) { - if (strcmp(spec, uc->uc_uuid) == 0) { + /* case of hex numbers doesn't matter */ + if (strcasecmp(spec, uc->uc_uuid) == 0) { return xstrdup(uc->device); } uc = uc->next; -- cgit v1.2.3