Skip to content

Commit 301c99e

Browse files
committed
ioctl: Rearrange members in nvme_capacity_mgmt_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_capacity_mgmt_args { int args_size; /* 0 4 */ int fd; /* 4 4 */ __u32 * result; /* 8 8 */ __u32 timeout; /* 16 4 */ __u32 cdw11; /* 20 4 */ __u32 cdw12; /* 24 4 */ __u16 element_id; /* 28 2 */ __u8 op; /* 30 1 */ /* size: 56, cachelines: 1, members: 11 */ /* padding: 6 */ /* last cacheline: 56 bytes */ } __attribute__((__aligned__(8))); Signed-off-by: Daniel Wagner <[email protected]>
1 parent f283430 commit 301c99e

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/nvme/ioctl.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3177,7 +3177,7 @@ struct nvme_directive_recv_args {
31773177
__u32 data_len;
31783178
void *data;
31793179
__u16 dspec;
3180-
} __attribute__((__packed__));
3180+
} __attribute__((packed, aligned(__alignof__(__u32*))));
31813181

31823182
/**
31833183
* nvme_directive_recv() - Receive directive specific data
@@ -3305,25 +3305,25 @@ static inline int nvme_directive_recv_stream_allocate(int fd, __u32 nsid,
33053305
/**
33063306
* nvme_capacity_mgmt_args - Arguments for the NVMe Capacity Management command
33073307
* @fd: File descriptor of nvme device
3308-
* @op: Operation to be performed by the controller
3309-
* @element_id: Value specific to the value of the Operation field
33103308
* @dw11: Least significant 32 bits of the capacity in bytes of the
33113309
* Endurance Group or NVM Set to be created
33123310
* @dw12: Most significant 32 bits of the capacity in bytes of the
33133311
* Endurance Group or NVM Set to be created
3314-
* @timeout: Timeout in ms
33153312
* @result: If successful, the CQE dword0 value
3313+
* @timeout: Timeout in ms
3314+
* @element_id: Value specific to the value of the Operation field
3315+
* @op: Operation to be performed by the controller
33163316
*/
33173317
struct nvme_capacity_mgmt_args {
33183318
int args_size;
33193319
int fd;
3320-
__u8 op;
3321-
__u16 element_id;
3320+
__u32 *result;
3321+
__u32 timeout;
33223322
__u32 cdw11;
33233323
__u32 cdw12;
3324-
__u32 timeout;
3325-
__u32 *result;
3326-
};
3324+
__u16 element_id;
3325+
__u8 op;
3326+
} __attribute__((__packed__));
33273327

33283328
/**
33293329
* nvme_capacity_mgmt() -

0 commit comments

Comments
 (0)