summaryrefslogtreecommitdiff
path: root/extras/volume_id/lib
diff options
context:
space:
mode:
Diffstat (limited to 'extras/volume_id/lib')
-rw-r--r--extras/volume_id/lib/Makefile2
-rw-r--r--extras/volume_id/lib/squashfs.c30
2 files changed, 25 insertions, 7 deletions
diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile
index 0a37c26e8b..ce07d8dd20 100644
--- a/extras/volume_id/lib/Makefile
+++ b/extras/volume_id/lib/Makefile
@@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644
INSTALL_LIB = ${INSTALL} -m 755
SHLIB_CUR = 0
-SHLIB_REV = 79
+SHLIB_REV = 80
SHLIB_AGE = 0
SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE)
diff --git a/extras/volume_id/lib/squashfs.c b/extras/volume_id/lib/squashfs.c
index 99cc78aa41..402a114e1b 100644
--- a/extras/volume_id/lib/squashfs.c
+++ b/extras/volume_id/lib/squashfs.c
@@ -29,7 +29,15 @@
#define SQUASHFS_MAGIC 0x73717368
struct squashfs_super {
- uint32_t s_magic;
+ uint32_t s_magic;
+ uint32_t inodes;
+ uint32_t bytes_used_2;
+ uint32_t uid_start_2;
+ uint32_t guid_start_2;
+ uint32_t inode_table_start_2;
+ uint32_t directory_table_start_2;
+ uint16_t s_major;
+ uint16_t s_minor;
} PACKED;
int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size)
@@ -38,15 +46,25 @@ int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size)
info("probing at offset 0x%llx", (unsigned long long) off);
- sqs = (struct squashfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200);
+ sqs = (struct squashfs_super *) volume_id_get_buffer(id, off, 0x200);
if (sqs == NULL)
return -1;
- if (sqs->s_magic == SQUASHFS_MAGIC || sqs->s_magic == bswap_32(SQUASHFS_MAGIC)) {
- volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
- id->type = "squashfs";
- return 0;
+ if (sqs->s_magic == SQUASHFS_MAGIC) {
+ snprintf(id->type_version, sizeof(id->type_version), "%u.%u",
+ sqs->s_major, sqs->s_minor);
+ goto found;
+ }
+ if (sqs->s_magic == bswap_32(SQUASHFS_MAGIC)) {
+ snprintf(id->type_version, sizeof(id->type_version), "%u.%u",
+ bswap_16(sqs->s_major), bswap_16(sqs->s_minor));
+ goto found;
}
return -1;
+
+found:
+ volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
+ id->type = "squashfs";
+ return 0;
}