From a4ec8e6a60baddd94fd77840ff7e48e420cffee9 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Wed, 17 Aug 2022 22:04:50 +0000 Subject: [PATCH] blob: make opts structures packed This ensures that when fields are added, that the size of the structure will change, ensuring different versions of the structure can be detected using sizeof. Suppress abidiff errors around spdk_bs_opts - structure size and offsets of all existing members were unchanged, so there is no ABI breakage here. Signed-off-by: Jim Harris Change-Id: I2b109e0787446a598eee413d1595a68b4c87f830 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14090 Reviewed-by: Ben Walker Reviewed-by: Aleksey Marchuk Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot --- include/spdk/blob.h | 7 +++++-- test/make/check_so_deps.sh | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/spdk/blob.h b/include/spdk/blob.h index a2f5f7c54..9c45fdf30 100644 --- a/include/spdk/blob.h +++ b/include/spdk/blob.h @@ -135,7 +135,7 @@ struct spdk_blob_ext_io_opts { void *memory_domain_ctx; /** Optional user context */ void *user_ctx; -}; +} __attribute__((packed)); SPDK_STATIC_ASSERT(sizeof(struct spdk_blob_ext_io_opts) == 32, "Incorrect size"); struct spdk_bs_dev { @@ -222,6 +222,9 @@ struct spdk_bs_opts { /** Blobstore type */ struct spdk_bs_type bstype; + /* Hole at bytes 36-39. */ + uint8_t reserved36[4]; + /** Callback function to invoke for each blob. */ spdk_blob_op_with_handle_complete iter_cb_fn; @@ -238,7 +241,7 @@ struct spdk_bs_opts { /** Force recovery during import. This is a uint64_t for padding reasons, treated as a bool. */ uint64_t force_recover; -}; +} __attribute__((packed)); SPDK_STATIC_ASSERT(sizeof(struct spdk_bs_opts) == 72, "Incorrect size"); /** diff --git a/test/make/check_so_deps.sh b/test/make/check_so_deps.sh index 1b50ae55e..eeceab894 100755 --- a/test/make/check_so_deps.sh +++ b/test/make/check_so_deps.sh @@ -82,6 +82,8 @@ function confirm_abi_deps() { name = spdk_nvme_cdata_oacs [suppress_type] name = spdk_nvme_cdata_nvmf_specific +[suppress_type] + name = spdk_bs_opts EOF for object in "$libdir"/libspdk_*.so; do