Skip to content

Commit 727b8b0

Browse files
committed
ioctl: Rearrange members in nvme_zns_mgmt_recv_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_zns_mgmt_recv_args { int args_size; /* 0 4 */ int fd; /* 4 4 */ __u32 * result; /* 8 8 */ __u32 timeout; /* 16 4 */ __u32 nsid; /* 20 4 */ __u64 slba; /* 24 8 */ enum nvme_zns_recv_action zra; /* 32 4 */ __u32 data_len; /* 36 4 */ void * data; /* 40 8 */ __u16 zrasf; /* 48 2 */ _Bool zras_feat; /* 50 1 */ /* size: 56, cachelines: 1, members: 11 */ /* padding: 5 */ /* last cacheline: 56 bytes */ } __attribute__((__aligned__(8))); Signed-off-by: Daniel Wagner <[email protected]>
1 parent a335603 commit 727b8b0

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

src/nvme/ioctl.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3976,29 +3976,29 @@ int nvme_zns_mgmt_send(struct nvme_zns_mgmt_send_args *args);
39763976
/**
39773977
* nvme_zns_mgmt_recv_args - Arguments for the NVMe ZNS Management Receive command
39783978
* @fd: File descriptor of nvme device
3979+
* @result: The command completion result from CQE dword0
3980+
* @timeout: timeout in ms
39793981
* @nsid: Namespace ID
39803982
* @slba: Starting logical block address
39813983
* @zra: zone receive action
3982-
* @zrasf: Zone receive action specific field
3983-
* @zras_feat: Zone receive action specific features
39843984
* @data_len: Length of @data
39853985
* @data: Userspace address of the data
3986-
* @timeout: timeout in ms
3987-
* @result: The command completion result from CQE dword0
3986+
* @zrasf: Zone receive action specific field
3987+
* @zras_feat: Zone receive action specific features
39883988
*/
39893989
struct nvme_zns_mgmt_recv_args {
39903990
int args_size;
39913991
int fd;
3992+
__u32 *result;
3993+
__u32 timeout;
39923994
__u32 nsid;
39933995
__u64 slba;
39943996
enum nvme_zns_recv_action zra;
3995-
__u16 zrasf;
3996-
bool zras_feat;
39973997
__u32 data_len;
39983998
void *data;
3999-
__u32 timeout;
4000-
__u32 *result;
4001-
};
3999+
__u16 zrasf;
4000+
bool zras_feat;
4001+
} __attribute__((packed, aligned(__alignof__(__u32*))));
40024002

40034003
/**
40044004
* nvme_zns_mgmt_recv() -
@@ -4034,16 +4034,16 @@ static inline int nvme_zns_report_zones(int fd, __u32 nsid, __u64 slba,
40344034
struct nvme_zns_mgmt_recv_args args = {
40354035
.args_size = sizeof(args),
40364036
.fd = fd,
4037+
.result = result,
4038+
.timeout = timeout,
40374039
.nsid = nsid,
40384040
.slba = slba,
40394041
.zra = extended ? NVME_ZNS_ZRA_EXTENDED_REPORT_ZONES :
40404042
NVME_ZNS_ZRA_REPORT_ZONES,
4041-
.zrasf = opts,
4042-
.zras_feat = partial,
40434043
.data_len = data_len,
40444044
.data = data,
4045-
.timeout = timeout,
4046-
.result = result,
4045+
.zrasf = opts,
4046+
.zras_feat = partial,
40474047
};
40484048

40494049
return nvme_zns_mgmt_recv(&args);

0 commit comments

Comments
 (0)