Skip to content

Commit f274eeb

Browse files
committed
ioctl: Remove attribute packed and alignedof for args structs
The attribute packed is usually used to make sure the data structures is compatible between different compilers in regards of padding rules. As we have sorted the members of all argument structs according their naturual size, there are no holes to pad. This makes the packed attributed superflous as compilers are agree on the data layout in this case. The alignedof attribute is used to tell the outer alignmen of the data structure because the aligment of a packed data structure is 1. Anyway, both attributes doen't add any benefits to the layout and pahole agrees on this. This is an example the diff between the packed/aligneof version and the plain version: struct nvme_dim_args { __u32 * result; /* 0 8 */ void * data; /* 8 8 */ @@ -776,4 +777,4 @@ /* size: 40, cachelines: 1, members: 7 */ /* padding: 7 */ /* last cacheline: 40 bytes */ -} __attribute__((__aligned__(8))); +}; Thus, just remove the attributes. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 321c5aa commit f274eeb

1 file changed

Lines changed: 32 additions & 32 deletions

File tree

src/nvme/ioctl.h

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ struct nvme_identify_args {
405405
__u16 cntid;
406406
__u16 cns_specific_id;
407407
__u8 uuidx;
408-
} __attribute__((packed, aligned(__alignof__(__u32*))));
408+
};
409409

410410
/**
411411
* nvme_identify() - Send the NVMe Identify command
@@ -1206,7 +1206,7 @@ struct nvme_get_log_args {
12061206
__u8 uuidx;
12071207
bool rae;
12081208
bool ot;
1209-
} __attribute__((packed, aligned(__alignof__(__u64))));
1209+
};
12101210

12111211
/**
12121212
* nvme_get_log() - NVMe Admin Get Log command
@@ -2016,7 +2016,7 @@ struct nvme_set_features_args {
20162016
bool save;
20172017
__u8 uuidx;
20182018
__u8 fid;
2019-
} __attribute__((packed, aligned(__alignof__(__u32*))));
2019+
};
20202020

20212021
/**
20222022
* nvme_set_features() - Set a feature attribute
@@ -2456,7 +2456,7 @@ struct nvme_get_features_args {
24562456
__u32 data_len;
24572457
__u8 fid;
24582458
__u8 uuidx;
2459-
} __attribute__((packed, aligned(__alignof__(__u32*))));
2459+
};
24602460

24612461
/**
24622462
* nvme_get_features() - Retrieve a feature attribute
@@ -2905,7 +2905,7 @@ struct nvme_format_nvm_args {
29052905
enum nvme_cmd_format_pil pil;
29062906
enum nvme_cmd_format_ses ses;
29072907
__u8 lbaf;
2908-
} __attribute__((packed, aligned(__alignof__(__u32*))));
2908+
};
29092909

29102910
/**
29112911
* nvme_format_nvm() - Format nvme namespace(s)
@@ -2941,7 +2941,7 @@ struct nvme_ns_mgmt_args {
29412941
__u32 nsid;
29422942
enum nvme_ns_mgmt_sel sel;
29432943
__u8 csi;
2944-
} __attribute__((packed, aligned(__alignof__(__u32*))));
2944+
};
29452945

29462946
/**
29472947
* nvme_ns_mgmt() - Issue a Namespace management command
@@ -3028,7 +3028,7 @@ struct nvme_ns_attach_args {
30283028
__u32 timeout;
30293029
__u32 nsid;
30303030
enum nvme_ns_attach_sel sel;
3031-
} __attribute__((packed, aligned(__alignof__(__u32*))));
3031+
};
30323032

30333033
/**
30343034
* nvme_ns_attach() - Attach or detach namespace to controller(s)
@@ -3098,7 +3098,7 @@ struct nvme_fw_download_args {
30983098
__u32 timeout;
30993099
__u32 offset;
31003100
__u32 data_len;
3101-
} __attribute__((packed, aligned(__alignof__(__u32*))));
3101+
};
31023102

31033103
/**
31043104
* nvme_fw_download() - Download part or all of a firmware image to the
@@ -3141,7 +3141,7 @@ struct nvme_fw_commit_args {
31413141
enum nvme_fw_commit_ca action;
31423142
__u8 slot;
31433143
bool bpid;
3144-
} __attribute__((packed, aligned(__alignof__(__u32*))));
3144+
};
31453145

31463146
/**
31473147
* nvme_fw_commit() - Commit firmware using the specified action
@@ -3184,7 +3184,7 @@ struct nvme_security_send_args {
31843184
__u8 spsp0;
31853185
__u8 spsp1;
31863186
__u8 secp;
3187-
} __attribute__((packed, aligned(__alignof__(__u32*))));
3187+
};
31883188

31893189
/**
31903190
* nvme_security_send() -
@@ -3232,7 +3232,7 @@ struct nvme_security_receive_args {
32323232
__u8 spsp0;
32333233
__u8 spsp1;
32343234
__u8 secp;
3235-
} __attribute__((packed, aligned(__alignof__(__u32*))));
3235+
};
32363236

32373237
/**
32383238
* nvme_security_receive() -
@@ -3268,7 +3268,7 @@ struct nvme_get_lba_status_args {
32683268
__u32 mndw;
32693269
enum nvme_lba_status_atype atype;
32703270
__u16 rl;
3271-
} __attribute__((packed, aligned(__alignof__(__u64))));
3271+
};
32723272

32733273
/**
32743274
* nvme_get_lba_status() - Retrieve information on possibly unrecoverable LBAs
@@ -3308,7 +3308,7 @@ struct nvme_directive_send_args {
33083308
__u32 cdw12;
33093309
__u32 data_len;
33103310
__u16 dspec;
3311-
} __attribute__((packed, aligned(__alignof__(__u32*))));
3311+
};
33123312

33133313
/**
33143314
* nvme_directive_send() - Send directive command
@@ -3422,7 +3422,7 @@ struct nvme_directive_recv_args {
34223422
__u32 cdw12;
34233423
__u32 data_len;
34243424
__u16 dspec;
3425-
} __attribute__((packed, aligned(__alignof__(__u32*))));
3425+
};
34263426

34273427
/**
34283428
* nvme_directive_recv() - Receive directive specific data
@@ -3574,7 +3574,7 @@ struct nvme_capacity_mgmt_args {
35743574
__u32 cdw12;
35753575
__u16 element_id;
35763576
__u8 op;
3577-
} __attribute__((packed, aligned(__alignof__(__u32*))));
3577+
};
35783578

35793579
/**
35803580
* nvme_capacity_mgmt() -
@@ -3607,7 +3607,7 @@ struct nvme_lockdown_args {
36073607
__u8 ifc;
36083608
__u8 ofi;
36093609
__u8 uuidx;
3610-
} __attribute__((__packed__));
3610+
};
36113611

36123612
/**
36133613
* nvme_lockdown() - Issue lockdown command
@@ -3634,7 +3634,7 @@ struct nvme_set_property_args {
36343634
int fd;
36353635
__u32 timeout;
36363636
int offset;
3637-
} __attribute__((packed, aligned(__alignof__(__u64))));
3637+
};
36383638

36393639
/**
36403640
* nvme_set_property() - Set controller property
@@ -3662,7 +3662,7 @@ struct nvme_get_property_args {
36623662
int fd;
36633663
__u32 timeout;
36643664
int offset;
3665-
} __attribute__((packed, aligned(__alignof__(__u64*))));
3665+
};
36663666

36673667
/**
36683668
* nvme_get_property() - Get a controller property
@@ -3700,7 +3700,7 @@ struct nvme_sanitize_nvm_args {
37003700
__u8 owpass;
37013701
bool oipbp;
37023702
bool nodas;
3703-
} __attribute__((packed, aligned(__alignof__(__u32*))));
3703+
};
37043704

37053705
/**
37063706
* nvme_sanitize_nvm() - Start a sanitize operation
@@ -3737,7 +3737,7 @@ struct nvme_dev_self_test_args {
37373737
__u32 timeout;
37383738
__u32 nsid;
37393739
enum nvme_dst_stc stc;
3740-
} __attribute__((packed, aligned(__alignof__(__u32*))));
3740+
};
37413741

37423742
/**
37433743
* nvme_dev_self_test() - Start or abort a self test
@@ -3780,7 +3780,7 @@ struct nvme_virtual_mgmt_args {
37803780
enum nvme_virt_mgmt_rt rt;
37813781
__u16 cntlid;
37823782
__u16 nr;
3783-
} __attribute__((packed, aligned(__alignof__(__u32*))));
3783+
};
37843784

37853785
/**
37863786
* nvme_virtual_mgmt() - Virtualization resource management
@@ -3867,7 +3867,7 @@ struct nvme_io_args {
38673867
__u16 appmask;
38683868
__u16 dspec;
38693869
__u8 dsm;
3870-
} __attribute__((__packed__, aligned(__alignof__(__u64))));
3870+
};
38713871

38723872
/**
38733873
* nvme_io() - Submit an nvme user I/O command
@@ -3985,7 +3985,7 @@ struct nvme_dsm_args {
39853985
__u32 nsid;
39863986
__u32 attrs;
39873987
__u16 nr_ranges;
3988-
} __attribute__((packed, aligned(__alignof__(__u32*))));
3988+
};
39893989

39903990
/**
39913991
* nvme_dsm() - Send an nvme data set management command
@@ -4042,7 +4042,7 @@ struct nvme_copy_args {
40424042
__u8 prinfow;
40434043
__u8 dtype;
40444044
__u8 format;
4045-
} __attribute__((packed, aligned(__alignof__(__u64))));
4045+
};
40464046

40474047
/**
40484048
* nvme_copy() -
@@ -4079,7 +4079,7 @@ struct nvme_resv_acquire_args {
40794079
enum nvme_resv_rtype rtype;
40804080
enum nvme_resv_racqa racqa;
40814081
bool iekey;
4082-
} __attribute__((packed, aligned(__alignof__(__u64))));
4082+
};
40834083

40844084
/**
40854085
* nvme_resv_acquire() - Send an nvme reservation acquire
@@ -4119,7 +4119,7 @@ struct nvme_resv_register_args {
41194119
enum nvme_resv_rrega rrega;
41204120
enum nvme_resv_cptpl cptpl;
41214121
bool iekey;
4122-
} __attribute__((packed, aligned(__alignof__(__u64))));
4122+
};
41234123

41244124
/**
41254125
* nvme_resv_register() - Send an nvme reservation register
@@ -4155,7 +4155,7 @@ struct nvme_resv_release_args {
41554155
enum nvme_resv_rtype rtype;
41564156
enum nvme_resv_rrela rrela;
41574157
bool iekey;
4158-
} __attribute__((packed, aligned(__alignof__(__u64))));
4158+
};
41594159

41604160
/**
41614161
* nvme_resv_release() - Send an nvme reservation release
@@ -4187,7 +4187,7 @@ struct nvme_resv_report_args {
41874187
__u32 nsid;
41884188
__u32 len;
41894189
bool eds;
4190-
} __attribute__((packed, aligned(__alignof__(__u32*))));
4190+
};
41914191

41924192
/**
41934193
* nvme_resv_report() - Send an nvme reservation report
@@ -4228,7 +4228,7 @@ struct nvme_zns_mgmt_send_args {
42284228
__u32 data_len;
42294229
bool select_all;
42304230
__u8 zsaso;
4231-
} __attribute__((packed, aligned(__alignof__(__u64))));
4231+
};
42324232

42334233
/**
42344234
* nvme_zns_mgmt_send() -
@@ -4266,7 +4266,7 @@ struct nvme_zns_mgmt_recv_args {
42664266
__u32 data_len;
42674267
__u16 zrasf;
42684268
bool zras_feat;
4269-
} __attribute__((packed, aligned(__alignof__(__u64))));
4269+
};
42704270

42714271
/**
42724272
* nvme_zns_mgmt_recv() -
@@ -4351,7 +4351,7 @@ struct nvme_zns_append_args {
43514351
__u16 control;
43524352
__u16 lbat;
43534353
__u16 lbatm;
4354-
} __attribute__((packed, aligned(__alignof__(__u64))));
4354+
};
43554355

43564356
/**
43574357
* nvme_zns_append() - Append data to a zone
@@ -4380,7 +4380,7 @@ struct nvme_dim_args {
43804380
__u32 timeout;
43814381
__u32 data_len;
43824382
__u8 tas;
4383-
} __attribute__((packed, aligned(__alignof__(__u32*))));
4383+
};
43844384

43854385
/**
43864386
* nvme_dim_send - Send a Discovery Information Management (DIM) command

0 commit comments

Comments
 (0)