Skip to content

Commit 65d2d83

Browse files
committed
ioctl: Rearrange members in nvme_lockdown_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_lockdown_args { int args_size; /* 0 4 */ int fd; /* 4 4 */ __u32 * result; /* 8 8 */ __u32 timeout; /* 16 4 */ __u8 scp; /* 20 1 */ __u8 prhbt; /* 21 1 */ __u8 ifc; /* 22 1 */ __u8 ofi; /* 23 1 */ __u8 uuidx; /* 24 1 */ /* size: 32, cachelines: 1, members: 8 */ /* padding: 1 */ /* last cacheline: 32 bytes */ } __attribute__((__aligned__(8))); Signed-off-by: Daniel Wagner <[email protected]>
1 parent 301c99e commit 65d2d83

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/nvme/ioctl.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3323,7 +3323,7 @@ struct nvme_capacity_mgmt_args {
33233323
__u32 cdw12;
33243324
__u16 element_id;
33253325
__u8 op;
3326-
} __attribute__((__packed__));
3326+
} __attribute__((packed, aligned(__alignof__(__u32*))));
33273327

33283328
/**
33293329
* nvme_capacity_mgmt() -
@@ -3337,25 +3337,25 @@ int nvme_capacity_mgmt(struct nvme_capacity_mgmt_args *args);
33373337
/**
33383338
* nvme_lockdown_args - Arguments for the NVME Lockdown command
33393339
* @fd: File descriptor of nvme device
3340+
* @result: The command completion result from CQE dword0
3341+
* @timeout: Timeout in ms (0 for default timeout)
33403342
* @scp: Scope of the command
33413343
* @prhbt: Prohibit or allow the command opcode or Set Features command
33423344
* @ifc: Affected interface
33433345
* @ofi: Opcode or Feature Identifier
33443346
* @uuid: UUID Index if controller supports this id selection method
3345-
* @timeout: Timeout in ms (0 for default timeout)
3346-
* @result: The command completion result from CQE dword0
33473347
*/
33483348
struct nvme_lockdown_args {
33493349
int args_size;
33503350
int fd;
3351+
__u32 *result;
3352+
__u32 timeout;
33513353
__u8 scp;
33523354
__u8 prhbt;
33533355
__u8 ifc;
33543356
__u8 ofi;
33553357
__u8 uuidx;
3356-
__u32 timeout;
3357-
__u32 *result;
3358-
};
3358+
} __attribute__((__packed__));
33593359

33603360
/**
33613361
* nvme_lockdown() - Issue lockdown command

0 commit comments

Comments
 (0)