bdev: 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.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If346cb6628b3a288a3ac720104b501589eba3b83
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14089
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Jim Harris 2022-08-17 22:00:20 +00:00 committed by Tomasz Zawadzki
parent b801af090a
commit 98e3a5d3ae

View File

@ -164,6 +164,10 @@ struct spdk_bdev_opts {
uint32_t bdev_io_pool_size; uint32_t bdev_io_pool_size;
uint32_t bdev_io_cache_size; uint32_t bdev_io_cache_size;
bool bdev_auto_examine; bool bdev_auto_examine;
/* Hole at bytes 9-15. */
uint8_t reserved9[7];
/** /**
* The size of spdk_bdev_opts according to the caller of this library is used for ABI * The size of spdk_bdev_opts according to the caller of this library is used for ABI
* compatibility. The library uses this field to know how many fields in this * compatibility. The library uses this field to know how many fields in this
@ -174,7 +178,7 @@ struct spdk_bdev_opts {
uint32_t small_buf_pool_size; uint32_t small_buf_pool_size;
uint32_t large_buf_pool_size; uint32_t large_buf_pool_size;
}; } __attribute__((packed));
SPDK_STATIC_ASSERT(sizeof(struct spdk_bdev_opts) == 32, "Incorrect size"); SPDK_STATIC_ASSERT(sizeof(struct spdk_bdev_opts) == 32, "Incorrect size");
/** /**
@ -193,7 +197,7 @@ struct spdk_bdev_ext_io_opts {
void *memory_domain_ctx; void *memory_domain_ctx;
/** Metadata buffer, optional */ /** Metadata buffer, optional */
void *metadata; void *metadata;
}; } __attribute__((packed));
SPDK_STATIC_ASSERT(sizeof(struct spdk_bdev_ext_io_opts) == 32, "Incorrect size"); SPDK_STATIC_ASSERT(sizeof(struct spdk_bdev_ext_io_opts) == 32, "Incorrect size");
/** /**