]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: cramfs: report filesystem size
authorThomas Weißschuh <thomas@t-8ch.de>
Mon, 24 Oct 2022 21:19:34 +0000 (23:19 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Mon, 24 Oct 2022 21:19:34 +0000 (23:19 +0200)
libblkid/src/superblocks/cramfs.c
tests/expected/blkid/low-probe-cramfs
tests/expected/blkid/low-probe-cramfs-big

index 76b5611e9a639e0a5b0c9f7d28d2cd63d02ba6f1..8d01d39fcb76b102b5858e79e8b24939d1257e74 100644 (file)
@@ -51,11 +51,11 @@ static uint32_t cfs32_to_cpu(int le, uint32_t value)
                return be32_to_cpu(value);
 }
 
-static int cramfs_verify_csum(blkid_probe pr, const struct blkid_idmag *mag, struct cramfs_super *cs)
+static int cramfs_verify_csum(blkid_probe pr, const struct blkid_idmag *mag,
+               struct cramfs_super *cs, int le)
 {
        uint32_t crc, expected, csummed_size;
        unsigned char *csummed;
-       int le = cramfs_is_little_endian(mag);
 
        if (!(cfs32_to_cpu(le, cs->flags) & CRAMFS_FLAG_FSID_VERSION_2))
                return 1;
@@ -85,10 +85,13 @@ static int probe_cramfs(blkid_probe pr, const struct blkid_idmag *mag)
        if (!cs)
                return errno ? -errno : 1;
 
-       if (!cramfs_verify_csum(pr, mag, cs))
+       int le = cramfs_is_little_endian(mag);
+
+       if (!cramfs_verify_csum(pr, mag, cs, le))
                return 1;
 
        blkid_probe_set_label(pr, cs->name, sizeof(cs->name));
+       blkid_probe_set_fssize(pr, cfs32_to_cpu(le, cs->size));
        return 0;
 }
 
index 7898a36720bed93be4d5df40966a3cf7656fcbde..a82046a9f5b8e7670955ead6d8806385914da15f 100644 (file)
@@ -1,3 +1,4 @@
+ID_FS_FSSIZE=4096
 ID_FS_LABEL=test-cram
 ID_FS_LABEL_ENC=test-cram
 ID_FS_TYPE=cramfs
index c7a2a3ee8b4a5d48421dc82ee301fe7e6560bc67..9a4dfca7be758ba74cbae58280fa3386231f9e4c 100644 (file)
@@ -1,3 +1,4 @@
+ID_FS_FSSIZE=4096
 ID_FS_LABEL=Compressed
 ID_FS_LABEL_ENC=Compressed
 ID_FS_TYPE=cramfs