]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: (bcachefs) compare against offset from idmag
authorThomas Weißschuh <thomas@t-8ch.de>
Sat, 30 Dec 2023 22:58:23 +0000 (23:58 +0100)
committerThomas Weißschuh <thomas@t-8ch.de>
Sun, 31 Dec 2023 12:07:39 +0000 (13:07 +0100)
A future patch will introduce more superblock locations which need to
use their matching superblock location.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
libblkid/src/superblocks/bcache.c

index 83815286989836d8e2f1c611f5e29d7849c991a9..1b9ab9325f965c9d259464c5f0db94037fe1e1ae 100644 (file)
@@ -344,14 +344,15 @@ static int probe_bcachefs(blkid_probe pr, const struct blkid_idmag *mag)
 {
        struct bcachefs_super_block *bcs;
        const unsigned char *sb, *sb_end;
-       uint64_t sb_size, blocksize;
+       uint64_t sb_size, blocksize, offset_sectors;
        uint16_t version;
 
        bcs = blkid_probe_get_sb(pr, mag, struct bcachefs_super_block);
        if (!bcs)
                return errno ? -errno : BLKID_PROBE_NONE;
 
-       if (le64_to_cpu(bcs->offset) != BCACHE_SB_OFF / BCACHEFS_SECTOR_SIZE)
+       offset_sectors = blkid_probe_get_idmag_off(pr, mag) / BCACHEFS_SECTOR_SIZE;
+       if (le64_to_cpu(bcs->offset) != offset_sectors)
                return BLKID_PROBE_NONE;
 
        if (bcs->nr_devices == 0 || bcs->dev_idx >= bcs->nr_devices)