From 3b3d57a25ae6ec9b9fda18bce731644abb7d39bb Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Thu, 13 Jan 2022 18:50:31 +0100 Subject: [PATCH] ioctl: Rearrange members in nvme_copy_args Avoid any holes in the struct by rearranging the members. Also add the attribute packed to struct definition to reduce ABI breakage. struct nvme_copy_args { int args_size; /* 0 4 */ int fd; /* 4 4 */ __u32 * result; /* 8 8 */ __u32 timeout; /* 16 4 */ __u32 nsid; /* 20 4 */ struct nvme_copy_range * copy; /* 24 8 */ __u64 sdlba; /* 32 8 */ __u16 nr; /* 40 2 */ __u16 dspec; /* 42 2 */ __u8 prinfor; /* 44 1 */ __u8 prinfow; /* 45 1 */ __u8 dtype; /* 46 1 */ __u8 format; /* 47 1 */ int lr; /* 48 4 */ int fua; /* 52 4 */ __u32 ilbrt; /* 56 4 */ __u16 lbatm; /* 60 2 */ __u16 lbat; /* 62 2 */ /* size: 64, cachelines: 1, members: 18 */ } __attribute__((__aligned__(8))); Signed-off-by: Daniel Wagner --- src/nvme/ioctl.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/nvme/ioctl.h b/src/nvme/ioctl.h index 2a990105..81d1b1bb 100644 --- a/src/nvme/ioctl.h +++ b/src/nvme/ioctl.h @@ -3745,43 +3745,43 @@ int nvme_dsm(struct nvme_dsm_args *args); /** * nvme_copy_args - Arguments for the NVMe Copy command * @fd: File descriptor of the nvme device + * @result: The command completion result from CQE dword0 + * @timeout: Timeout in ms * @nsid: Namespace identifier * @copy: Range descriptior * @sdlba: Start destination LBA * @nr: Number of ranges + * @dspec: Directive specific value * @prinfor: Protection information field for read * @prinfow: Protection information field for write * @dtype: Directive type - * @dspec: Directive specific value * @format: Descriptor format * @lr: Limited retry * @fua: Force unit access * @ilbrt: Initial logical block reference tag * @lbatm: Logical block application tag mask * @lbat: Logical block application tag - * @timeout: Timeout in ms - * @result: The command completion result from CQE dword0 */ struct nvme_copy_args { int args_size; int fd; + __u32 *result; + __u32 timeout; __u32 nsid; struct nvme_copy_range *copy; __u64 sdlba; __u16 nr; + __u16 dspec; __u8 prinfor; __u8 prinfow; __u8 dtype; - __u16 dspec; __u8 format; int lr; int fua; __u32 ilbrt; __u16 lbatm; __u16 lbat; - __u32 timeout; - __u32 *result; -}; +} __attribute__((packed, aligned(__alignof__(__u64)))); /** * nvme_copy() - -- 2.50.1