Skip to content

Commit e78db5a

Browse files
committed
ioctl: Rearrange members in nvme_dsm_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_dsm_args { int args_size; /* 0 4 */ int fd; /* 4 4 */ __u32 * result; /* 8 8 */ __u32 timeout; /* 16 4 */ __u32 nsid; /* 20 4 */ struct nvme_dsm_range * dsm; /* 24 8 */ __u32 attrs; /* 32 4 */ __u16 nr_ranges; /* 36 2 */ /* size: 40, cachelines: 1, members: 8 */ /* padding: 2 */ /* last cacheline: 40 bytes */ } __attribute__((__aligned__(8))); Signed-off-by: Daniel Wagner <[email protected]>
1 parent fc93fb6 commit e78db5a

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
@@ -3709,23 +3709,23 @@ static inline int nvme_verify(struct nvme_io_args *args)
37093709
/**
37103710
* nvme_dsm_args - Arguments for the NVMe Dataset Management command
37113711
* @fd: File descriptor of nvme device
3712+
* @result: The command completion result from CQE dword0
3713+
* @timeout: Timeout in ms
37123714
* @nsid: Namespace identifier
3715+
* @dsm: The data set management attributes
37133716
* @attrs: DSM attributes, see &enum nvme_dsm_attributes
37143717
* @nr_ranges: Number of block ranges in the data set management attributes
3715-
* @dsm: The data set management attributes
3716-
* @timeout: Timeout in ms
3717-
* @result: The command completion result from CQE dword0
37183718
*/
37193719
struct nvme_dsm_args {
37203720
int args_size;
37213721
int fd;
3722+
__u32 *result;
3723+
__u32 timeout;
37223724
__u32 nsid;
3725+
struct nvme_dsm_range *dsm;
37233726
__u32 attrs;
37243727
__u16 nr_ranges;
3725-
struct nvme_dsm_range *dsm;
3726-
__u32 timeout;
3727-
__u32 *result;
3728-
};
3728+
} __attribute__((packed, aligned(__alignof__(__u32*))));
37293729

37303730
/**
37313731
* nvme_dsm() - Send an nvme data set management command

0 commit comments

Comments
 (0)