chiark / gitweb /
volume_id: rename UUID_64BIT_LE/BE
[elogind.git] / extras / volume_id / lib / fat.c
index 61a94504381275845d6e399fa945238aadb37ad7..6ed16ccee0ea2efa03c82695fdfb7eccd453f759 100644 (file)
@@ -133,7 +133,7 @@ static uint8_t *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int coun
        return NULL;
 }
 
-int volume_id_probe_vfat(struct volume_id *id, uint64_t off)
+int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size)
 {
        struct vfat_super_block *vs;
        struct vfat_dir_entry *dir;
@@ -288,7 +288,7 @@ magic:
                volume_id_set_label_raw(id, vs->type.fat.label, 11);
                volume_id_set_label_string(id, vs->type.fat.label, 11);
        }
-       volume_id_set_uuid(id, vs->type.fat.serno, UUID_DOS);
+       volume_id_set_uuid(id, vs->type.fat.serno, 0, UUID_DOS);
        goto found;
 
 fat32:
@@ -349,7 +349,7 @@ fat32:
 
                /* set next cluster */
                next = le32_to_cpu(*((uint32_t *) buf)) & 0x0fffffff;
-               if (next == 0)
+               if (next < 2 || next >= 0x0ffffff0)
                        break;
        }
        if (maxloop == 0)
@@ -366,7 +366,7 @@ fat32:
                volume_id_set_label_raw(id, vs->type.fat32.label, 11);
                volume_id_set_label_string(id, vs->type.fat32.label, 11);
        }
-       volume_id_set_uuid(id, vs->type.fat32.serno, UUID_DOS);
+       volume_id_set_uuid(id, vs->type.fat32.serno, 0, UUID_DOS);
 
 found:
        volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);