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
This commit is contained in:
Denis Vlasenko 2008-03-17 09:25:05 +00:00
parent c5b737231d
commit d25c33f186
22 changed files with 226 additions and 230 deletions

View File

@ -497,27 +497,16 @@ CONFIG_FEATURE_VOLUMEID_REISERFS=y
CONFIG_FEATURE_VOLUMEID_FAT=y CONFIG_FEATURE_VOLUMEID_FAT=y
CONFIG_FEATURE_VOLUMEID_HFS=y CONFIG_FEATURE_VOLUMEID_HFS=y
CONFIG_FEATURE_VOLUMEID_JFS=y CONFIG_FEATURE_VOLUMEID_JFS=y
CONFIG_FEATURE_VOLUMEID_UFS=y
CONFIG_FEATURE_VOLUMEID_XFS=y CONFIG_FEATURE_VOLUMEID_XFS=y
CONFIG_FEATURE_VOLUMEID_NTFS=y CONFIG_FEATURE_VOLUMEID_NTFS=y
CONFIG_FEATURE_VOLUMEID_ISO9660=y CONFIG_FEATURE_VOLUMEID_ISO9660=y
CONFIG_FEATURE_VOLUMEID_UDF=y CONFIG_FEATURE_VOLUMEID_UDF=y
CONFIG_FEATURE_VOLUMEID_LUKS=y CONFIG_FEATURE_VOLUMEID_LUKS=y
CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y
CONFIG_FEATURE_VOLUMEID_LVM=y
CONFIG_FEATURE_VOLUMEID_CRAMFS=y CONFIG_FEATURE_VOLUMEID_CRAMFS=y
CONFIG_FEATURE_VOLUMEID_HPFS=y
CONFIG_FEATURE_VOLUMEID_ROMFS=y CONFIG_FEATURE_VOLUMEID_ROMFS=y
CONFIG_FEATURE_VOLUMEID_SYSV=y CONFIG_FEATURE_VOLUMEID_SYSV=y
CONFIG_FEATURE_VOLUMEID_MINIX=y
CONFIG_FEATURE_VOLUMEID_OCFS2=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_FEATURE_VOLUMEID_LINUXRAID=y
CONFIG_MOUNT=y CONFIG_MOUNT=y
CONFIG_FEATURE_MOUNT_FAKE=y CONFIG_FEATURE_MOUNT_FAKE=y

View File

@ -12,13 +12,13 @@ config CHATTR
chattr changes the file attributes on a second extended file system. chattr changes the file attributes on a second extended file system.
### config E2FSCK ### config E2FSCK
### bool "e2fsck" ### bool "e2fsck"
### default n ### default n
### help ### help
### e2fsck is used to check Linux second extended file systems (ext2fs). ### e2fsck is used to check Linux second extended file systems (ext2fs).
### e2fsck also supports ext2 filesystems countaining a journal (ext3). ### e2fsck also supports ext2 filesystems countaining a journal (ext3).
### The normal compat symlinks 'fsck.ext2' and 'fsck.ext3' are also ### The normal compat symlinks 'fsck.ext2' and 'fsck.ext3' are also
### provided. ### provided.
config FSCK config FSCK
bool "fsck" bool "fsck"
@ -35,33 +35,34 @@ config LSATTR
lsattr lists the file attributes on a second extended file system. lsattr lists the file attributes on a second extended file system.
### config MKE2FS ### config MKE2FS
### bool "mke2fs" ### bool "mke2fs"
### default n ### default n
### help ### help
### mke2fs is used to create an ext2/ext3 filesystem. The normal compat ### mke2fs is used to create an ext2/ext3 filesystem. The normal compat
### symlinks 'mkfs.ext2' and 'mkfs.ext3' are also provided. ### symlinks 'mkfs.ext2' and 'mkfs.ext3' are also provided.
### config TUNE2FS ### config TUNE2FS
### bool "tune2fs" ### bool "tune2fs"
### default n ### default n
### help ### help
### tune2fs allows the system administrator to adjust various tunable ### tune2fs allows the system administrator to adjust various tunable
### filesystem parameters on Linux ext2/ext3 filesystems. ### filesystem parameters on Linux ext2/ext3 filesystems.
### config E2LABEL ### config E2LABEL
### bool "e2label" ### bool "e2label"
### default n ### default n
### depends on TUNE2FS ### depends on TUNE2FS
### help ### help
### e2label will display or change the filesystem label on the ext2 ### e2label will display or change the filesystem label on the ext2
### filesystem located on device. ### filesystem located on device.
### NB: this one is now provided by util-linux/volume_id/*
### config FINDFS ### config FINDFS
### bool "findfs" ### bool "findfs"
### default n ### default n
### depends on TUNE2FS ### depends on TUNE2FS
### help ### help
### findfs will search the disks in the system looking for a filesystem ### findfs will search the disks in the system looking for a filesystem
### which has a label matching label or a UUID equal to uuid. ### which has a label matching label or a UUID equal to uuid.
endmenu endmenu

View File

@ -493,27 +493,16 @@ CONFIG_FEATURE_USE_TERMIOS=y
# CONFIG_FEATURE_VOLUMEID_FAT is not set # CONFIG_FEATURE_VOLUMEID_FAT is not set
# CONFIG_FEATURE_VOLUMEID_HFS is not set # CONFIG_FEATURE_VOLUMEID_HFS is not set
# CONFIG_FEATURE_VOLUMEID_JFS 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_XFS is not set
# CONFIG_FEATURE_VOLUMEID_NTFS is not set # CONFIG_FEATURE_VOLUMEID_NTFS is not set
# CONFIG_FEATURE_VOLUMEID_ISO9660 is not set # CONFIG_FEATURE_VOLUMEID_ISO9660 is not set
# CONFIG_FEATURE_VOLUMEID_UDF is not set # CONFIG_FEATURE_VOLUMEID_UDF is not set
# CONFIG_FEATURE_VOLUMEID_LUKS is not set # CONFIG_FEATURE_VOLUMEID_LUKS is not set
# CONFIG_FEATURE_VOLUMEID_LINUXSWAP 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_CRAMFS is not set
# CONFIG_FEATURE_VOLUMEID_HPFS is not set
# CONFIG_FEATURE_VOLUMEID_ROMFS is not set # CONFIG_FEATURE_VOLUMEID_ROMFS is not set
# CONFIG_FEATURE_VOLUMEID_SYSV 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_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_FEATURE_VOLUMEID_LINUXRAID is not set
CONFIG_MOUNT=y CONFIG_MOUNT=y
CONFIG_FEATURE_MOUNT_FAKE=y CONFIG_FEATURE_MOUNT_FAKE=y

View File

@ -159,7 +159,7 @@ config FINDFS
package. However, the e2fsprogs version only support ext2/3. This package. However, the e2fsprogs version only support ext2/3. This
version supports those in addition to FAT, swap, and ReiserFS. version supports those in addition to FAT, swap, and ReiserFS.
WARNING: WARNING:
With all submodules selected, it will add ~9k to busybox. With all submodules selected, it will add ~8k to busybox.
config FREERAMDISK config FREERAMDISK
bool "freeramdisk" bool "freeramdisk"
@ -427,12 +427,12 @@ config FEATURE_VOLUMEID_JFS
help help
TODO TODO
config FEATURE_VOLUMEID_UFS ### config FEATURE_VOLUMEID_UFS
bool "ufs filesystem" ### bool "ufs filesystem"
default n ### default n
depends on VOLUMEID ### depends on VOLUMEID
help ### help
TODO ### TODO
config FEATURE_VOLUMEID_XFS config FEATURE_VOLUMEID_XFS
bool "xfs filesystem" bool "xfs filesystem"
@ -476,12 +476,12 @@ config FEATURE_VOLUMEID_LINUXSWAP
help help
TODO TODO
config FEATURE_VOLUMEID_LVM ### config FEATURE_VOLUMEID_LVM
bool "lvm" ### bool "lvm"
default n ### default n
depends on VOLUMEID ### depends on VOLUMEID
help ### help
TODO ### TODO
config FEATURE_VOLUMEID_CRAMFS config FEATURE_VOLUMEID_CRAMFS
bool "cramfs filesystem" bool "cramfs filesystem"
@ -490,12 +490,12 @@ config FEATURE_VOLUMEID_CRAMFS
help help
TODO TODO
config FEATURE_VOLUMEID_HPFS ### config FEATURE_VOLUMEID_HPFS
bool "hpfs filesystem" ### bool "hpfs filesystem"
default n ### default n
depends on VOLUMEID ### depends on VOLUMEID
help ### help
TODO ### TODO
config FEATURE_VOLUMEID_ROMFS config FEATURE_VOLUMEID_ROMFS
bool "romfs filesystem" bool "romfs filesystem"
@ -511,27 +511,27 @@ config FEATURE_VOLUMEID_SYSV
help help
TODO TODO
config FEATURE_VOLUMEID_MINIX ### config FEATURE_VOLUMEID_MINIX
bool "minix filesystem" ### bool "minix filesystem"
default n ### default n
depends on VOLUMEID ### depends on VOLUMEID
help ### help
TODO ### TODO
### These only detect partition tables - not used (yet?) ### These only detect partition tables - not used (yet?)
### config FEATURE_VOLUMEID_MAC ### config FEATURE_VOLUMEID_MAC
### bool "mac filesystem" ### bool "mac filesystem"
### default n ### default n
### depends on VOLUMEID ### depends on VOLUMEID
### help ### help
### TODO ### TODO
### ###
### config FEATURE_VOLUMEID_MSDOS ### config FEATURE_VOLUMEID_MSDOS
### bool "msdos filesystem" ### bool "msdos filesystem"
### default n ### default n
### depends on VOLUMEID ### depends on VOLUMEID
### help ### help
### TODO ### TODO
config FEATURE_VOLUMEID_OCFS2 config FEATURE_VOLUMEID_OCFS2
bool "ocfs2 filesystem" bool "ocfs2 filesystem"
@ -540,54 +540,54 @@ config FEATURE_VOLUMEID_OCFS2
help help
TODO TODO
config FEATURE_VOLUMEID_HIGHPOINTRAID ### config FEATURE_VOLUMEID_HIGHPOINTRAID
bool "highpoint raid" ### bool "highpoint raid"
default n ### default n
depends on VOLUMEID ### depends on VOLUMEID
help ### help
TODO ### TODO
config FEATURE_VOLUMEID_ISWRAID ### config FEATURE_VOLUMEID_ISWRAID
bool "intel raid" ### bool "intel raid"
default n ### default n
depends on VOLUMEID ### depends on VOLUMEID
help ### help
TODO ### TODO
config FEATURE_VOLUMEID_LSIRAID ### config FEATURE_VOLUMEID_LSIRAID
bool "lsi raid" ### bool "lsi raid"
default n ### default n
depends on VOLUMEID ### depends on VOLUMEID
help ### help
TODO ### TODO
config FEATURE_VOLUMEID_VIARAID ### config FEATURE_VOLUMEID_VIARAID
bool "via raid" ### bool "via raid"
default n ### default n
depends on VOLUMEID ### depends on VOLUMEID
help ### help
TODO ### TODO
config FEATURE_VOLUMEID_SILICONRAID ### config FEATURE_VOLUMEID_SILICONRAID
bool "silicon raid" ### bool "silicon raid"
default n ### default n
depends on VOLUMEID ### depends on VOLUMEID
help ### help
TODO ### TODO
config FEATURE_VOLUMEID_NVIDIARAID ### config FEATURE_VOLUMEID_NVIDIARAID
bool "nvidia raid" ### bool "nvidia raid"
default n ### default n
depends on VOLUMEID ### depends on VOLUMEID
help ### help
TODO ### TODO
config FEATURE_VOLUMEID_PROMISERAID ### config FEATURE_VOLUMEID_PROMISERAID
bool "promise raid" ### bool "promise raid"
default n ### default n
depends on VOLUMEID ### depends on VOLUMEID
help ### help
TODO ### TODO
config FEATURE_VOLUMEID_LINUXRAID config FEATURE_VOLUMEID_LINUXRAID
bool "linuxraid" bool "linuxraid"

View File

@ -13,30 +13,29 @@ lib-$(CONFIG_VOLUMEID) += volume_id.o util.o
lib-$(CONFIG_FEATURE_VOLUMEID_EXT) += ext.o lib-$(CONFIG_FEATURE_VOLUMEID_EXT) += ext.o
lib-$(CONFIG_FEATURE_VOLUMEID_FAT) += fat.o lib-$(CONFIG_FEATURE_VOLUMEID_FAT) += fat.o
lib-$(CONFIG_FEATURE_VOLUMEID_HFS) += hfs.o lib-$(CONFIG_FEATURE_VOLUMEID_HFS) += hfs.o
lib-$(CONFIG_FEATURE_VOLUMEID_HIGHPOINTRAID) += highpoint.o ### lib-$(CONFIG_FEATURE_VOLUMEID_HIGHPOINTRAID) += highpoint.o
lib-$(CONFIG_FEATURE_VOLUMEID_ISWRAID) += isw_raid.o ### lib-$(CONFIG_FEATURE_VOLUMEID_ISWRAID) += isw_raid.o
lib-$(CONFIG_FEATURE_VOLUMEID_LSIRAID) += lsi_raid.o ### lib-$(CONFIG_FEATURE_VOLUMEID_LSIRAID) += lsi_raid.o
lib-$(CONFIG_FEATURE_VOLUMEID_VIARAID) += via_raid.o ### lib-$(CONFIG_FEATURE_VOLUMEID_VIARAID) += via_raid.o
lib-$(CONFIG_FEATURE_VOLUMEID_SILICONRAID) += silicon_raid.o ### lib-$(CONFIG_FEATURE_VOLUMEID_SILICONRAID) += silicon_raid.o
lib-$(CONFIG_FEATURE_VOLUMEID_NVIDIARAID) += nvidia_raid.o ### lib-$(CONFIG_FEATURE_VOLUMEID_NVIDIARAID) += nvidia_raid.o
lib-$(CONFIG_FEATURE_VOLUMEID_PROMISERAID) += promise_raid.o ### lib-$(CONFIG_FEATURE_VOLUMEID_PROMISERAID) += promise_raid.o
lib-$(CONFIG_FEATURE_VOLUMEID_ISO9660) += iso9660.o lib-$(CONFIG_FEATURE_VOLUMEID_ISO9660) += iso9660.o
lib-$(CONFIG_FEATURE_VOLUMEID_JFS) += jfs.o lib-$(CONFIG_FEATURE_VOLUMEID_JFS) += jfs.o
lib-$(CONFIG_FEATURE_VOLUMEID_LINUXRAID) += linux_raid.o lib-$(CONFIG_FEATURE_VOLUMEID_LINUXRAID) += linux_raid.o
lib-$(CONFIG_FEATURE_VOLUMEID_LINUXSWAP) += linux_swap.o lib-$(CONFIG_FEATURE_VOLUMEID_LINUXSWAP) += linux_swap.o
lib-$(CONFIG_FEATURE_VOLUMEID_LVM) += lvm.o ### lib-$(CONFIG_FEATURE_VOLUMEID_LVM) += lvm.o
### unused
### lib-$(CONFIG_FEATURE_VOLUMEID_MAC) += mac.o ### lib-$(CONFIG_FEATURE_VOLUMEID_MAC) += mac.o
### lib-$(CONFIG_FEATURE_VOLUMEID_MSDOS) += msdos.o ### lib-$(CONFIG_FEATURE_VOLUMEID_MSDOS) += msdos.o
lib-$(CONFIG_FEATURE_VOLUMEID_NTFS) += ntfs.o lib-$(CONFIG_FEATURE_VOLUMEID_NTFS) += ntfs.o
lib-$(CONFIG_FEATURE_VOLUMEID_REISERFS) += reiserfs.o lib-$(CONFIG_FEATURE_VOLUMEID_REISERFS) += reiserfs.o
lib-$(CONFIG_FEATURE_VOLUMEID_UDF) += udf.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_XFS) += xfs.o
lib-$(CONFIG_FEATURE_VOLUMEID_CRAMFS) += cramfs.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_ROMFS) += romfs.o
lib-$(CONFIG_FEATURE_VOLUMEID_SYSV) += sysv.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_LUKS) += luks.o
lib-$(CONFIG_FEATURE_VOLUMEID_OCFS2) += ocfs2.o lib-$(CONFIG_FEATURE_VOLUMEID_OCFS2) += ocfs2.o

View File

@ -243,8 +243,8 @@ dev_get_major_minor(char *device_name, int *major, int *minor)
colon = strchr(dev, ':'); colon = strchr(dev, ':');
if (!colon) if (!colon)
goto ret; goto ret;
*major = strtol(dev, NULL, 10); *major = bb_strtou(dev, NULL, 10);
*minor = strtol(colon + 1, NULL, 10); *minor = bb_strtou(colon + 1, NULL, 10);
ret: ret:
free(dev_path); free(dev_path);
@ -261,27 +261,28 @@ uuidcache_init_cdroms(void)
proccd = fopen(PROC_CDROMS, "r"); proccd = fopen(PROC_CDROMS, "r");
if (!proccd) { if (!proccd) {
static smallint warn = 0; // static smallint warn = 0;
if (!warn) { // if (!warn) {
warn = 1; // warn = 1;
bb_error_msg("mount: could not open %s, so UUID and LABEL " // bb_error_msg("can't open %s, UUID and LABEL "
"conversion cannot be done for CD-Roms.", // "conversion cannot be done for CD-Roms",
PROC_CDROMS); // PROC_CDROMS);
} // }
return; return;
} }
while (fgets(line, sizeof(line), proccd)) { 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) { if (strncmp(line, drive_name_string, sizeof(drive_name_string) - 1) == 0) {
char *device_name; 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; ma = mi = -1;
dev_get_major_minor(device_name, &ma, &mi); dev_get_major_minor(device_name, &ma, &mi);
uuidcache_check_device(device_name, ma, mi, 1); uuidcache_check_device(device_name, ma, mi, 1);
device_name = strtok(NULL, "\t\n"); device_name = strtok(NULL, " \t\n");
} }
break; break;
} }
@ -418,7 +419,8 @@ char *get_devname_from_uuid(const char *spec)
uuidcache_init(); uuidcache_init();
uc = uuidCache; uc = uuidCache;
while (uc) { 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); return xstrdup(uc->device);
} }
uc = uc->next; uc = uc->next;

View File

@ -80,7 +80,7 @@ struct ocfs2_super_block {
uint8_t s_uuid[OCFS2_VOL_UUID_LEN]; /* 128-bit uuid */ uint8_t s_uuid[OCFS2_VOL_UUID_LEN]; /* 128-bit uuid */
} __attribute__((__packed__)); } __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; struct ocfs2_super_block *os;

View File

@ -36,17 +36,14 @@ struct lvm2_super_block {
int volume_id_probe_lvm1(struct volume_id *id, uint64_t off) int volume_id_probe_lvm1(struct volume_id *id, uint64_t off)
{ {
const uint8_t *buf;
struct lvm1_super_block *lvm; struct lvm1_super_block *lvm;
dbg("probing at offset 0x%llx", (unsigned long long) off); dbg("probing at offset 0x%llx", (unsigned long long) off);
buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800); lvm = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800);
if (buf == NULL) if (lvm == NULL)
return -1; return -1;
lvm = (struct lvm1_super_block *) buf;
if (lvm->id[0] != 'H' || lvm->id[1] != 'M') if (lvm->id[0] != 'H' || lvm->id[1] != 'M')
return -1; return -1;

View File

@ -49,17 +49,18 @@ int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off)
return -1; return -1;
part = (struct mac_partition *) buf; part = (struct mac_partition *) buf;
if ((memcmp(part->signature, "PM", 2) == 0) && if (part->signature[0] == 'P' && part->signature[1] == 'M' /* "PM" */
(memcmp(part->type, "Apple_partition_map", 19) == 0)) { && (memcmp(part->type, "Apple_partition_map", 19) == 0)
) {
/* linux creates an own subdevice for the map /* linux creates an own subdevice for the map
* just return the type if the drive header is missing */ * just return the type if the drive header is missing */
volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); // volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE);
id->type = "mac_partition_map"; // id->type = "mac_partition_map";
return 0; return 0;
} }
driver = (struct mac_driver_desc *) buf; 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 /* we are on a main device, like a CD
* just try to probe the first partition from the map */ * just try to probe the first partition from the map */
unsigned bsize = be16_to_cpu(driver->block_size); 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; return -1;
part = (struct mac_partition *) buf; 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; return -1;
part_count = be32_to_cpu(part->map_count); 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) if (id->partitions != NULL)
free(id->partitions); free(id->partitions);
id->partitions = id->partitions = xzalloc(part_count * sizeof(struct volume_id_partition));
malloc(part_count * sizeof(struct volume_id_partition));
if (id->partitions == NULL)
return -1;
memset(id->partitions, 0x00, sizeof(struct volume_id_partition));
id->partition_count = part_count; 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; return -1;
part = (struct mac_partition *) buf; 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; return -1;
poff = be32_to_cpu(part->start_block) * bsize; poff = be32_to_cpu(part->start_block) * bsize;
plen = be32_to_cpu(part->block_count) * bsize; plen = be32_to_cpu(part->block_count) * bsize;
dbg("found '%s' partition entry at 0x%llx, len 0x%llx", dbg("found '%s' partition entry at 0x%llx, len 0x%llx",
part->type, (unsigned long long) poff, (unsigned long long) plen); part->type, (unsigned long long) poff,
(unsigned long long) plen);
id->partitions[i].off = poff; // id->partitions[i].pt_off = poff;
id->partitions[i].len = plen; // id->partitions[i].pt_len = plen;
if (memcmp(part->type, "Apple_Free", 10) == 0) { // if (memcmp(part->type, "Apple_Free", 10) == 0) {
volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNUSED); // volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNUSED);
} else if (memcmp(part->type, "Apple_partition_map", 19) == 0) { // } else if (memcmp(part->type, "Apple_partition_map", 19) == 0) {
volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_PARTITIONTABLE); // volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_PARTITIONTABLE);
} else { // } else {
volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNPROBED); // volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNPROBED);
} // }
} }
volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); // volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE);
id->type = "mac_partition_map"; // id->type = "mac_partition_map";
return 0; return 0;
} }

View File

@ -33,7 +33,6 @@ struct msdos_partition_entry {
uint32_t nr_sects; uint32_t nr_sects;
} __attribute__((packed)); } __attribute__((packed));
#define MSDOS_MAGIC "\x55\xaa"
#define MSDOS_PARTTABLE_OFFSET 0x1be #define MSDOS_PARTTABLE_OFFSET 0x1be
#define MSDOS_SIG_OFF 0x1fe #define MSDOS_SIG_OFF 0x1fe
#define BSIZE 0x200 #define BSIZE 0x200
@ -68,7 +67,7 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off)
if (buf == NULL) if (buf == NULL)
return -1; 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; return -1;
/* check flags on all entries for a valid partition table */ /* 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) if (id->partitions != NULL)
free(id->partitions); free(id->partitions);
id->partitions = malloc(VOLUME_ID_PARTITIONS_MAX * id->partitions = xzalloc(VOLUME_ID_PARTITIONS_MAX *
sizeof(struct volume_id_partition)); 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++) { for (i = 0; i < 4; i++) {
poff = (uint64_t) le32_to_cpu(part[i].start_sect) * BSIZE; 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 = &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)) { if (is_extended(part[i].sys_ind)) {
dbg("found extended partition at 0x%llx", (unsigned long long) poff); dbg("found extended partition at 0x%llx", (unsigned long long) poff);
volume_id_set_usage_part(p, VOLUME_ID_PARTITIONTABLE); // volume_id_set_usage_part(p, VOLUME_ID_PARTITIONTABLE);
p->type = "msdos_extended_partition"; // p->type = "msdos_extended_partition";
if (extended == 0) if (extended == 0)
extended = off + poff; extended = off + poff;
} else { } else {
dbg("found 0x%x data partition at 0x%llx, len 0x%llx", dbg("found 0x%x data partition at 0x%llx, len 0x%llx",
part[i].sys_ind, (unsigned long long) poff, (unsigned long long) plen); part[i].sys_ind, (unsigned long long) poff, (unsigned long long) plen);
if (is_raid(part[i].sys_ind)) // if (is_raid(part[i].sys_ind))
volume_id_set_usage_part(p, VOLUME_ID_RAID); // volume_id_set_usage_part(p, VOLUME_ID_RAID);
else // else
volume_id_set_usage_part(p, VOLUME_ID_UNPROBED); // volume_id_set_usage_part(p, VOLUME_ID_UNPROBED);
} }
p->off = off + poff; // p->pt_off = off + poff;
p->len = plen; // p->pt_len = plen;
id->partition_count = i+1; 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]; 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; break;
next = 0; 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); part[i].sys_ind, (unsigned long long) poff, (unsigned long long) plen);
/* we always start at the 5th entry */ /* we always start at the 5th entry */
while (id->partition_count < 4) // while (id->partition_count < 4)
volume_id_set_usage_part(&id->partitions[id->partition_count++], VOLUME_ID_UNUSED); // 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]; p = &id->partitions[id->partition_count];
if (is_raid(part[i].sys_ind)) // if (is_raid(part[i].sys_ind))
volume_id_set_usage_part(p, VOLUME_ID_RAID); // volume_id_set_usage_part(p, VOLUME_ID_RAID);
else // else
volume_id_set_usage_part(p, VOLUME_ID_UNPROBED); // volume_id_set_usage_part(p, VOLUME_ID_UNPROBED);
p->off = current + poff; // p->pt_off = current + poff;
p->len = plen; // p->pt_len = plen;
id->partition_count++; 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) { if (id->partition_count >= VOLUME_ID_PARTITIONS_MAX) {
dbg("too many partitions"); dbg("too many partitions");
@ -189,8 +186,8 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off)
current = next; current = next;
} }
volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); // volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE);
id->type = "msdos_partition_table"; // id->type = "msdos_partition_table";
return 0; return 0;
} }

View File

@ -53,7 +53,7 @@ int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size)
if (via == NULL) if (via == NULL)
return -1; return -1;
if (via->signature != cpu_to_le16(VIA_SIGNATURE)) if (via->signature != cpu_to_le16(VIA_SIGNATURE))
return -1; return -1;
if (via->version_number > 1) if (via->version_number > 1)

View File

@ -20,6 +20,31 @@
#include "volume_id_internal.h" #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 (*raid_probe_fptr)(struct volume_id *id, uint64_t off, uint64_t size);
typedef int (*probe_fptr)(struct volume_id *id, uint64_t off); 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 #if ENABLE_FEATURE_VOLUMEID_FAT
volume_id_probe_vfat, volume_id_probe_vfat,
#endif #endif
// This one only looks for partitions, we don't use it #if ENABLE_FEATURE_VOLUMEID_MAC
//#if ENABLE_FEATURE_VOLUMEID_MAC volume_id_probe_mac_partition_map,
// volume_id_probe_mac_partition_map, #endif
//#endif
#if ENABLE_FEATURE_VOLUMEID_XFS #if ENABLE_FEATURE_VOLUMEID_XFS
volume_id_probe_xfs, volume_id_probe_xfs,
#endif #endif

View File

@ -163,25 +163,25 @@ void volume_id_free_buffer(struct volume_id *id);
/* RAID */ /* RAID */
int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off); //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_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_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_lvm1(struct volume_id *id, uint64_t off);
int volume_id_probe_lvm2(struct volume_id *id, uint64_t off); //int volume_id_probe_lvm2(struct volume_id *id, uint64_t off);
/* FS */ /* 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_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); 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_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); //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_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); int volume_id_probe_xfs(struct volume_id *id, uint64_t off);