diff options
Diffstat (limited to 'util-linux/volume_id/fat.c')
-rw-r--r-- | util-linux/volume_id/fat.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/util-linux/volume_id/fat.c b/util-linux/volume_id/fat.c index 816d69d4c..0e0a57d62 100644 --- a/util-linux/volume_id/fat.c +++ b/util-linux/volume_id/fat.c | |||
@@ -245,7 +245,7 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t fat_partition_off) | |||
245 | buf_size = dir_entries * sizeof(struct vfat_dir_entry); | 245 | buf_size = dir_entries * sizeof(struct vfat_dir_entry); |
246 | buf = volume_id_get_buffer(id, fat_partition_off + root_start_off, buf_size); | 246 | buf = volume_id_get_buffer(id, fat_partition_off + root_start_off, buf_size); |
247 | if (buf == NULL) | 247 | if (buf == NULL) |
248 | goto found; | 248 | goto ret; |
249 | 249 | ||
250 | label = get_attr_volume_id((struct vfat_dir_entry*) buf, dir_entries); | 250 | label = get_attr_volume_id((struct vfat_dir_entry*) buf, dir_entries); |
251 | 251 | ||
@@ -261,7 +261,7 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t fat_partition_off) | |||
261 | volume_id_set_label_string(id, vs->type.fat.label, 11); | 261 | volume_id_set_label_string(id, vs->type.fat.label, 11); |
262 | } | 262 | } |
263 | volume_id_set_uuid(id, vs->type.fat.serno, UUID_DOS); | 263 | volume_id_set_uuid(id, vs->type.fat.serno, UUID_DOS); |
264 | goto found; | 264 | goto ret; |
265 | 265 | ||
266 | fat32: | 266 | fat32: |
267 | /* FAT32 root dir is a cluster chain like any other directory */ | 267 | /* FAT32 root dir is a cluster chain like any other directory */ |
@@ -272,20 +272,20 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t fat_partition_off) | |||
272 | next_cluster = root_cluster; | 272 | next_cluster = root_cluster; |
273 | maxloop = 100; | 273 | maxloop = 100; |
274 | while (--maxloop) { | 274 | while (--maxloop) { |
275 | uint32_t next_off_sct; | 275 | uint64_t next_off_sct; |
276 | uint64_t next_off; | 276 | uint64_t next_off; |
277 | uint64_t fat_entry_off; | 277 | uint64_t fat_entry_off; |
278 | int count; | 278 | int count; |
279 | 279 | ||
280 | dbg("next_cluster 0x%x", (unsigned)next_cluster); | 280 | dbg("next_cluster 0x%x", (unsigned)next_cluster); |
281 | next_off_sct = (next_cluster - 2) * vs->sectors_per_cluster; | 281 | next_off_sct = (uint64_t)(next_cluster - 2) * vs->sectors_per_cluster; |
282 | next_off = (start_data_sct + next_off_sct) * sector_size_bytes; | 282 | next_off = (start_data_sct + next_off_sct) * sector_size_bytes; |
283 | dbg("cluster offset 0x%llx", (unsigned long long) next_off); | 283 | dbg("cluster offset 0x%llx", (unsigned long long) next_off); |
284 | 284 | ||
285 | /* get cluster */ | 285 | /* get cluster */ |
286 | buf = volume_id_get_buffer(id, fat_partition_off + next_off, buf_size); | 286 | buf = volume_id_get_buffer(id, fat_partition_off + next_off, buf_size); |
287 | if (buf == NULL) | 287 | if (buf == NULL) |
288 | goto found; | 288 | goto ret; |
289 | 289 | ||
290 | dir = (struct vfat_dir_entry*) buf; | 290 | dir = (struct vfat_dir_entry*) buf; |
291 | count = buf_size / sizeof(struct vfat_dir_entry); | 291 | count = buf_size / sizeof(struct vfat_dir_entry); |
@@ -300,7 +300,7 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t fat_partition_off) | |||
300 | dbg("fat_entry_off 0x%llx", (unsigned long long)fat_entry_off); | 300 | dbg("fat_entry_off 0x%llx", (unsigned long long)fat_entry_off); |
301 | buf = volume_id_get_buffer(id, fat_partition_off + fat_entry_off, buf_size); | 301 | buf = volume_id_get_buffer(id, fat_partition_off + fat_entry_off, buf_size); |
302 | if (buf == NULL) | 302 | if (buf == NULL) |
303 | goto found; | 303 | goto ret; |
304 | 304 | ||
305 | /* set next cluster */ | 305 | /* set next cluster */ |
306 | next_cluster = le32_to_cpu(*(uint32_t*)buf) & 0x0fffffff; | 306 | next_cluster = le32_to_cpu(*(uint32_t*)buf) & 0x0fffffff; |
@@ -323,7 +323,7 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t fat_partition_off) | |||
323 | } | 323 | } |
324 | volume_id_set_uuid(id, vs->type.fat32.serno, UUID_DOS); | 324 | volume_id_set_uuid(id, vs->type.fat32.serno, UUID_DOS); |
325 | 325 | ||
326 | found: | 326 | ret: |
327 | // volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); | 327 | // volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); |
328 | // id->type = "vfat"; | 328 | // id->type = "vfat"; |
329 | 329 | ||