Skip to content

Commit 3b3d57a

Browse files
committed
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 <[email protected]>
1 parent e78db5a commit 3b3d57a

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/nvme/ioctl.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3745,43 +3745,43 @@ int nvme_dsm(struct nvme_dsm_args *args);
37453745
/**
37463746
* nvme_copy_args - Arguments for the NVMe Copy command
37473747
* @fd: File descriptor of the nvme device
3748+
* @result: The command completion result from CQE dword0
3749+
* @timeout: Timeout in ms
37483750
* @nsid: Namespace identifier
37493751
* @copy: Range descriptior
37503752
* @sdlba: Start destination LBA
37513753
* @nr: Number of ranges
3754+
* @dspec: Directive specific value
37523755
* @prinfor: Protection information field for read
37533756
* @prinfow: Protection information field for write
37543757
* @dtype: Directive type
3755-
* @dspec: Directive specific value
37563758
* @format: Descriptor format
37573759
* @lr: Limited retry
37583760
* @fua: Force unit access
37593761
* @ilbrt: Initial logical block reference tag
37603762
* @lbatm: Logical block application tag mask
37613763
* @lbat: Logical block application tag
3762-
* @timeout: Timeout in ms
3763-
* @result: The command completion result from CQE dword0
37643764
*/
37653765
struct nvme_copy_args {
37663766
int args_size;
37673767
int fd;
3768+
__u32 *result;
3769+
__u32 timeout;
37683770
__u32 nsid;
37693771
struct nvme_copy_range *copy;
37703772
__u64 sdlba;
37713773
__u16 nr;
3774+
__u16 dspec;
37723775
__u8 prinfor;
37733776
__u8 prinfow;
37743777
__u8 dtype;
3775-
__u16 dspec;
37763778
__u8 format;
37773779
int lr;
37783780
int fua;
37793781
__u32 ilbrt;
37803782
__u16 lbatm;
37813783
__u16 lbat;
3782-
__u32 timeout;
3783-
__u32 *result;
3784-
};
3784+
} __attribute__((packed, aligned(__alignof__(__u64))));
37853785

37863786
/**
37873787
* nvme_copy() -

0 commit comments

Comments
 (0)