]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: swap: report fssize
authorThomas Weißschuh <thomas@t-8ch.de>
Tue, 29 Nov 2022 03:26:02 +0000 (04:26 +0100)
committerThomas Weißschuh <thomas@t-8ch.de>
Wed, 14 Dec 2022 12:01:01 +0000 (12:01 +0000)
libblkid/src/superblocks/swap.c
tests/expected/blkid/low-probe-swap1

index 0d130ae55b8e09e69705109c0c7940c4d345ef22..67224bc634b441ad50b304e354b702462dd59c9b 100644 (file)
@@ -46,6 +46,10 @@ static void swap_set_info_swap1(blkid_probe pr,
 
        uint32_t pagesize = mag->sboff + mag->len;
        blkid_probe_set_fsblocksize(pr, pagesize);
+
+       uint32_t lastpage = endianness == BLKID_ENDIANNESS_LITTLE ?
+               le32_to_cpu(hdr->lastpage) : be32_to_cpu(hdr->lastpage);
+       blkid_probe_set_fssize(pr, (uint64_t) pagesize * lastpage);
 }
 
 static int swap_set_info(blkid_probe pr, const struct blkid_idmag *mag,
index c37eb2c466bc8060e04b0f04326973d2637c37a0..89b2e0ed307085ff73aec3daaa214c43a3c2cab6 100644 (file)
@@ -1,5 +1,6 @@
 ID_FS_ENDIANNESS=LITTLE
 ID_FS_FSBLOCKSIZE=4096
+ID_FS_FSSIZE=258048
 ID_FS_LABEL=SWAP-TEST
 ID_FS_LABEL_ENC=SWAP-TEST
 ID_FS_TYPE=swap