summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2008-03-17 09:25:05 +0000
committerDenis Vlasenko2008-03-17 09:25:05 +0000
commitd25c33f186c7cf3618c34ce79af94fe156f9ab02 (patch)
treea857a6c68d383075e36bde3b3f38b33ce41ab71c
parentc5b737231debe51edb769a0b5667ee9719e560e0 (diff)
downloadbusybox-d25c33f186c7cf3618c34ce79af94fe156f9ab02.zip
busybox-d25c33f186c7cf3618c34ce79af94fe156f9ab02.tar.gz
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
-rw-r--r--TODO_config_nommu11
-rw-r--r--e2fsprogs/Config.in59
-rw-r--r--scripts/defconfig11
-rw-r--r--util-linux/Config.in166
-rw-r--r--util-linux/volume_id/Kbuild23
-rw-r--r--util-linux/volume_id/get_devname.c30
-rw-r--r--util-linux/volume_id/ocfs2.c2
-rw-r--r--util-linux/volume_id/unused_highpoint.c (renamed from util-linux/volume_id/highpoint.c)0
-rw-r--r--util-linux/volume_id/unused_hpfs.c (renamed from util-linux/volume_id/hpfs.c)0
-rw-r--r--util-linux/volume_id/unused_isw_raid.c (renamed from util-linux/volume_id/isw_raid.c)0
-rw-r--r--util-linux/volume_id/unused_lsi_raid.c (renamed from util-linux/volume_id/lsi_raid.c)0
-rw-r--r--util-linux/volume_id/unused_lvm.c (renamed from util-linux/volume_id/lvm.c)7
-rw-r--r--util-linux/volume_id/unused_mac.c (renamed from util-linux/volume_id/mac.c)50
-rw-r--r--util-linux/volume_id/unused_minix.c (renamed from util-linux/volume_id/minix.c)0
-rw-r--r--util-linux/volume_id/unused_msdos.c (renamed from util-linux/volume_id/msdos.c)53
-rw-r--r--util-linux/volume_id/unused_nvidia_raid.c (renamed from util-linux/volume_id/nvidia_raid.c)0
-rw-r--r--util-linux/volume_id/unused_promise_raid.c (renamed from util-linux/volume_id/promise_raid.c)0
-rw-r--r--util-linux/volume_id/unused_silicon_raid.c (renamed from util-linux/volume_id/silicon_raid.c)0
-rw-r--r--util-linux/volume_id/unused_ufs.c (renamed from util-linux/volume_id/ufs.c)0
-rw-r--r--util-linux/volume_id/unused_via_raid.c (renamed from util-linux/volume_id/via_raid.c)2
-rw-r--r--util-linux/volume_id/volume_id.c32
-rw-r--r--util-linux/volume_id/volume_id_internal.h26
22 files changed, 234 insertions, 238 deletions
diff --git a/TODO_config_nommu b/TODO_config_nommu
index e628568..21960a0 100644
--- a/TODO_config_nommu
+++ b/TODO_config_nommu
@@ -497,27 +497,16 @@ CONFIG_FEATURE_VOLUMEID_REISERFS=y
CONFIG_FEATURE_VOLUMEID_FAT=y
CONFIG_FEATURE_VOLUMEID_HFS=y
CONFIG_FEATURE_VOLUMEID_JFS=y
-CONFIG_FEATURE_VOLUMEID_UFS=y
CONFIG_FEATURE_VOLUMEID_XFS=y
CONFIG_FEATURE_VOLUMEID_NTFS=y
CONFIG_FEATURE_VOLUMEID_ISO9660=y
CONFIG_FEATURE_VOLUMEID_UDF=y
CONFIG_FEATURE_VOLUMEID_LUKS=y
CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y
-CONFIG_FEATURE_VOLUMEID_LVM=y
CONFIG_FEATURE_VOLUMEID_CRAMFS=y
-CONFIG_FEATURE_VOLUMEID_HPFS=y
CONFIG_FEATURE_VOLUMEID_ROMFS=y
CONFIG_FEATURE_VOLUMEID_SYSV=y
-CONFIG_FEATURE_VOLUMEID_MINIX=y
CONFIG_FEATURE_VOLUMEID_OCFS2=y
-CONFIG_FEATURE_VOLUMEID_HIGHPOINTRAID=y
-CONFIG_FEATURE_VOLUMEID_ISWRAID=y
-CONFIG_FEATURE_VOLUMEID_LSIRAID=y
-CONFIG_FEATURE_VOLUMEID_VIARAID=y
-CONFIG_FEATURE_VOLUMEID_SILICONRAID=y
-CONFIG_FEATURE_VOLUMEID_NVIDIARAID=y
-CONFIG_FEATURE_VOLUMEID_PROMISERAID=y
CONFIG_FEATURE_VOLUMEID_LINUXRAID=y
CONFIG_MOUNT=y
CONFIG_FEATURE_MOUNT_FAKE=y
diff --git a/e2fsprogs/Config.in b/e2fsprogs/Config.in
index 521273e..fe8d031 100644
--- a/e2fsprogs/Config.in
+++ b/e2fsprogs/Config.in
@@ -12,13 +12,13 @@ config CHATTR
chattr changes the file attributes on a second extended file system.
### config E2FSCK
-### bool "e2fsck"
-### default n
-### help
-### e2fsck is used to check Linux second extended file systems (ext2fs).
-### e2fsck also supports ext2 filesystems countaining a journal (ext3).
-### The normal compat symlinks 'fsck.ext2' and 'fsck.ext3' are also
-### provided.
+### bool "e2fsck"
+### default n
+### help
+### e2fsck is used to check Linux second extended file systems (ext2fs).
+### e2fsck also supports ext2 filesystems countaining a journal (ext3).
+### The normal compat symlinks 'fsck.ext2' and 'fsck.ext3' are also
+### provided.
config FSCK
bool "fsck"
@@ -35,33 +35,34 @@ config LSATTR
lsattr lists the file attributes on a second extended file system.
### config MKE2FS
-### bool "mke2fs"
-### default n
-### help
-### mke2fs is used to create an ext2/ext3 filesystem. The normal compat
-### symlinks 'mkfs.ext2' and 'mkfs.ext3' are also provided.
+### bool "mke2fs"
+### default n
+### help
+### mke2fs is used to create an ext2/ext3 filesystem. The normal compat
+### symlinks 'mkfs.ext2' and 'mkfs.ext3' are also provided.
### config TUNE2FS
-### bool "tune2fs"
-### default n
-### help
-### tune2fs allows the system administrator to adjust various tunable
-### filesystem parameters on Linux ext2/ext3 filesystems.
+### bool "tune2fs"
+### default n
+### help
+### tune2fs allows the system administrator to adjust various tunable
+### filesystem parameters on Linux ext2/ext3 filesystems.
### config E2LABEL
-### bool "e2label"
-### default n
-### depends on TUNE2FS
-### help
-### e2label will display or change the filesystem label on the ext2
-### filesystem located on device.
+### bool "e2label"
+### default n
+### depends on TUNE2FS
+### help
+### e2label will display or change the filesystem label on the ext2
+### filesystem located on device.
+### NB: this one is now provided by util-linux/volume_id/*
### config FINDFS
-### bool "findfs"
-### default n
-### depends on TUNE2FS
-### help
-### findfs will search the disks in the system looking for a filesystem
-### which has a label matching label or a UUID equal to uuid.
+### bool "findfs"
+### default n
+### depends on TUNE2FS
+### help
+### findfs will search the disks in the system looking for a filesystem
+### which has a label matching label or a UUID equal to uuid.
endmenu
diff --git a/scripts/defconfig b/scripts/defconfig
index 6dbe5d1..6d9997e 100644
--- a/scripts/defconfig
+++ b/scripts/defconfig
@@ -493,27 +493,16 @@ CONFIG_FEATURE_USE_TERMIOS=y
# CONFIG_FEATURE_VOLUMEID_FAT is not set
# CONFIG_FEATURE_VOLUMEID_HFS is not set
# CONFIG_FEATURE_VOLUMEID_JFS is not set
-# CONFIG_FEATURE_VOLUMEID_UFS is not set
# CONFIG_FEATURE_VOLUMEID_XFS is not set
# CONFIG_FEATURE_VOLUMEID_NTFS is not set
# CONFIG_FEATURE_VOLUMEID_ISO9660 is not set
# CONFIG_FEATURE_VOLUMEID_UDF is not set
# CONFIG_FEATURE_VOLUMEID_LUKS is not set
# CONFIG_FEATURE_VOLUMEID_LINUXSWAP is not set
-# CONFIG_FEATURE_VOLUMEID_LVM is not set
# CONFIG_FEATURE_VOLUMEID_CRAMFS is not set
-# CONFIG_FEATURE_VOLUMEID_HPFS is not set
# CONFIG_FEATURE_VOLUMEID_ROMFS is not set
# CONFIG_FEATURE_VOLUMEID_SYSV is not set
-# CONFIG_FEATURE_VOLUMEID_MINIX is not set
# CONFIG_FEATURE_VOLUMEID_OCFS2 is not set
-# CONFIG_FEATURE_VOLUMEID_HIGHPOINTRAID is not set
-# CONFIG_FEATURE_VOLUMEID_ISWRAID is not set
-# CONFIG_FEATURE_VOLUMEID_LSIRAID is not set
-# CONFIG_FEATURE_VOLUMEID_VIARAID is not set
-# CONFIG_FEATURE_VOLUMEID_SILICONRAID is not set
-# CONFIG_FEATURE_VOLUMEID_NVIDIARAID is not set
-# CONFIG_FEATURE_VOLUMEID_PROMISERAID is not set
# CONFIG_FEATURE_VOLUMEID_LINUXRAID is not set
CONFIG_MOUNT=y
CONFIG_FEATURE_MOUNT_FAKE=y
diff --git a/util-linux/Config.in b/util-linux/Config.in
index a1e843a..1c3fe88 100644
--- a/util-linux/Config.in
+++ b/util-linux/Config.in
@@ -159,7 +159,7 @@ config FINDFS
package. However, the e2fsprogs version only support ext2/3. This
version supports those in addition to FAT, swap, and ReiserFS.
WARNING:
- With all submodules selected, it will add ~9k to busybox.
+ With all submodules selected, it will add ~8k to busybox.
config FREERAMDISK
bool "freeramdisk"
@@ -427,12 +427,12 @@ config FEATURE_VOLUMEID_JFS
help
TODO
-config FEATURE_VOLUMEID_UFS
- bool "ufs filesystem"
- default n
- depends on VOLUMEID
- help
- TODO
+### config FEATURE_VOLUMEID_UFS
+### bool "ufs filesystem"
+### default n
+### depends on VOLUMEID
+### help
+### TODO
config FEATURE_VOLUMEID_XFS
bool "xfs filesystem"
@@ -476,12 +476,12 @@ config FEATURE_VOLUMEID_LINUXSWAP
help
TODO
-config FEATURE_VOLUMEID_LVM
- bool "lvm"
- default n
- depends on VOLUMEID
- help
- TODO
+### config FEATURE_VOLUMEID_LVM
+### bool "lvm"
+### default n
+### depends on VOLUMEID
+### help
+### TODO
config FEATURE_VOLUMEID_CRAMFS
bool "cramfs filesystem"
@@ -490,12 +490,12 @@ config FEATURE_VOLUMEID_CRAMFS
help
TODO
-config FEATURE_VOLUMEID_HPFS
- bool "hpfs filesystem"
- default n
- depends on VOLUMEID
- help
- TODO
+### config FEATURE_VOLUMEID_HPFS
+### bool "hpfs filesystem"
+### default n
+### depends on VOLUMEID
+### help
+### TODO
config FEATURE_VOLUMEID_ROMFS
bool "romfs filesystem"
@@ -511,27 +511,27 @@ config FEATURE_VOLUMEID_SYSV
help
TODO
-config FEATURE_VOLUMEID_MINIX
- bool "minix filesystem"
- default n
- depends on VOLUMEID
- help
- TODO
+### config FEATURE_VOLUMEID_MINIX
+### bool "minix filesystem"
+### default n
+### depends on VOLUMEID
+### help
+### TODO
### These only detect partition tables - not used (yet?)
### config FEATURE_VOLUMEID_MAC
-### bool "mac filesystem"
-### default n
-### depends on VOLUMEID
-### help
-### TODO
+### bool "mac filesystem"
+### default n
+### depends on VOLUMEID
+### help
+### TODO
###
### config FEATURE_VOLUMEID_MSDOS
-### bool "msdos filesystem"
-### default n
-### depends on VOLUMEID
-### help
-### TODO
+### bool "msdos filesystem"
+### default n
+### depends on VOLUMEID
+### help
+### TODO
config FEATURE_VOLUMEID_OCFS2
bool "ocfs2 filesystem"
@@ -540,54 +540,54 @@ config FEATURE_VOLUMEID_OCFS2
help
TODO
-config FEATURE_VOLUMEID_HIGHPOINTRAID
- bool "highpoint raid"
- default n
- depends on VOLUMEID
- help
- TODO
-
-config FEATURE_VOLUMEID_ISWRAID
- bool "intel raid"
- default n
- depends on VOLUMEID
- help
- TODO
-
-config FEATURE_VOLUMEID_LSIRAID
- bool "lsi raid"
- default n
- depends on VOLUMEID
- help
- TODO
-
-config FEATURE_VOLUMEID_VIARAID
- bool "via raid"
- default n
- depends on VOLUMEID
- help
- TODO
-
-config FEATURE_VOLUMEID_SILICONRAID
- bool "silicon raid"
- default n
- depends on VOLUMEID
- help
- TODO
-
-config FEATURE_VOLUMEID_NVIDIARAID
- bool "nvidia raid"
- default n
- depends on VOLUMEID
- help
- TODO
-
-config FEATURE_VOLUMEID_PROMISERAID
- bool "promise raid"
- default n
- depends on VOLUMEID
- help
- TODO
+### config FEATURE_VOLUMEID_HIGHPOINTRAID
+### bool "highpoint raid"
+### default n
+### depends on VOLUMEID
+### help
+### TODO
+
+### config FEATURE_VOLUMEID_ISWRAID
+### bool "intel raid"
+### default n
+### depends on VOLUMEID
+### help
+### TODO
+
+### config FEATURE_VOLUMEID_LSIRAID
+### bool "lsi raid"
+### default n
+### depends on VOLUMEID
+### help
+### TODO
+
+### config FEATURE_VOLUMEID_VIARAID
+### bool "via raid"
+### default n
+### depends on VOLUMEID
+### help
+### TODO
+
+### config FEATURE_VOLUMEID_SILICONRAID
+### bool "silicon raid"
+### default n
+### depends on VOLUMEID
+### help
+### TODO
+
+### config FEATURE_VOLUMEID_NVIDIARAID
+### bool "nvidia raid"
+### default n
+### depends on VOLUMEID
+### help
+### TODO
+
+### config FEATURE_VOLUMEID_PROMISERAID
+### bool "promise raid"
+### default n
+### depends on VOLUMEID
+### help
+### TODO
config FEATURE_VOLUMEID_LINUXRAID
bool "linuxraid"
diff --git a/util-linux/volume_id/Kbuild b/util-linux/volume_id/Kbuild
index 96cd880..54b95f0 100644
--- a/util-linux/volume_id/Kbuild
+++ b/util-linux/volume_id/Kbuild
@@ -13,30 +13,29 @@ lib-$(CONFIG_VOLUMEID) += volume_id.o util.o
lib-$(CONFIG_FEATURE_VOLUMEID_EXT) += ext.o
lib-$(CONFIG_FEATURE_VOLUMEID_FAT) += fat.o
lib-$(CONFIG_FEATURE_VOLUMEID_HFS) += hfs.o
-lib-$(CONFIG_FEATURE_VOLUMEID_HIGHPOINTRAID) += highpoint.o
-lib-$(CONFIG_FEATURE_VOLUMEID_ISWRAID) += isw_raid.o
-lib-$(CONFIG_FEATURE_VOLUMEID_LSIRAID) += lsi_raid.o
-lib-$(CONFIG_FEATURE_VOLUMEID_VIARAID) += via_raid.o
-lib-$(CONFIG_FEATURE_VOLUMEID_SILICONRAID) += silicon_raid.o
-lib-$(CONFIG_FEATURE_VOLUMEID_NVIDIARAID) += nvidia_raid.o
-lib-$(CONFIG_FEATURE_VOLUMEID_PROMISERAID) += promise_raid.o
+### lib-$(CONFIG_FEATURE_VOLUMEID_HIGHPOINTRAID) += highpoint.o
+### lib-$(CONFIG_FEATURE_VOLUMEID_ISWRAID) += isw_raid.o
+### lib-$(CONFIG_FEATURE_VOLUMEID_LSIRAID) += lsi_raid.o
+### lib-$(CONFIG_FEATURE_VOLUMEID_VIARAID) += via_raid.o
+### lib-$(CONFIG_FEATURE_VOLUMEID_SILICONRAID) += silicon_raid.o
+### lib-$(CONFIG_FEATURE_VOLUMEID_NVIDIARAID) += nvidia_raid.o
+### lib-$(CONFIG_FEATURE_VOLUMEID_PROMISERAID) += promise_raid.o
lib-$(CONFIG_FEATURE_VOLUMEID_ISO9660) += iso9660.o
lib-$(CONFIG_FEATURE_VOLUMEID_JFS) += jfs.o
lib-$(CONFIG_FEATURE_VOLUMEID_LINUXRAID) += linux_raid.o
lib-$(CONFIG_FEATURE_VOLUMEID_LINUXSWAP) += linux_swap.o
-lib-$(CONFIG_FEATURE_VOLUMEID_LVM) += lvm.o
-### unused
+### lib-$(CONFIG_FEATURE_VOLUMEID_LVM) += lvm.o
### lib-$(CONFIG_FEATURE_VOLUMEID_MAC) += mac.o
### lib-$(CONFIG_FEATURE_VOLUMEID_MSDOS) += msdos.o
lib-$(CONFIG_FEATURE_VOLUMEID_NTFS) += ntfs.o
lib-$(CONFIG_FEATURE_VOLUMEID_REISERFS) += reiserfs.o
lib-$(CONFIG_FEATURE_VOLUMEID_UDF) += udf.o
-lib-$(CONFIG_FEATURE_VOLUMEID_UFS) += ufs.o
+### lib-$(CONFIG_FEATURE_VOLUMEID_UFS) += ufs.o
lib-$(CONFIG_FEATURE_VOLUMEID_XFS) += xfs.o
lib-$(CONFIG_FEATURE_VOLUMEID_CRAMFS) += cramfs.o
-lib-$(CONFIG_FEATURE_VOLUMEID_HPFS) += hpfs.o
+### lib-$(CONFIG_FEATURE_VOLUMEID_HPFS) += hpfs.o
lib-$(CONFIG_FEATURE_VOLUMEID_ROMFS) += romfs.o
lib-$(CONFIG_FEATURE_VOLUMEID_SYSV) += sysv.o
-lib-$(CONFIG_FEATURE_VOLUMEID_MINIX) += minix.o
+### lib-$(CONFIG_FEATURE_VOLUMEID_MINIX) += minix.o
lib-$(CONFIG_FEATURE_VOLUMEID_LUKS) += luks.o
lib-$(CONFIG_FEATURE_VOLUMEID_OCFS2) += ocfs2.o
diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c
index bb3043c..b46aad4 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;
diff --git a/util-linux/volume_id/ocfs2.c b/util-linux/volume_id/ocfs2.c
index 9fd4565..8bcaac0 100644
--- a/util-linux/volume_id/ocfs2.c
+++ b/util-linux/volume_id/ocfs2.c
@@ -80,7 +80,7 @@ struct ocfs2_super_block {
uint8_t s_uuid[OCFS2_VOL_UUID_LEN]; /* 128-bit uuid */
} __attribute__((__packed__));
-int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off)
+int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off)
{
struct ocfs2_super_block *os;
diff --git a/util-linux/volume_id/highpoint.c b/util-linux/volume_id/unused_highpoint.c
index 57c5cad..57c5cad 100644
--- a/util-linux/volume_id/highpoint.c
+++ b/util-linux/volume_id/unused_highpoint.c
diff --git a/util-linux/volume_id/hpfs.c b/util-linux/volume_id/unused_hpfs.c
index 8b51756..8b51756 100644
--- a/util-linux/volume_id/hpfs.c
+++ b/util-linux/volume_id/unused_hpfs.c
diff --git a/util-linux/volume_id/isw_raid.c b/util-linux/volume_id/unused_isw_raid.c
index d928245..d928245 100644
--- a/util-linux/volume_id/isw_raid.c
+++ b/util-linux/volume_id/unused_isw_raid.c
diff --git a/util-linux/volume_id/lsi_raid.c b/util-linux/volume_id/unused_lsi_raid.c
index 730a313..730a313 100644
--- a/util-linux/volume_id/lsi_raid.c
+++ b/util-linux/volume_id/unused_lsi_raid.c
diff --git a/util-linux/volume_id/lvm.c b/util-linux/volume_id/unused_lvm.c
index f9f9395..caee04b 100644
--- a/util-linux/volume_id/lvm.c
+++ b/util-linux/volume_id/unused_lvm.c
@@ -36,17 +36,14 @@ struct lvm2_super_block {
int volume_id_probe_lvm1(struct volume_id *id, uint64_t off)
{
- const uint8_t *buf;
struct lvm1_super_block *lvm;
dbg("probing at offset 0x%llx", (unsigned long long) off);
- buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800);
- if (buf == NULL)
+ lvm = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800);
+ if (lvm == NULL)
return -1;
- lvm = (struct lvm1_super_block *) buf;
-
if (lvm->id[0] != 'H' || lvm->id[1] != 'M')
return -1;
diff --git a/util-linux/volume_id/mac.c b/util-linux/volume_id/unused_mac.c
index 94a99be..8eaa173 100644
--- a/util-linux/volume_id/mac.c
+++ b/util-linux/volume_id/unused_mac.c
@@ -49,17 +49,18 @@ int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off)
return -1;
part = (struct mac_partition *) buf;
- if ((memcmp(part->signature, "PM", 2) == 0) &&
- (memcmp(part->type, "Apple_partition_map", 19) == 0)) {
+ if (part->signature[0] == 'P' && part->signature[1] == 'M' /* "PM" */
+ && (memcmp(part->type, "Apple_partition_map", 19) == 0)
+ ) {
/* linux creates an own subdevice for the map
* just return the type if the drive header is missing */
- volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE);
- id->type = "mac_partition_map";
+// volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE);
+// id->type = "mac_partition_map";
return 0;
}
driver = (struct mac_driver_desc *) buf;
- if (memcmp(driver->signature, "ER", 2) == 0) {
+ if (driver->signature[0] == 'E' && driver->signature[1] == 'R') { /* "ER" */
/* we are on a main device, like a CD
* just try to probe the first partition from the map */
unsigned bsize = be16_to_cpu(driver->block_size);
@@ -72,7 +73,7 @@ int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off)
return -1;
part = (struct mac_partition *) buf;
- if (memcmp(part->signature, "PM", 2) != 0)
+ if (part->signature[0] != 'P' || part->signature[1] != 'M') /* not "PM" */
return -1;
part_count = be32_to_cpu(part->map_count);
@@ -80,11 +81,7 @@ int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off)
if (id->partitions != NULL)
free(id->partitions);
- id->partitions =
- malloc(part_count * sizeof(struct volume_id_partition));
- if (id->partitions == NULL)
- return -1;
- memset(id->partitions, 0x00, sizeof(struct volume_id_partition));
+ id->partitions = xzalloc(part_count * sizeof(struct volume_id_partition));
id->partition_count = part_count;
@@ -97,27 +94,28 @@ int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off)
return -1;
part = (struct mac_partition *) buf;
- if (memcmp(part->signature, "PM", 2) != 0)
+ if (part->signature[0] != 'P' || part->signature[1] != 'M') /* not "PM" */
return -1;
poff = be32_to_cpu(part->start_block) * bsize;
plen = be32_to_cpu(part->block_count) * bsize;
dbg("found '%s' partition entry at 0x%llx, len 0x%llx",
- part->type, (unsigned long long) poff, (unsigned long long) plen);
-
- id->partitions[i].off = poff;
- id->partitions[i].len = plen;
-
- if (memcmp(part->type, "Apple_Free", 10) == 0) {
- volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNUSED);
- } else if (memcmp(part->type, "Apple_partition_map", 19) == 0) {
- volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_PARTITIONTABLE);
- } else {
- volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNPROBED);
- }
+ part->type, (unsigned long long) poff,
+ (unsigned long long) plen);
+
+// id->partitions[i].pt_off = poff;
+// id->partitions[i].pt_len = plen;
+
+// if (memcmp(part->type, "Apple_Free", 10) == 0) {
+// volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNUSED);
+// } else if (memcmp(part->type, "Apple_partition_map", 19) == 0) {
+// volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_PARTITIONTABLE);
+// } else {
+// volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNPROBED);
+// }
}
- volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE);
- id->type = "mac_partition_map";
+// volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE);
+// id->type = "mac_partition_map";
return 0;
}
diff --git a/util-linux/volume_id/minix.c b/util-linux/volume_id/unused_minix.c
index 2f52093..2f52093 100644
--- a/util-linux/volume_id/minix.c
+++ b/util-linux/volume_id/unused_minix.c
diff --git a/util-linux/volume_id/msdos.c b/util-linux/volume_id/unused_msdos.c
index b4b6711..097ee67 100644
--- a/util-linux/volume_id/msdos.c
+++ b/util-linux/volume_id/unused_msdos.c
@@ -33,7 +33,6 @@ struct msdos_partition_entry {
uint32_t nr_sects;
} __attribute__((packed));
-#define MSDOS_MAGIC "\x55\xaa"
#define MSDOS_PARTTABLE_OFFSET 0x1be
#define MSDOS_SIG_OFF 0x1fe
#define BSIZE 0x200
@@ -68,7 +67,7 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off)
if (buf == NULL)
return -1;
- if (memcmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0)
+ if (buf[MSDOS_SIG_OFF] != 0x55 || buf[MSDOS_SIG_OFF + 1] != 0xaa)
return -1;
/* check flags on all entries for a valid partition table */
@@ -86,12 +85,8 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off)
if (id->partitions != NULL)
free(id->partitions);
- id->partitions = malloc(VOLUME_ID_PARTITIONS_MAX *
+ id->partitions = xzalloc(VOLUME_ID_PARTITIONS_MAX *
sizeof(struct volume_id_partition));
- if (id->partitions == NULL)
- return -1;
- memset(id->partitions, 0x00,
- VOLUME_ID_PARTITIONS_MAX * sizeof(struct volume_id_partition));
for (i = 0; i < 4; i++) {
poff = (uint64_t) le32_to_cpu(part[i].start_sect) * BSIZE;
@@ -102,26 +97,26 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off)
p = &id->partitions[i];
- p->partition_type_raw = part[i].sys_ind;
+// p->pt_type_raw = part[i].sys_ind;
if (is_extended(part[i].sys_ind)) {
dbg("found extended partition at 0x%llx", (unsigned long long) poff);
- volume_id_set_usage_part(p, VOLUME_ID_PARTITIONTABLE);
- p->type = "msdos_extended_partition";
+// volume_id_set_usage_part(p, VOLUME_ID_PARTITIONTABLE);
+// p->type = "msdos_extended_partition";
if (extended == 0)
extended = off + poff;
} else {
dbg("found 0x%x data partition at 0x%llx, len 0x%llx",
part[i].sys_ind, (unsigned long long) poff, (unsigned long long) plen);
- if (is_raid(part[i].sys_ind))
- volume_id_set_usage_part(p, VOLUME_ID_RAID);
- else
- volume_id_set_usage_part(p, VOLUME_ID_UNPROBED);
+// if (is_raid(part[i].sys_ind))
+// volume_id_set_usage_part(p, VOLUME_ID_RAID);
+// else
+// volume_id_set_usage_part(p, VOLUME_ID_UNPROBED);
}
- p->off = off + poff;
- p->len = plen;
+// p->pt_off = off + poff;
+// p->pt_len = plen;
id->partition_count = i+1;
}
@@ -142,7 +137,7 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off)
part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET];
- if (memcmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0)
+ if (buf[MSDOS_SIG_OFF] != 0x55 || buf[MSDOS_SIG_OFF + 1] != 0xaa)
break;
next = 0;
@@ -163,21 +158,23 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off)
part[i].sys_ind, (unsigned long long) poff, (unsigned long long) plen);
/* we always start at the 5th entry */
- while (id->partition_count < 4)
- volume_id_set_usage_part(&id->partitions[id->partition_count++], VOLUME_ID_UNUSED);
+// while (id->partition_count < 4)
+// volume_id_set_usage_part(&id->partitions[id->partition_count++], VOLUME_ID_UNUSED);
+ if (id->partition_count < 4)
+ id->partition_count = 4;
p = &id->partitions[id->partition_count];
- if (is_raid(part[i].sys_ind))
- volume_id_set_usage_part(p, VOLUME_ID_RAID);
- else
- volume_id_set_usage_part(p, VOLUME_ID_UNPROBED);
+// if (is_raid(part[i].sys_ind))
+// volume_id_set_usage_part(p, VOLUME_ID_RAID);
+// else
+// volume_id_set_usage_part(p, VOLUME_ID_UNPROBED);
- p->off = current + poff;
- p->len = plen;
+// p->pt_off = current + poff;
+// p->pt_len = plen;
id->partition_count++;
- p->partition_type_raw = part[i].sys_ind;
+// p->pt_type_raw = part[i].sys_ind;
if (id->partition_count >= VOLUME_ID_PARTITIONS_MAX) {
dbg("too many partitions");
@@ -189,8 +186,8 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off)
current = next;
}
- volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE);
- id->type = "msdos_partition_table";
+// volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE);
+// id->type = "msdos_partition_table";
return 0;
}
diff --git a/util-linux/volume_id/nvidia_raid.c b/util-linux/volume_id/unused_nvidia_raid.c
index 692aad1..692aad1 100644
--- a/util-linux/volume_id/nvidia_raid.c
+++ b/util-linux/volume_id/unused_nvidia_raid.c
diff --git a/util-linux/volume_id/promise_raid.c b/util-linux/volume_id/unused_promise_raid.c
index 75c6f89..75c6f89 100644
--- a/util-linux/volume_id/promise_raid.c
+++ b/util-linux/volume_id/unused_promise_raid.c
diff --git a/util-linux/volume_id/silicon_raid.c b/util-linux/volume_id/unused_silicon_raid.c
index 5143112..5143112 100644
--- a/util-linux/volume_id/silicon_raid.c
+++ b/util-linux/volume_id/unused_silicon_raid.c
diff --git a/util-linux/volume_id/ufs.c b/util-linux/volume_id/unused_ufs.c
index ba76876..ba76876 100644
--- a/util-linux/volume_id/ufs.c
+++ b/util-linux/volume_id/unused_ufs.c
diff --git a/util-linux/volume_id/via_raid.c b/util-linux/volume_id/unused_via_raid.c
index a3e94e0..4332946 100644
--- a/util-linux/volume_id/via_raid.c
+++ b/util-linux/volume_id/unused_via_raid.c
@@ -53,7 +53,7 @@ int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size)
if (via == NULL)
return -1;
- if (via->signature != cpu_to_le16(VIA_SIGNATURE))
+ if (via->signature != cpu_to_le16(VIA_SIGNATURE))
return -1;
if (via->version_number > 1)
diff --git a/util-linux/volume_id/volume_id.c b/util-linux/volume_id/volume_id.c
index a26e2bc..de9aae2 100644
--- a/util-linux/volume_id/volume_id.c
+++ b/util-linux/volume_id/volume_id.c
@@ -20,6 +20,31 @@
#include "volume_id_internal.h"
+
+/* Some detection routines do not set label or uuid anyway,
+ * so they are disabled. */
+
+/* Looks for partitions, we don't use it: */
+#define ENABLE_FEATURE_VOLUMEID_MAC 0
+/* #define ENABLE_FEATURE_VOLUMEID_MSDOS 0 - NB: this one
+ * was not properly added to probe table anyway - ??! */
+
+/* None of RAIDs have label or uuid, except LinuxRAID: */
+#define ENABLE_FEATURE_VOLUMEID_HIGHPOINTRAID 0
+#define ENABLE_FEATURE_VOLUMEID_ISWRAID 0
+#define ENABLE_FEATURE_VOLUMEID_LSIRAID 0
+#define ENABLE_FEATURE_VOLUMEID_LVM 0
+#define ENABLE_FEATURE_VOLUMEID_NVIDIARAID 0
+#define ENABLE_FEATURE_VOLUMEID_PROMISERAID 0
+#define ENABLE_FEATURE_VOLUMEID_SILICONRAID 0
+#define ENABLE_FEATURE_VOLUMEID_VIARAID 0
+
+/* These filesystems also have no label or uuid: */
+#define ENABLE_FEATURE_VOLUMEID_MINIX 0
+#define ENABLE_FEATURE_VOLUMEID_HPFS 0
+#define ENABLE_FEATURE_VOLUMEID_UFS 0
+
+
typedef int (*raid_probe_fptr)(struct volume_id *id, uint64_t off, uint64_t size);
typedef int (*probe_fptr)(struct volume_id *id, uint64_t off);
@@ -68,10 +93,9 @@ static const probe_fptr fs1[] = {
#if ENABLE_FEATURE_VOLUMEID_FAT
volume_id_probe_vfat,
#endif
-// This one only looks for partitions, we don't use it
-//#if ENABLE_FEATURE_VOLUMEID_MAC
-// volume_id_probe_mac_partition_map,
-//#endif
+#if ENABLE_FEATURE_VOLUMEID_MAC
+ volume_id_probe_mac_partition_map,
+#endif
#if ENABLE_FEATURE_VOLUMEID_XFS
volume_id_probe_xfs,
#endif
diff --git a/util-linux/volume_id/volume_id_internal.h b/util-linux/volume_id/volume_id_internal.h
index 8c7ca03..78b4a7b 100644
--- a/util-linux/volume_id/volume_id_internal.h
+++ b/util-linux/volume_id/volume_id_internal.h
@@ -163,25 +163,25 @@ void volume_id_free_buffer(struct volume_id *id);
/* RAID */
-int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off);
-int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size);
+//int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off);
+//int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size);
-int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size);
+//int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size);
int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size);
-int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size);
+//int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size);
-int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size);
+//int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size);
-int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size);
+//int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size);
-int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size);
+//int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size);
-int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size);
+//int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size);
-int volume_id_probe_lvm1(struct volume_id *id, uint64_t off);
-int volume_id_probe_lvm2(struct volume_id *id, uint64_t off);
+//int volume_id_probe_lvm1(struct volume_id *id, uint64_t off);
+//int volume_id_probe_lvm2(struct volume_id *id, uint64_t off);
/* FS */
@@ -193,7 +193,7 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off);
int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off);
-int volume_id_probe_hpfs(struct volume_id *id, uint64_t off);
+//int volume_id_probe_hpfs(struct volume_id *id, uint64_t off);
int volume_id_probe_iso9660(struct volume_id *id, uint64_t off);
@@ -205,7 +205,7 @@ int volume_id_probe_luks(struct volume_id *id, uint64_t off);
//int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off);
-int volume_id_probe_minix(struct volume_id *id, uint64_t off);
+//int volume_id_probe_minix(struct volume_id *id, uint64_t off);
//int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off);
@@ -221,6 +221,6 @@ int volume_id_probe_sysv(struct volume_id *id, uint64_t off);
int volume_id_probe_udf(struct volume_id *id, uint64_t off);
-int volume_id_probe_ufs(struct volume_id *id, uint64_t off);
+//int volume_id_probe_ufs(struct volume_id *id, uint64_t off);
int volume_id_probe_xfs(struct volume_id *id, uint64_t off);