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

Adding -Wno-address-of-packed-member to Makefiles
here, although we should consider disabling this
warning globally in SPDK just like DPDK.

Suppress abidiff errors around spdk_app_opts -
structure size and offsets of all existing members
were unchanged, so there is no ABI breakage here.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I2249eddb604d7b44180cadb92ba30edcd946b9bd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14091
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.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:09:09 +00:00 committed by Tomasz Zawadzki
parent a4ec8e6a60
commit 92335c01cf
4 changed files with 31 additions and 2 deletions

View File

@ -63,23 +63,42 @@ struct spdk_app_opts {
const char *name;
const char *json_config_file;
bool json_config_ignore_errors;
/* Hole at bytes 17-23. */
uint8_t reserved17[7];
const char *rpc_addr; /* Can be UNIX domain socket path or IP address + TCP port */
const char *reactor_mask;
const char *tpoint_group_mask;
int shm_id;
/* Hole at bytes 52-55. */
uint8_t reserved52[4];
spdk_app_shutdown_cb shutdown_cb;
bool enable_coredump;
/* Hole at bytes 65-67. */
uint8_t reserved65[3];
int mem_channel;
int main_core;
int mem_size;
bool no_pci;
bool hugepage_single_segments;
bool unlink_hugepage;
/* Hole at bytes 83-85. */
uint8_t reserved83[5];
const char *hugedir;
enum spdk_log_level print_level;
/* Hole at bytes 100-103. */
uint8_t reserved100[4];
size_t num_pci_addr;
struct spdk_pci_addr *pci_blocked;
struct spdk_pci_addr *pci_allowed;
@ -90,6 +109,9 @@ struct spdk_app_opts {
*/
bool delay_subsystem_init;
/* Hole at bytes 137-143. */
uint8_t reserved137[7];
/* Number of trace entries allocated for each core */
uint64_t num_entries;
@ -121,13 +143,16 @@ struct spdk_app_opts {
*/
bool disable_signal_handlers;
/* Hole at bytes 185-191. */
uint8_t reserved185[7];
/**
* The allocated size for the message pool used by the threading library.
*
* Default is `SPDK_DEFAULT_MSG_MEMPOOL_SIZE`.
*/
size_t msg_mempool_size;
};
} __attribute__((packed));
SPDK_STATIC_ASSERT(sizeof(struct spdk_app_opts) == 200, "Incorrect size");
/**

View File

@ -9,7 +9,7 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 11
SO_MINOR := 0
CFLAGS += $(ENV_CFLAGS)
CFLAGS += $(ENV_CFLAGS) -Wno-address-of-packed-member
LIBNAME = event
C_SRCS = app.c reactor.c log_rpc.c \

View File

@ -84,6 +84,8 @@ function confirm_abi_deps() {
name = spdk_nvme_cdata_nvmf_specific
[suppress_type]
name = spdk_bs_opts
[suppress_type]
name = spdk_app_opts
EOF
for object in "$libdir"/libspdk_*.so; do

View File

@ -5,6 +5,8 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../../..)
CFLAGS += -Wno-address-of-packed-member
SPDK_LIB_LIST = conf trace jsonrpc json
TEST_FILE = app_ut.c