Skip to content

Commit f621fb5

Browse files
committed
ioctl: Rearrange members in nvme_sanitize_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_sanitize_nvm_args { int args_size; /* 0 4 */ int fd; /* 4 4 */ __u32 * result; /* 8 8 */ __u32 timeout; /* 16 4 */ enum nvme_sanitize_sanact sanact; /* 20 4 */ _Bool ause; /* 24 1 */ __u8 owpass; /* 25 1 */ _Bool oipbp; /* 26 1 */ _Bool nodas; /* 27 1 */ __u32 ovrpat; /* 28 4 */ /* size: 32, cachelines: 1, members: 6 */ /* padding: 4 */ /* last cacheline: 32 bytes */ } __attribute__((__aligned__(8))); Signed-off-by: Daniel Wagner <[email protected]>
1 parent 425b9ce commit f621fb5

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
@@ -3425,27 +3425,27 @@ int nvme_get_property(struct nvme_get_property_args *args);
34253425
/**
34263426
* nvme_sanitize_nvm_args - Arguments for the NVMe Sanitize NVM command
34273427
* @fd: File descriptor of nvme device
3428+
* @result: The command completion result from CQE dword0
3429+
* @timeout: Timeout in ms
34283430
* @sanact: Sanitize action, see &enum nvme_sanitize_sanact
34293431
* @ause: Set to allow unrestriced sanitize exit
34303432
* @owpass: Overwrite pass count
34313433
* @oipbp: Set to overwrite invert pattern between passes
34323434
* @nodas: Set to not deallocate blocks after sanitizing
34333435
* @ovrpat: Overwrite pattern
3434-
* @timeout: Timeout in ms
3435-
* @result: The command completion result from CQE dword0
34363436
*/
34373437
struct nvme_sanitize_nvm_args {
34383438
int args_size;
34393439
int fd;
3440+
__u32 *result;
3441+
__u32 timeout;
34403442
enum nvme_sanitize_sanact sanact;
34413443
bool ause;
34423444
__u8 owpass;
34433445
bool oipbp;
34443446
bool nodas;
34453447
__u32 ovrpat;
3446-
__u32 timeout;
3447-
__u32 *result;
3448-
};
3448+
} __attribute__((packed, aligned(__alignof__(__u32*))));
34493449

34503450
/**
34513451
* nvme_sanitize_nvm() - Start a sanitize operation
@@ -3477,11 +3477,11 @@ int nvme_sanitize_nvm(struct nvme_sanitize_nvm_args *args);
34773477
struct nvme_dev_self_test_args {
34783478
int args_size;
34793479
int fd;
3480+
__u32 *result;
3481+
__u32 timeout;
34803482
__u32 nsid;
34813483
enum nvme_dst_stc stc;
3482-
__u32 timeout;
3483-
__u32 *result;
3484-
};
3484+
} __attribute__((packed, aligned(__alignof__(__u32*))));
34853485

34863486
/**
34873487
* nvme_dev_self_test() - Start or abort a self test

0 commit comments

Comments
 (0)