From: Thomas Weißschuh Date: Sat, 30 Dec 2023 22:58:23 +0000 (+0100) Subject: libblkid: (bcachefs) compare against offset from idmag X-Git-Tag: v2.40-rc1~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ca466a27fbd4bedb573725d1038d454d15cdd0d9;p=thirdparty%2Futil-linux.git libblkid: (bcachefs) compare against offset from idmag A future patch will introduce more superblock locations which need to use their matching superblock location. Signed-off-by: Thomas Weißschuh --- diff --git a/libblkid/src/superblocks/bcache.c b/libblkid/src/superblocks/bcache.c index 8381528698..1b9ab9325f 100644 --- a/libblkid/src/superblocks/bcache.c +++ b/libblkid/src/superblocks/bcache.c @@ -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)