chiark / gitweb /
volume_id: ext - fix endianess in version number
[elogind.git] / extras / volume_id / lib / ext.c
index 51c0011218f5ac1551acdd3d40f62f4d686344a2..8b3af3aab07b995db5ee211b5860f20d376e9680 100644 (file)
@@ -70,12 +70,12 @@ struct ext2_super_block {
 #define EXT3_MIN_BLOCK_SIZE                    0x400
 #define EXT3_MAX_BLOCK_SIZE                    0x1000
 
-int volume_id_probe_ext(struct volume_id *id, uint64_t off)
+int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size)
 {
        struct ext2_super_block *es;
        size_t bsize;
 
-       dbg("probing at offset 0x%llx", (unsigned long long) off);
+       info("probing at offset 0x%llx", (unsigned long long) off);
 
        es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200);
        if (es == NULL)
@@ -94,8 +94,8 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off)
        volume_id_set_label_raw(id, es->s_volume_name, 16);
        volume_id_set_label_string(id, es->s_volume_name, 16);
        volume_id_set_uuid(id, es->s_uuid, UUID_DCE);
-       snprintf(id->type_version, sizeof(id->type_version)-1,
-                "%u.%u", es->s_rev_level, es->s_minor_rev_level);
+       snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u",
+                le32_to_cpu(es->s_rev_level), le16_to_cpu(es->s_minor_rev_level));
 
        /* check for external journal device */
        if ((le32_to_cpu(es->s_feature_incompat) & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) != 0) {