sock: 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: Ia30d57b25b559a89997963a3f68797ff3b9d6409
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14093
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:29:53 +00:00 committed by Tomasz Zawadzki
parent 1ef258104d
commit 2508d170c8

View File

@ -175,11 +175,17 @@ struct spdk_sock_opts {
*/
bool zcopy;
/* Hole at bytes 13-15. */
uint8_t reserved13[3];
/**
* Time in msec to wait ack until connection is closed forcefully.
*/
uint32_t ack_timeout;
/* Hole at bytes 20-23. */
uint8_t reserved[4];
/**
* Socket implementation options. If non-NULL, these will override those set by
* spdk_sock_impl_set_opts(). The library copies this structure internally, so the user can
@ -191,7 +197,7 @@ struct spdk_sock_opts {
* Size of the impl_opts structure.
*/
size_t impl_opts_size;
};
} __attribute__((packed));
SPDK_STATIC_ASSERT(sizeof(struct spdk_sock_opts) == 40, "Incorrect size");
/**