diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-02-15 05:51:19 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-02-15 05:51:19 +0000 |
commit | 28ea4298e380d73203890c0f42de68e9798396d8 (patch) | |
tree | 55c832fd42d8838f9d5f40d2b97bae93263e19e1 | |
parent | 93b38208d1e7d759b3c8ed8e7eb91c10442033ff (diff) | |
download | busybox-w32-28ea4298e380d73203890c0f42de68e9798396d8.tar.gz busybox-w32-28ea4298e380d73203890c0f42de68e9798396d8.tar.bz2 busybox-w32-28ea4298e380d73203890c0f42de68e9798396d8.zip |
volume_id: abort early on read failures.
should help with probing missing fdd's
-rw-r--r-- | util-linux/volume_id/cramfs.c | 3 | ||||
-rw-r--r-- | util-linux/volume_id/ext.c | 3 | ||||
-rw-r--r-- | util-linux/volume_id/fat.c | 3 | ||||
-rw-r--r-- | util-linux/volume_id/get_devname.c | 2 | ||||
-rw-r--r-- | util-linux/volume_id/hfs.c | 3 | ||||
-rw-r--r-- | util-linux/volume_id/iso9660.c | 3 | ||||
-rw-r--r-- | util-linux/volume_id/jfs.c | 3 | ||||
-rw-r--r-- | util-linux/volume_id/linux_raid.c | 3 | ||||
-rw-r--r-- | util-linux/volume_id/linux_swap.c | 3 | ||||
-rw-r--r-- | util-linux/volume_id/luks.c | 3 | ||||
-rw-r--r-- | util-linux/volume_id/ntfs.c | 3 | ||||
-rw-r--r-- | util-linux/volume_id/ocfs2.c | 3 | ||||
-rw-r--r-- | util-linux/volume_id/reiserfs.c | 3 | ||||
-rw-r--r-- | util-linux/volume_id/romfs.c | 3 | ||||
-rw-r--r-- | util-linux/volume_id/sysv.c | 3 | ||||
-rw-r--r-- | util-linux/volume_id/udf.c | 3 | ||||
-rw-r--r-- | util-linux/volume_id/util.c | 12 | ||||
-rw-r--r-- | util-linux/volume_id/volume_id.c | 42 | ||||
-rw-r--r-- | util-linux/volume_id/volume_id_internal.h | 65 | ||||
-rw-r--r-- | util-linux/volume_id/xfs.c | 3 |
20 files changed, 99 insertions, 70 deletions
diff --git a/util-linux/volume_id/cramfs.c b/util-linux/volume_id/cramfs.c index 63b0c7cad..dd939e494 100644 --- a/util-linux/volume_id/cramfs.c +++ b/util-linux/volume_id/cramfs.c | |||
@@ -35,8 +35,9 @@ struct cramfs_super { | |||
35 | uint8_t name[16]; | 35 | uint8_t name[16]; |
36 | } __attribute__((__packed__)); | 36 | } __attribute__((__packed__)); |
37 | 37 | ||
38 | int volume_id_probe_cramfs(struct volume_id *id, uint64_t off) | 38 | int volume_id_probe_cramfs(struct volume_id *id /*,uint64_t off*/) |
39 | { | 39 | { |
40 | #define off ((uint64_t)0) | ||
40 | struct cramfs_super *cs; | 41 | struct cramfs_super *cs; |
41 | 42 | ||
42 | dbg("probing at offset 0x%llx", (unsigned long long) off); | 43 | dbg("probing at offset 0x%llx", (unsigned long long) off); |
diff --git a/util-linux/volume_id/ext.c b/util-linux/volume_id/ext.c index db29dae70..b052e04ce 100644 --- a/util-linux/volume_id/ext.c +++ b/util-linux/volume_id/ext.c | |||
@@ -43,8 +43,9 @@ struct ext2_super_block { | |||
43 | #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 | 43 | #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 |
44 | #define EXT_SUPERBLOCK_OFFSET 0x400 | 44 | #define EXT_SUPERBLOCK_OFFSET 0x400 |
45 | 45 | ||
46 | int volume_id_probe_ext(struct volume_id *id, uint64_t off) | 46 | int volume_id_probe_ext(struct volume_id *id /*,uint64_t off*/) |
47 | { | 47 | { |
48 | #define off ((uint64_t)0) | ||
48 | struct ext2_super_block *es; | 49 | struct ext2_super_block *es; |
49 | 50 | ||
50 | dbg("ext: probing at offset 0x%llx", (unsigned long long) off); | 51 | dbg("ext: probing at offset 0x%llx", (unsigned long long) off); |
diff --git a/util-linux/volume_id/fat.c b/util-linux/volume_id/fat.c index 0e0a57d62..352040f57 100644 --- a/util-linux/volume_id/fat.c +++ b/util-linux/volume_id/fat.c | |||
@@ -119,8 +119,9 @@ static uint8_t *get_attr_volume_id(struct vfat_dir_entry *dir, int count) | |||
119 | return NULL; | 119 | return NULL; |
120 | } | 120 | } |
121 | 121 | ||
122 | int volume_id_probe_vfat(struct volume_id *id, uint64_t fat_partition_off) | 122 | int volume_id_probe_vfat(struct volume_id *id /*,uint64_t fat_partition_off*/) |
123 | { | 123 | { |
124 | #define fat_partition_off ((uint64_t)0) | ||
124 | struct vfat_super_block *vs; | 125 | struct vfat_super_block *vs; |
125 | struct vfat_dir_entry *dir; | 126 | struct vfat_dir_entry *dir; |
126 | uint16_t sector_size_bytes; | 127 | uint16_t sector_size_bytes; |
diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c index d82808fa2..45a4aeea9 100644 --- a/util-linux/volume_id/get_devname.c +++ b/util-linux/volume_id/get_devname.c | |||
@@ -37,7 +37,7 @@ get_label_uuid(int fd, char **label, char **uuid) | |||
37 | if (ioctl(/*vid->*/fd, BLKGETSIZE64, &size) != 0) | 37 | if (ioctl(/*vid->*/fd, BLKGETSIZE64, &size) != 0) |
38 | size = 0; | 38 | size = 0; |
39 | 39 | ||
40 | if (volume_id_probe_all(vid, 0, size) != 0) | 40 | if (volume_id_probe_all(vid, /*0,*/ size) != 0) |
41 | goto ret; | 41 | goto ret; |
42 | 42 | ||
43 | if (vid->label[0] != '\0' || vid->uuid[0] != '\0') { | 43 | if (vid->label[0] != '\0' || vid->uuid[0] != '\0') { |
diff --git a/util-linux/volume_id/hfs.c b/util-linux/volume_id/hfs.c index 79658e4fa..f99b895c4 100644 --- a/util-linux/volume_id/hfs.c +++ b/util-linux/volume_id/hfs.c | |||
@@ -131,8 +131,9 @@ struct hfsplus_vol_header { | |||
131 | #define HFS_NODE_LEAF 0xff | 131 | #define HFS_NODE_LEAF 0xff |
132 | #define HFSPLUS_POR_CNID 1 | 132 | #define HFSPLUS_POR_CNID 1 |
133 | 133 | ||
134 | int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off) | 134 | int volume_id_probe_hfs_hfsplus(struct volume_id *id /*,uint64_t off*/) |
135 | { | 135 | { |
136 | uint64_t off = 0; | ||
136 | unsigned blocksize; | 137 | unsigned blocksize; |
137 | unsigned cat_block; | 138 | unsigned cat_block; |
138 | unsigned ext_block_start; | 139 | unsigned ext_block_start; |
diff --git a/util-linux/volume_id/iso9660.c b/util-linux/volume_id/iso9660.c index c15608ce0..82f5e4846 100644 --- a/util-linux/volume_id/iso9660.c +++ b/util-linux/volume_id/iso9660.c | |||
@@ -47,8 +47,9 @@ struct high_sierra_volume_descriptor { | |||
47 | uint8_t version; | 47 | uint8_t version; |
48 | } __attribute__((__packed__)); | 48 | } __attribute__((__packed__)); |
49 | 49 | ||
50 | int volume_id_probe_iso9660(struct volume_id *id, uint64_t off) | 50 | int volume_id_probe_iso9660(struct volume_id *id /*,uint64_t off*/) |
51 | { | 51 | { |
52 | #define off ((uint64_t)0) | ||
52 | uint8_t *buf; | 53 | uint8_t *buf; |
53 | struct iso_volume_descriptor *is; | 54 | struct iso_volume_descriptor *is; |
54 | struct high_sierra_volume_descriptor *hs; | 55 | struct high_sierra_volume_descriptor *hs; |
diff --git a/util-linux/volume_id/jfs.c b/util-linux/volume_id/jfs.c index 63692f946..4c39e537a 100644 --- a/util-linux/volume_id/jfs.c +++ b/util-linux/volume_id/jfs.c | |||
@@ -35,8 +35,9 @@ struct jfs_super_block { | |||
35 | 35 | ||
36 | #define JFS_SUPERBLOCK_OFFSET 0x8000 | 36 | #define JFS_SUPERBLOCK_OFFSET 0x8000 |
37 | 37 | ||
38 | int volume_id_probe_jfs(struct volume_id *id, uint64_t off) | 38 | int volume_id_probe_jfs(struct volume_id *id /*,uint64_t off*/) |
39 | { | 39 | { |
40 | #define off ((uint64_t)0) | ||
40 | struct jfs_super_block *js; | 41 | struct jfs_super_block *js; |
41 | 42 | ||
42 | dbg("probing at offset 0x%llx", (unsigned long long) off); | 43 | dbg("probing at offset 0x%llx", (unsigned long long) off); |
diff --git a/util-linux/volume_id/linux_raid.c b/util-linux/volume_id/linux_raid.c index 0877b8ad2..cc024692c 100644 --- a/util-linux/volume_id/linux_raid.c +++ b/util-linux/volume_id/linux_raid.c | |||
@@ -42,8 +42,9 @@ struct mdp_super_block { | |||
42 | #define MD_RESERVED_BYTES 0x10000 | 42 | #define MD_RESERVED_BYTES 0x10000 |
43 | #define MD_MAGIC 0xa92b4efc | 43 | #define MD_MAGIC 0xa92b4efc |
44 | 44 | ||
45 | int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size) | 45 | int volume_id_probe_linux_raid(struct volume_id *id /*,uint64_t off*/, uint64_t size) |
46 | { | 46 | { |
47 | #define off ((uint64_t)0) | ||
47 | uint64_t sboff; | 48 | uint64_t sboff; |
48 | uint8_t uuid[16]; | 49 | uint8_t uuid[16]; |
49 | struct mdp_super_block *mdp; | 50 | struct mdp_super_block *mdp; |
diff --git a/util-linux/volume_id/linux_swap.c b/util-linux/volume_id/linux_swap.c index e6084542f..c9b62e9bf 100644 --- a/util-linux/volume_id/linux_swap.c +++ b/util-linux/volume_id/linux_swap.c | |||
@@ -31,8 +31,9 @@ struct swap_header_v1_2 { | |||
31 | 31 | ||
32 | #define LARGEST_PAGESIZE 0x4000 | 32 | #define LARGEST_PAGESIZE 0x4000 |
33 | 33 | ||
34 | int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off) | 34 | int volume_id_probe_linux_swap(struct volume_id *id /*,uint64_t off*/) |
35 | { | 35 | { |
36 | #define off ((uint64_t)0) | ||
36 | struct swap_header_v1_2 *sw; | 37 | struct swap_header_v1_2 *sw; |
37 | const uint8_t *buf; | 38 | const uint8_t *buf; |
38 | unsigned page; | 39 | unsigned page; |
diff --git a/util-linux/volume_id/luks.c b/util-linux/volume_id/luks.c index b0f0f5b21..ebc7d160d 100644 --- a/util-linux/volume_id/luks.c +++ b/util-linux/volume_id/luks.c | |||
@@ -80,8 +80,9 @@ struct BUG_bad_size_luks_phdr { | |||
80 | 1 : -1]; | 80 | 1 : -1]; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | int volume_id_probe_luks(struct volume_id *id, uint64_t off) | 83 | int volume_id_probe_luks(struct volume_id *id /*,uint64_t off*/) |
84 | { | 84 | { |
85 | #define off ((uint64_t)0) | ||
85 | struct luks_phdr *header; | 86 | struct luks_phdr *header; |
86 | 87 | ||
87 | header = volume_id_get_buffer(id, off, sizeof(*header)); | 88 | header = volume_id_get_buffer(id, off, sizeof(*header)); |
diff --git a/util-linux/volume_id/ntfs.c b/util-linux/volume_id/ntfs.c index 7488a41a3..6e8f1dd3d 100644 --- a/util-linux/volume_id/ntfs.c +++ b/util-linux/volume_id/ntfs.c | |||
@@ -84,8 +84,9 @@ struct volume_info { | |||
84 | #define MFT_RECORD_ATTR_OBJECT_ID 0x40 | 84 | #define MFT_RECORD_ATTR_OBJECT_ID 0x40 |
85 | #define MFT_RECORD_ATTR_END 0xffffffffu | 85 | #define MFT_RECORD_ATTR_END 0xffffffffu |
86 | 86 | ||
87 | int volume_id_probe_ntfs(struct volume_id *id, uint64_t off) | 87 | int volume_id_probe_ntfs(struct volume_id *id /*,uint64_t off*/) |
88 | { | 88 | { |
89 | #define off ((uint64_t)0) | ||
89 | unsigned sector_size; | 90 | unsigned sector_size; |
90 | unsigned cluster_size; | 91 | unsigned cluster_size; |
91 | uint64_t mft_cluster; | 92 | uint64_t mft_cluster; |
diff --git a/util-linux/volume_id/ocfs2.c b/util-linux/volume_id/ocfs2.c index 8bcaac0b7..8417d91bb 100644 --- a/util-linux/volume_id/ocfs2.c +++ b/util-linux/volume_id/ocfs2.c | |||
@@ -80,8 +80,9 @@ struct ocfs2_super_block { | |||
80 | uint8_t s_uuid[OCFS2_VOL_UUID_LEN]; /* 128-bit uuid */ | 80 | uint8_t s_uuid[OCFS2_VOL_UUID_LEN]; /* 128-bit uuid */ |
81 | } __attribute__((__packed__)); | 81 | } __attribute__((__packed__)); |
82 | 82 | ||
83 | int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off) | 83 | int volume_id_probe_ocfs2(struct volume_id *id /*,uint64_t off*/) |
84 | { | 84 | { |
85 | #define off ((uint64_t)0) | ||
85 | struct ocfs2_super_block *os; | 86 | struct ocfs2_super_block *os; |
86 | 87 | ||
87 | dbg("probing at offset 0x%llx", (unsigned long long) off); | 88 | dbg("probing at offset 0x%llx", (unsigned long long) off); |
diff --git a/util-linux/volume_id/reiserfs.c b/util-linux/volume_id/reiserfs.c index d9a37457b..b8cdc9809 100644 --- a/util-linux/volume_id/reiserfs.c +++ b/util-linux/volume_id/reiserfs.c | |||
@@ -48,8 +48,9 @@ struct reiser4_super_block { | |||
48 | #define REISERFS1_SUPERBLOCK_OFFSET 0x2000 | 48 | #define REISERFS1_SUPERBLOCK_OFFSET 0x2000 |
49 | #define REISERFS_SUPERBLOCK_OFFSET 0x10000 | 49 | #define REISERFS_SUPERBLOCK_OFFSET 0x10000 |
50 | 50 | ||
51 | int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off) | 51 | int volume_id_probe_reiserfs(struct volume_id *id /*,uint64_t off*/) |
52 | { | 52 | { |
53 | #define off ((uint64_t)0) | ||
53 | struct reiserfs_super_block *rs; | 54 | struct reiserfs_super_block *rs; |
54 | struct reiser4_super_block *rs4; | 55 | struct reiser4_super_block *rs4; |
55 | 56 | ||
diff --git a/util-linux/volume_id/romfs.c b/util-linux/volume_id/romfs.c index 400bdce2c..2c061bdfc 100644 --- a/util-linux/volume_id/romfs.c +++ b/util-linux/volume_id/romfs.c | |||
@@ -27,8 +27,9 @@ struct romfs_super { | |||
27 | uint8_t name[0]; | 27 | uint8_t name[0]; |
28 | } __attribute__((__packed__)); | 28 | } __attribute__((__packed__)); |
29 | 29 | ||
30 | int volume_id_probe_romfs(struct volume_id *id, uint64_t off) | 30 | int volume_id_probe_romfs(struct volume_id *id /*,uint64_t off*/) |
31 | { | 31 | { |
32 | #define off ((uint64_t)0) | ||
32 | struct romfs_super *rfs; | 33 | struct romfs_super *rfs; |
33 | 34 | ||
34 | dbg("probing at offset 0x%llx", (unsigned long long) off); | 35 | dbg("probing at offset 0x%llx", (unsigned long long) off); |
diff --git a/util-linux/volume_id/sysv.c b/util-linux/volume_id/sysv.c index 76719623b..165033258 100644 --- a/util-linux/volume_id/sysv.c +++ b/util-linux/volume_id/sysv.c | |||
@@ -83,8 +83,9 @@ struct xenix_super { | |||
83 | #define XENIX_MAGIC 0x2b5544 | 83 | #define XENIX_MAGIC 0x2b5544 |
84 | #define SYSV_MAX_BLOCKSIZE 0x800 | 84 | #define SYSV_MAX_BLOCKSIZE 0x800 |
85 | 85 | ||
86 | int volume_id_probe_sysv(struct volume_id *id, uint64_t off) | 86 | int volume_id_probe_sysv(struct volume_id *id /*,uint64_t off*/) |
87 | { | 87 | { |
88 | #define off ((uint64_t)0) | ||
88 | struct sysv_super *vs; | 89 | struct sysv_super *vs; |
89 | struct xenix_super *xs; | 90 | struct xenix_super *xs; |
90 | unsigned boff; | 91 | unsigned boff; |
diff --git a/util-linux/volume_id/udf.c b/util-linux/volume_id/udf.c index 55e97a7e5..e272e1923 100644 --- a/util-linux/volume_id/udf.c +++ b/util-linux/volume_id/udf.c | |||
@@ -55,8 +55,9 @@ struct volume_structure_descriptor { | |||
55 | 55 | ||
56 | #define UDF_VSD_OFFSET 0x8000 | 56 | #define UDF_VSD_OFFSET 0x8000 |
57 | 57 | ||
58 | int volume_id_probe_udf(struct volume_id *id, uint64_t off) | 58 | int volume_id_probe_udf(struct volume_id *id /*,uint64_t off*/) |
59 | { | 59 | { |
60 | #define off ((uint64_t)0) | ||
60 | struct volume_descriptor *vd; | 61 | struct volume_descriptor *vd; |
61 | struct volume_structure_descriptor *vsd; | 62 | struct volume_structure_descriptor *vsd; |
62 | unsigned bs; | 63 | unsigned bs; |
diff --git a/util-linux/volume_id/util.c b/util-linux/volume_id/util.c index 1a1b3f92e..dd75c7ba1 100644 --- a/util-linux/volume_id/util.c +++ b/util-linux/volume_id/util.c | |||
@@ -254,9 +254,15 @@ void *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) | |||
254 | dbg("requested 0x%x bytes, got 0x%x bytes", | 254 | dbg("requested 0x%x bytes, got 0x%x bytes", |
255 | (unsigned) len, (unsigned) read_len); | 255 | (unsigned) len, (unsigned) read_len); |
256 | err: | 256 | err: |
257 | /* id->seekbuf_len or id->sbbuf_len is wrong now! Fixing. | 257 | /* No filesystem can be this tiny. It's most likely |
258 | * Most likely user will not do any additional | 258 | * non-associated loop device, empty drive and so on. |
259 | * calls anyway, it's a corrupted fs or something. */ | 259 | * Flag it, making it possible to short circuit future |
260 | * accesses. Rationale: | ||
261 | * users complained of slow blkid due to empty floppy drives. | ||
262 | */ | ||
263 | if (off < 64*1024) | ||
264 | id->error = 1; | ||
265 | /* id->seekbuf_len or id->sbbuf_len is wrong now! Fixing. */ | ||
260 | volume_id_free_buffer(id); | 266 | volume_id_free_buffer(id); |
261 | return NULL; | 267 | return NULL; |
262 | } | 268 | } |
diff --git a/util-linux/volume_id/volume_id.c b/util-linux/volume_id/volume_id.c index 6852a8203..1acd90596 100644 --- a/util-linux/volume_id/volume_id.c +++ b/util-linux/volume_id/volume_id.c | |||
@@ -45,8 +45,8 @@ | |||
45 | #define ENABLE_FEATURE_VOLUMEID_UFS 0 | 45 | #define ENABLE_FEATURE_VOLUMEID_UFS 0 |
46 | 46 | ||
47 | 47 | ||
48 | typedef int (*raid_probe_fptr)(struct volume_id *id, uint64_t off, uint64_t size); | 48 | typedef int (*raid_probe_fptr)(struct volume_id *id, /*uint64_t off,*/ uint64_t size); |
49 | typedef int (*probe_fptr)(struct volume_id *id, uint64_t off); | 49 | typedef int (*probe_fptr)(struct volume_id *id /*, uint64_t off*/); |
50 | 50 | ||
51 | static const raid_probe_fptr raid1[] = { | 51 | static const raid_probe_fptr raid1[] = { |
52 | #if ENABLE_FEATURE_VOLUMEID_LINUXRAID | 52 | #if ENABLE_FEATURE_VOLUMEID_LINUXRAID |
@@ -150,43 +150,49 @@ static const probe_fptr fs2[] = { | |||
150 | #endif | 150 | #endif |
151 | }; | 151 | }; |
152 | 152 | ||
153 | int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) | 153 | int volume_id_probe_all(struct volume_id *id, /*uint64_t off,*/ uint64_t size) |
154 | { | 154 | { |
155 | unsigned i; | 155 | unsigned i; |
156 | 156 | ||
157 | if (id == NULL) | ||
158 | return -EINVAL; | ||
159 | |||
160 | /* probe for raid first, cause fs probes may be successful on raid members */ | 157 | /* probe for raid first, cause fs probes may be successful on raid members */ |
161 | if (size) { | 158 | if (size) { |
162 | for (i = 0; i < ARRAY_SIZE(raid1); i++) | 159 | for (i = 0; i < ARRAY_SIZE(raid1); i++) { |
163 | if (raid1[i](id, off, size) == 0) | 160 | if (raid1[i](id, /*off,*/ size) == 0) |
161 | goto ret; | ||
162 | if (id->error) | ||
164 | goto ret; | 163 | goto ret; |
164 | } | ||
165 | } | 165 | } |
166 | 166 | ||
167 | for (i = 0; i < ARRAY_SIZE(raid2); i++) | 167 | for (i = 0; i < ARRAY_SIZE(raid2); i++) { |
168 | if (raid2[i](id, off) == 0) | 168 | if (raid2[i](id /*,off*/) == 0) |
169 | goto ret; | 169 | goto ret; |
170 | if (id->error) | ||
171 | goto ret; | ||
172 | } | ||
170 | 173 | ||
171 | /* signature in the first block, only small buffer needed */ | 174 | /* signature in the first block, only small buffer needed */ |
172 | for (i = 0; i < ARRAY_SIZE(fs1); i++) | 175 | for (i = 0; i < ARRAY_SIZE(fs1); i++) { |
173 | if (fs1[i](id, off) == 0) | 176 | if (fs1[i](id /*,off*/) == 0) |
174 | goto ret; | 177 | goto ret; |
178 | if (id->error) | ||
179 | goto ret; | ||
180 | } | ||
175 | 181 | ||
176 | /* fill buffer with maximum */ | 182 | /* fill buffer with maximum */ |
177 | volume_id_get_buffer(id, 0, SB_BUFFER_SIZE); | 183 | volume_id_get_buffer(id, 0, SB_BUFFER_SIZE); |
178 | 184 | ||
179 | for (i = 0; i < ARRAY_SIZE(fs2); i++) | 185 | for (i = 0; i < ARRAY_SIZE(fs2); i++) { |
180 | if (fs2[i](id, off) == 0) | 186 | if (fs2[i](id /*,off*/) == 0) |
181 | goto ret; | 187 | goto ret; |
182 | return -1; | 188 | if (id->error) |
189 | goto ret; | ||
190 | } | ||
183 | 191 | ||
184 | ret: | 192 | ret: |
185 | /* If the filestystem in recognized, we free the allocated buffers, | ||
186 | otherwise they will stay in place for the possible next probe call */ | ||
187 | volume_id_free_buffer(id); | 193 | volume_id_free_buffer(id); |
194 | return (- id->error); /* 0 or -1 */ | ||
188 | 195 | ||
189 | return 0; | ||
190 | } | 196 | } |
191 | 197 | ||
192 | /* open volume by device node */ | 198 | /* open volume by device node */ |
diff --git a/util-linux/volume_id/volume_id_internal.h b/util-linux/volume_id/volume_id_internal.h index fe3547d13..d5258c54f 100644 --- a/util-linux/volume_id/volume_id_internal.h +++ b/util-linux/volume_id/volume_id_internal.h | |||
@@ -63,6 +63,7 @@ struct volume_id_partition { | |||
63 | struct volume_id { | 63 | struct volume_id { |
64 | int fd; | 64 | int fd; |
65 | // int fd_close:1; | 65 | // int fd_close:1; |
66 | int error; | ||
66 | size_t sbbuf_len; | 67 | size_t sbbuf_len; |
67 | size_t seekbuf_len; | 68 | size_t seekbuf_len; |
68 | uint8_t *sbbuf; | 69 | uint8_t *sbbuf; |
@@ -86,7 +87,7 @@ struct volume_id { | |||
86 | }; | 87 | }; |
87 | 88 | ||
88 | struct volume_id *volume_id_open_node(int fd); | 89 | struct volume_id *volume_id_open_node(int fd); |
89 | int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size); | 90 | int volume_id_probe_all(struct volume_id *id, /*uint64_t off,*/ uint64_t size); |
90 | void free_volume_id(struct volume_id *id); | 91 | void free_volume_id(struct volume_id *id); |
91 | 92 | ||
92 | /* util.h */ | 93 | /* util.h */ |
@@ -164,67 +165,67 @@ void volume_id_free_buffer(struct volume_id *id); | |||
164 | 165 | ||
165 | /* RAID */ | 166 | /* RAID */ |
166 | 167 | ||
167 | //int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off); | 168 | //int volume_id_probe_highpoint_37x_raid(struct volume_id *id /*,uint64_t off*/); |
168 | //int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size); | 169 | //int volume_id_probe_highpoint_45x_raid(struct volume_id *id /*,uint64_t off*/, uint64_t size); |
169 | 170 | ||
170 | //int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size); | 171 | //int volume_id_probe_intel_software_raid(struct volume_id *id /*,uint64_t off*/, uint64_t size); |
171 | 172 | ||
172 | int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size); | 173 | int volume_id_probe_linux_raid(struct volume_id *id /*,uint64_t off*/, uint64_t size); |
173 | 174 | ||
174 | //int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size); | 175 | //int volume_id_probe_lsi_mega_raid(struct volume_id *id /*,uint64_t off*/, uint64_t size); |
175 | 176 | ||
176 | //int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size); | 177 | //int volume_id_probe_nvidia_raid(struct volume_id *id /*,uint64_t off*/, uint64_t size); |
177 | 178 | ||
178 | //int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size); | 179 | //int volume_id_probe_promise_fasttrack_raid(struct volume_id *id /*,uint64_t off*/, uint64_t size); |
179 | 180 | ||
180 | //int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size); | 181 | //int volume_id_probe_silicon_medley_raid(struct volume_id *id /*,uint64_t off*/, uint64_t size); |
181 | 182 | ||
182 | //int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size); | 183 | //int volume_id_probe_via_raid(struct volume_id *id /*,uint64_t off*/, uint64_t size); |
183 | 184 | ||
184 | //int volume_id_probe_lvm1(struct volume_id *id, uint64_t off); | 185 | //int volume_id_probe_lvm1(struct volume_id *id /*,uint64_t off*/); |
185 | //int volume_id_probe_lvm2(struct volume_id *id, uint64_t off); | 186 | //int volume_id_probe_lvm2(struct volume_id *id /*,uint64_t off*/); |
186 | 187 | ||
187 | /* FS */ | 188 | /* FS */ |
188 | 189 | ||
189 | int volume_id_probe_cramfs(struct volume_id *id, uint64_t off); | 190 | int volume_id_probe_cramfs(struct volume_id *id /*,uint64_t off*/); |
190 | 191 | ||
191 | int volume_id_probe_ext(struct volume_id *id, uint64_t off); | 192 | int volume_id_probe_ext(struct volume_id *id /*,uint64_t off*/); |
192 | 193 | ||
193 | int volume_id_probe_vfat(struct volume_id *id, uint64_t off); | 194 | int volume_id_probe_vfat(struct volume_id *id /*,uint64_t off*/); |
194 | 195 | ||
195 | int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off); | 196 | int volume_id_probe_hfs_hfsplus(struct volume_id *id /*,uint64_t off*/); |
196 | 197 | ||
197 | //int volume_id_probe_hpfs(struct volume_id *id, uint64_t off); | 198 | //int volume_id_probe_hpfs(struct volume_id *id /*,uint64_t off*/); |
198 | 199 | ||
199 | int volume_id_probe_iso9660(struct volume_id *id, uint64_t off); | 200 | int volume_id_probe_iso9660(struct volume_id *id /*,uint64_t off*/); |
200 | 201 | ||
201 | int volume_id_probe_jfs(struct volume_id *id, uint64_t off); | 202 | int volume_id_probe_jfs(struct volume_id *id /*,uint64_t off*/); |
202 | 203 | ||
203 | int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off); | 204 | int volume_id_probe_linux_swap(struct volume_id *id /*,uint64_t off*/); |
204 | 205 | ||
205 | int volume_id_probe_luks(struct volume_id *id, uint64_t off); | 206 | int volume_id_probe_luks(struct volume_id *id /*,uint64_t off*/); |
206 | 207 | ||
207 | //int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off); | 208 | //int volume_id_probe_mac_partition_map(struct volume_id *id /*,uint64_t off*/); |
208 | 209 | ||
209 | //int volume_id_probe_minix(struct volume_id *id, uint64_t off); | 210 | //int volume_id_probe_minix(struct volume_id *id /*,uint64_t off*/); |
210 | 211 | ||
211 | //int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off); | 212 | //int volume_id_probe_msdos_part_table(struct volume_id *id /*,uint64_t off*/); |
212 | 213 | ||
213 | int volume_id_probe_ntfs(struct volume_id *id, uint64_t off); | 214 | int volume_id_probe_ntfs(struct volume_id *id /*,uint64_t off*/); |
214 | 215 | ||
215 | int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off); | 216 | int volume_id_probe_ocfs2(struct volume_id *id /*,uint64_t off*/); |
216 | 217 | ||
217 | int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off); | 218 | int volume_id_probe_reiserfs(struct volume_id *id /*,uint64_t off*/); |
218 | 219 | ||
219 | int volume_id_probe_romfs(struct volume_id *id, uint64_t off); | 220 | int volume_id_probe_romfs(struct volume_id *id /*,uint64_t off*/); |
220 | 221 | ||
221 | int volume_id_probe_sysv(struct volume_id *id, uint64_t off); | 222 | int volume_id_probe_sysv(struct volume_id *id /*,uint64_t off*/); |
222 | 223 | ||
223 | int volume_id_probe_udf(struct volume_id *id, uint64_t off); | 224 | int volume_id_probe_udf(struct volume_id *id /*,uint64_t off*/); |
224 | 225 | ||
225 | //int volume_id_probe_ufs(struct volume_id *id, uint64_t off); | 226 | //int volume_id_probe_ufs(struct volume_id *id /*,uint64_t off*/); |
226 | 227 | ||
227 | int volume_id_probe_xfs(struct volume_id *id, uint64_t off); | 228 | int volume_id_probe_xfs(struct volume_id *id /*,uint64_t off*/); |
228 | 229 | ||
229 | #if __GNUC_PREREQ(4,1) | 230 | #if __GNUC_PREREQ(4,1) |
230 | # pragma GCC visibility pop | 231 | # pragma GCC visibility pop |
diff --git a/util-linux/volume_id/xfs.c b/util-linux/volume_id/xfs.c index 0d904370d..646c81d3b 100644 --- a/util-linux/volume_id/xfs.c +++ b/util-linux/volume_id/xfs.c | |||
@@ -35,8 +35,9 @@ struct xfs_super_block { | |||
35 | uint64_t fdblocks; | 35 | uint64_t fdblocks; |
36 | } __attribute__((__packed__)); | 36 | } __attribute__((__packed__)); |
37 | 37 | ||
38 | int volume_id_probe_xfs(struct volume_id *id, uint64_t off) | 38 | int volume_id_probe_xfs(struct volume_id *id /*,uint64_t off*/) |
39 | { | 39 | { |
40 | #define off ((uint64_t)0) | ||
40 | struct xfs_super_block *xs; | 41 | struct xfs_super_block *xs; |
41 | 42 | ||
42 | dbg("probing at offset 0x%llx", (unsigned long long) off); | 43 | dbg("probing at offset 0x%llx", (unsigned long long) off); |