From: Thomas Weißschuh Date: Sun, 9 Jul 2023 18:03:57 +0000 (+0200) Subject: libblkid: (bcachefs) adapt to major.minor version X-Git-Tag: v2.40-rc1~333^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8beea162ce1c2f5a7565044b68434efbb96f0697;p=thirdparty%2Futil-linux.git libblkid: (bcachefs) adapt to major.minor version The version superblock field has been split into a major and minor version part in the upstream code. Adapt libblkid to it. Link: https://lore.kernel.org/linux-bcachefs/20230709171551.2349961-11-kent.overstreet@linux.dev/ Signed-off-by: Thomas Weißschuh --- diff --git a/libblkid/src/superblocks/bcache.c b/libblkid/src/superblocks/bcache.c index bf7fed01fe..1a0c124d37 100644 --- a/libblkid/src/superblocks/bcache.c +++ b/libblkid/src/superblocks/bcache.c @@ -149,6 +149,9 @@ struct bcachefs_super_block { #define BCACHEFS_SB_FIELDS_OFF offsetof(struct bcachefs_super_block, _start) /* tag value for members field */ #define BCACHEFS_SB_FIELD_TYPE_MEMBERS 1 +/* version splitting helpers */ +#define BCH_VERSION_MAJOR(_v) ((uint16_t) ((_v) >> 10)) +#define BCH_VERSION_MINOR(_v) ((uint16_t) ((_v) & ~(~0U << 10))) #define BYTES(f) ((((uint64_t) le32_to_cpu((f)->u64s)) * 8)) @@ -300,6 +303,7 @@ 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; + uint16_t version; bcs = blkid_probe_get_sb(pr, mag, struct bcachefs_super_block); if (!bcs) @@ -325,7 +329,10 @@ static int probe_bcachefs(blkid_probe pr, const struct blkid_idmag *mag) blkid_probe_set_uuid(pr, bcs->user_uuid); blkid_probe_set_label(pr, bcs->label, sizeof(bcs->label)); - blkid_probe_sprintf_version(pr, "%d", le16_to_cpu(bcs->version)); + version = le16_to_cpu(bcs->version); + blkid_probe_sprintf_version(pr, "%"PRIu16".%"PRIu16, + BCH_VERSION_MAJOR(version), + BCH_VERSION_MINOR(version)); blocksize = le16_to_cpu(bcs->block_size); blkid_probe_set_block_size(pr, blocksize * BCACHEFS_SECTOR_SIZE); blkid_probe_set_fsblocksize(pr, blocksize * BCACHEFS_SECTOR_SIZE); diff --git a/tests/expected/blkid/low-probe-bcachefs b/tests/expected/blkid/low-probe-bcachefs index 70fddbee8e..510ec89448 100644 --- a/tests/expected/blkid/low-probe-bcachefs +++ b/tests/expected/blkid/low-probe-bcachefs @@ -9,4 +9,4 @@ ID_FS_UUID=46bd306f-80ad-4cd0-af4f-147e7d85f393 ID_FS_UUID_ENC=46bd306f-80ad-4cd0-af4f-147e7d85f393 ID_FS_UUID_SUB=72a60ede-4cb6-4374-aa70-cb38a50af5ef ID_FS_UUID_SUB_ENC=72a60ede-4cb6-4374-aa70-cb38a50af5ef -ID_FS_VERSION=13 +ID_FS_VERSION=0.13 diff --git a/tests/expected/blkid/low-probe-bcachefs-2 b/tests/expected/blkid/low-probe-bcachefs-2 index 4a6d664c09..b6e220ea0a 100644 --- a/tests/expected/blkid/low-probe-bcachefs-2 +++ b/tests/expected/blkid/low-probe-bcachefs-2 @@ -9,4 +9,4 @@ ID_FS_UUID=4fa11b1e-75e6-4210-9167-34e1769c0fe1 ID_FS_UUID_ENC=4fa11b1e-75e6-4210-9167-34e1769c0fe1 ID_FS_UUID_SUB=0a3643b7-c515-47f8-a0ea-91fc38d043d1 ID_FS_UUID_SUB_ENC=0a3643b7-c515-47f8-a0ea-91fc38d043d1 -ID_FS_VERSION=26 +ID_FS_VERSION=0.26