Skip to content

Commit 91eb974

Browse files
committed
ioctl: Rearrange members in nvme_format_nvm_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_format_nvm_args { int args_size; /* 0 4 */ int fd; /* 4 4 */ __u32 * result; /* 8 8 */ __u32 timeout; /* 16 4 */ __u32 nsid; /* 20 4 */ enum nvme_cmd_format_mset mset; /* 24 4 */ enum nvme_cmd_format_pi pi; /* 28 4 */ enum nvme_cmd_format_pil pil; /* 32 4 */ enum nvme_cmd_format_ses ses; /* 36 4 */ __u8 lbaf; /* 40 1 */ /* size: 48, cachelines: 1, members: 10 */ /* padding: 7 */ /* last cacheline: 48 bytes */ } __attribute__((__aligned__(8))); Signed-off-by: Daniel Wagner <[email protected]>
1 parent 4a1fefa commit 91eb974

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/nvme/ioctl.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2653,28 +2653,28 @@ int nvme_get_features_iocs_profile(int fd, enum nvme_get_features_sel sel,
26532653
/**
26542654
* nvme_format_nvm_args - Arguments for the Format Nvme Namespace command
26552655
* @fd: File descriptor of nvme device
2656+
* @result: The command completion result from CQE dword0
2657+
* @timeout: Set to override default timeout to this value in milliseconds;
2658+
* useful for long running formats. 0 will use system default.
26562659
* @nsid: Namespace ID to format
2657-
* @lbaf: Logical block address format
26582660
* @mset: Metadata settings (extended or separated), true if extended
26592661
* @pi: Protection information type
26602662
* @pil: Protection information location (beginning or end), true if end
26612663
* @ses: Secure erase settings
2662-
* @timeout: Set to override default timeout to this value in milliseconds;
2663-
* useful for long running formats. 0 will use system default.
2664-
* @result: The command completion result from CQE dword0
2664+
* @lbaf: Logical block address format
26652665
*/
26662666
struct nvme_format_nvm_args {
26672667
int args_size;
26682668
int fd;
2669+
__u32 *result;
2670+
__u32 timeout;
26692671
__u32 nsid;
2670-
__u8 lbaf;
26712672
enum nvme_cmd_format_mset mset;
26722673
enum nvme_cmd_format_pi pi;
26732674
enum nvme_cmd_format_pil pil;
26742675
enum nvme_cmd_format_ses ses;
2675-
__u32 timeout;
2676-
__u32 *result;
2677-
};
2676+
__u8 lbaf;
2677+
} __attribute__((packed, aligned(__alignof__(__u32*))));
26782678

26792679
/**
26802680
* nvme_format_nvm() - Format nvme namespace(s)

0 commit comments

Comments
 (0)