Skip to content

Commit 57af2be

Browse files
committed
ioctl: Rearrange members in nvme_virtual_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_virtual_mgmt_args { int args_size; /* 0 4 */ int fd; /* 4 4 */ __u32 * result; /* 8 8 */ __u32 timeout; /* 16 4 */ enum nvme_virt_mgmt_act act; /* 20 4 */ enum nvme_virt_mgmt_rt rt; /* 24 4 */ __u16 cntlid; /* 28 2 */ __u16 nr; /* 30 2 */ /* size: 32, cachelines: 1, members: 8 */ /* last cacheline: 32 bytes */ } __attribute__((__aligned__(8))); Signed-off-by: Daniel Wagner <[email protected]>
1 parent f621fb5 commit 57af2be

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/nvme/ioctl.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3507,23 +3507,23 @@ int nvme_dev_self_test(struct nvme_dev_self_test_args *args);
35073507
* nvme_virtual_mgmt_args - Arguments for the NVMe Virtualization
35083508
* resource management command
35093509
* @fd: File descriptor of nvme device
3510+
* @result: If successful, the CQE dword0
3511+
* @timeout: Timeout in ms
35103512
* @act: Virtual resource action, see &enum nvme_virt_mgmt_act
35113513
* @rt: Resource type to modify, see &enum nvme_virt_mgmt_rt
35123514
* @cntlid: Controller id for which resources are bing modified
35133515
* @nr: Number of resources being allocated or assigned
3514-
* @timeout: Timeout in ms
3515-
* @result: If successful, the CQE dword0
35163516
*/
35173517
struct nvme_virtual_mgmt_args {
35183518
int args_size;
35193519
int fd;
3520+
__u32 *result;
3521+
__u32 timeout;
35203522
enum nvme_virt_mgmt_act act;
35213523
enum nvme_virt_mgmt_rt rt;
35223524
__u16 cntlid;
35233525
__u16 nr;
3524-
__u32 timeout;
3525-
__u32 *result;
3526-
};
3526+
} __attribute__((packed, aligned(__alignof__(__u32*))));
35273527

35283528
/**
35293529
* nvme_virtual_mgmt() - Virtualization resource management

0 commit comments

Comments
 (0)