summaryrefslogtreecommitdiff
path: root/extras/volume_id
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-10-06 00:58:04 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 21:37:03 -0700
commit33eae955e24feb2e473b905d64de17ad641e57e0 (patch)
tree646eab72e53ef111378ba5f730fd08080d14cbb1 /extras/volume_id
parent6e3e3c3416864eca74cb885f64c453eb531eed63 (diff)
[PATCH] update volume_id
Here is an update to the latest volume_id which fixes a few bugs with FAT volumes.
Diffstat (limited to 'extras/volume_id')
-rw-r--r--extras/volume_id/volume_id.c38
-rw-r--r--extras/volume_id/volume_id.h3
2 files changed, 24 insertions, 17 deletions
diff --git a/extras/volume_id/volume_id.c b/extras/volume_id/volume_id.c
index 99aed6c96b..f18baec6ee 100644
--- a/extras/volume_id/volume_id.c
+++ b/extras/volume_id/volume_id.c
@@ -321,7 +321,7 @@ static int probe_lvm2(struct volume_id *id, __u64 off)
found:
strncpy(id->type_version, lvm->type, 8);
id->usage_id = VOLUME_ID_RAID;
- id->type_id = VOLUME_ID_LVM1;
+ id->type_id = VOLUME_ID_LVM2;
id->type = "LVM2_member";
return 0;
@@ -461,6 +461,8 @@ static int probe_msdos_part_table(struct volume_id *id, __u64 off)
p = &id->partitions[i];
+ p->partition_type_raw = part[i].sys_ind;
+
if (is_extended(part[i].sys_ind)) {
dbg("found extended partition at 0x%llx", poff);
p->usage_id = VOLUME_ID_PARTITIONTABLE;
@@ -535,6 +537,9 @@ static int probe_msdos_part_table(struct volume_id *id, __u64 off)
p->off = current + poff;
p->len = plen;
id->partition_count++;
+
+ p->partition_type_raw = part[i].sys_ind;
+
if (id->partition_count >= VOLUME_ID_PARTITIONS_MAX) {
dbg("to many partitions");
next = 0;
@@ -918,13 +923,13 @@ valid:
for (i = 0; i <= root_dir_entries; i++) {
/* end marker */
- if (dir[i].attr == 0x00) {
+ if (dir[i].name[0] == 0x00) {
dbg("end of dir");
break;
}
/* empty entry */
- if (dir[i].attr == 0xe5)
+ if (dir[i].name[0] == 0xe5)
continue;
if (dir[i].attr == FAT_ATTR_VOLUME) {
@@ -976,13 +981,13 @@ fat32:
for (i = 0; i <= count; i++) {
/* end marker */
- if (dir[i].attr == 0x00) {
+ if (dir[i].name[0] == 0x00) {
dbg("end of dir");
goto fat32_label;
}
/* empty entry */
- if (dir[i].attr == 0xe5)
+ if (dir[i].name[0] == 0xe5)
continue;
if (dir[i].attr == FAT_ATTR_VOLUME) {
@@ -1016,7 +1021,7 @@ fat32_label:
set_label_raw(id, vs->type.fat32.label, 11);
set_label_string(id, vs->type.fat32.label, 11);
}
- set_uuid(id, vs->type.fat32.serno, UUID_DCE);
+ set_uuid(id, vs->type.fat32.serno, UUID_DOS);
found:
id->usage_id = VOLUME_ID_FILESYSTEM;
@@ -2035,20 +2040,27 @@ int volume_id_probe(struct volume_id *id,
break;
case VOLUME_ID_ALL:
default:
+ /* probe for raid first, cause fs probes may be successful on raid members */
rc = probe_linux_raid(id, off, size);
if (rc == 0)
break;
-
- /* signature in the first block */
- rc = probe_ntfs(id, off);
+ rc = probe_lvm1(id, off);
if (rc == 0)
break;
- rc = probe_vfat(id, off);
+ rc = probe_lvm2(id, off);
if (rc == 0)
break;
+
+ /* signature in the first block, only small buffer needed */
rc = probe_msdos_part_table(id, off);
if (rc == 0)
break;
+ rc = probe_ntfs(id, off);
+ if (rc == 0)
+ break;
+ rc = probe_vfat(id, off);
+ if (rc == 0)
+ break;
rc = probe_mac_partition_map(id, off);
if (rc == 0)
break;
@@ -2083,12 +2095,6 @@ int volume_id_probe(struct volume_id *id,
rc = probe_ufs(id, off);
if (rc == 0)
break;
- rc = probe_lvm1(id, off);
- if (rc == 0)
- break;
- rc = probe_lvm2(id, off);
- if (rc == 0)
- break;
rc = -1;
}
diff --git a/extras/volume_id/volume_id.h b/extras/volume_id/volume_id.h
index e68c42c3cf..c6f52bec41 100644
--- a/extras/volume_id/volume_id.h
+++ b/extras/volume_id/volume_id.h
@@ -21,7 +21,7 @@
#ifndef _VOLUME_ID_H_
#define _VOLUME_ID_H_
-#define VOLUME_ID_VERSION 024
+#define VOLUME_ID_VERSION 25
#define VOLUME_ID_LABEL_SIZE 64
#define VOLUME_ID_UUID_SIZE 16
@@ -68,6 +68,7 @@ struct volume_id_partition {
char *type;
unsigned long long off;
unsigned long long len;
+ unsigned int partition_type_raw;
};
struct volume_id {