Skip to content

Commit f1af770

Browse files
committed
ioctl: Fix struct nvme_get_log_args memberm alignment
Commit 781b910 ("nvme: Add Media Unit Status log page(LID: 0x10)") placed the domid member between two u8 members. The access domid member would not be 16 bit aligned which is caused problems on certain architectures. Let's fix the aligemnt by moving domid before lsp. This give us following layout struct nvme_get_log_args { int args_size; /* 0 4 */ int fd; /* 4 4 */ __u32 * result; /* 8 8 */ __u32 timeout; /* 16 4 */ enum nvme_cmd_get_log_lid lid; /* 20 4 */ __u64 lpo; /* 24 8 */ void * log; /* 32 8 */ __u32 len; /* 40 4 */ __u32 nsid; /* 44 4 */ enum nvme_csi csi; /* 48 4 */ __u16 lsi; /* 52 2 */ __u16 domid; /* 54 2 */ __u8 lsp; /* 56 1 */ __u8 uuidx; /* 57 1 */ _Bool rae; /* 58 1 */ _Bool ot; /* 59 1 */ /* size: 64, cachelines: 1, members: 16 */ /* padding: 4 */ } __attribute__((__aligned__(8))); Signed-off-by: Daniel Wagner <[email protected]>
1 parent 3fba7be commit f1af770

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

src/nvme/ioctl.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,9 +1122,9 @@ static inline int nvme_zns_identify_ctrl(int fd, struct nvme_zns_id_ctrl *id)
11221122
* @len: Length of provided user buffer to hold the log data in bytes
11231123
* @nsid: Namespace identifier, if applicable
11241124
* @csi: Command set identifier, see &enum nvme_csi for known values
1125-
* @lsp: Log specific field
11261125
* @lsi: Endurance group information
11271126
* @domid: Domain Identifier selection, if supported
1127+
* @lsp: Log specific field
11281128
* @uuidx: UUID selection, if supported
11291129
* @rae: Retain asynchronous events
11301130
* @ot: Offset Type; if set @lpo specifies the index into the list
@@ -1143,8 +1143,8 @@ struct nvme_get_log_args {
11431143
__u32 nsid;
11441144
enum nvme_csi csi;
11451145
__u16 lsi;
1146-
__u8 lsp;
11471146
__u16 domid;
1147+
__u8 lsp;
11481148
__u8 uuidx;
11491149
bool rae;
11501150
bool ot;
@@ -1175,8 +1175,8 @@ static inline int nvme_get_nsid_log(int fd, bool rae,
11751175
.nsid = nsid,
11761176
.csi = NVME_CSI_NVM,
11771177
.lsi = NVME_LOG_LSI_NONE,
1178-
.lsp = NVME_LOG_LSP_NONE,
11791178
.domid = NVME_DOMID_NONE,
1179+
.lsp = NVME_LOG_LSP_NONE,
11801180
.uuidx = NVME_UUID_NONE,
11811181
.rae = false,
11821182
.ot = false,
@@ -1318,8 +1318,8 @@ static inline int nvme_get_log_cmd_effects(int fd, enum nvme_csi csi,
13181318
.nsid = NVME_NSID_ALL,
13191319
.csi = csi,
13201320
.lsi = NVME_LOG_LSI_NONE,
1321-
.lsp = NVME_LOG_LSP_NONE,
13221321
.domid = NVME_DOMID_NONE,
1322+
.lsp = NVME_LOG_LSP_NONE,
13231323
.uuidx = NVME_UUID_NONE,
13241324
.rae = false,
13251325
.ot = false,
@@ -1365,8 +1365,8 @@ static inline int nvme_get_log_create_telemetry_host(int fd,
13651365
.nsid = NVME_NSID_NONE,
13661366
.csi = NVME_CSI_NVM,
13671367
.lsi = NVME_LOG_LSI_NONE,
1368-
.lsp = NVME_LOG_TELEM_HOST_LSP_CREATE,
13691368
.domid = NVME_DOMID_NONE,
1369+
.lsp = NVME_LOG_TELEM_HOST_LSP_CREATE,
13701370
.uuidx = NVME_UUID_NONE,
13711371
.rae = false,
13721372
.ot = false,
@@ -1402,8 +1402,8 @@ static inline int nvme_get_log_telemetry_host(int fd, __u64 offset,
14021402
.nsid = NVME_NSID_NONE,
14031403
.csi = NVME_CSI_NVM,
14041404
.lsi = NVME_LOG_LSI_NONE,
1405-
.lsp = NVME_LOG_TELEM_HOST_LSP_RETAIN,
14061405
.domid = NVME_DOMID_NONE,
1406+
.lsp = NVME_LOG_TELEM_HOST_LSP_RETAIN,
14071407
.uuidx = NVME_UUID_NONE,
14081408
.rae = false,
14091409
.ot = false,
@@ -1434,8 +1434,8 @@ static inline int nvme_get_log_telemetry_ctrl(int fd, bool rae,
14341434
.nsid = NVME_NSID_NONE,
14351435
.csi = NVME_CSI_NVM,
14361436
.lsi = NVME_LOG_LSI_NONE,
1437-
.lsp = NVME_LOG_LSP_NONE,
14381437
.domid = NVME_DOMID_NONE,
1438+
.lsp = NVME_LOG_LSP_NONE,
14391439
.uuidx = NVME_UUID_NONE,
14401440
.rae = rae,
14411441
.ot = false,
@@ -1474,8 +1474,8 @@ static inline int nvme_get_log_endurance_group(int fd, __u16 endgid,
14741474
.nsid = NVME_NSID_NONE,
14751475
.csi = NVME_CSI_NVM,
14761476
.lsi = endgid,
1477-
.lsp = NVME_LOG_LSP_NONE,
14781477
.domid = NVME_DOMID_NONE,
1478+
.lsp = NVME_LOG_LSP_NONE,
14791479
.uuidx = NVME_UUID_NONE,
14801480
.rae = false,
14811481
.ot = false,
@@ -1506,8 +1506,8 @@ static inline int nvme_get_log_predictable_lat_nvmset(int fd, __u16 nvmsetid,
15061506
.nsid = NVME_NSID_NONE,
15071507
.csi = NVME_CSI_NVM,
15081508
.lsi = nvmsetid,
1509-
.lsp = NVME_LOG_LSP_NONE,
15101509
.domid = NVME_DOMID_NONE,
1510+
.lsp = NVME_LOG_LSP_NONE,
15111511
.uuidx = NVME_UUID_NONE,
15121512
.rae = false,
15131513
.ot = false,
@@ -1535,8 +1535,8 @@ static inline int nvme_get_log_predictable_lat_event(int fd, bool rae,
15351535
.nsid = NVME_NSID_NONE,
15361536
.csi = NVME_CSI_NVM,
15371537
.lsi = NVME_LOG_LSI_NONE,
1538-
.lsp = NVME_LOG_LSP_NONE,
15391538
.domid = NVME_DOMID_NONE,
1539+
.lsp = NVME_LOG_LSP_NONE,
15401540
.uuidx = NVME_UUID_NONE,
15411541
.rae = rae,
15421542
.ot = false,
@@ -1576,8 +1576,8 @@ static int nvme_get_log_ana(int fd, enum nvme_log_ana_lsp lsp, bool rae,
15761576
.nsid = NVME_NSID_NONE,
15771577
.csi = NVME_CSI_NVM,
15781578
.lsi = NVME_LOG_LSI_NONE,
1579-
.lsp = lsp,
15801579
.domid = NVME_DOMID_NONE,
1580+
.lsp = lsp,
15811581
.uuidx = NVME_UUID_NONE,
15821582
.rae = false,
15831583
.ot = false,
@@ -1619,8 +1619,8 @@ static inline int nvme_get_log_lba_status(int fd, bool rae,
16191619
.nsid = NVME_NSID_NONE,
16201620
.csi = NVME_CSI_NVM,
16211621
.lsi = NVME_LOG_LSI_NONE,
1622-
.lsp = NVME_LOG_LSP_NONE,
16231622
.domid = NVME_DOMID_NONE,
1623+
.lsp = NVME_LOG_LSP_NONE,
16241624
.uuidx = NVME_UUID_NONE,
16251625
.rae = rae,
16261626
.ot = false,
@@ -1648,8 +1648,8 @@ static inline int nvme_get_log_endurance_grp_evt(int fd, bool rae,
16481648
.nsid = NVME_NSID_NONE,
16491649
.csi = NVME_CSI_NVM,
16501650
.lsi = NVME_LOG_LSI_NONE,
1651-
.lsp = NVME_LOG_LSP_NONE,
16521651
.domid = NVME_DOMID_NONE,
1652+
.lsp = NVME_LOG_LSP_NONE,
16531653
.uuidx = NVME_UUID_NONE,
16541654
.rae = rae,
16551655
.ot = false,
@@ -1699,8 +1699,8 @@ static inline int nvme_get_log_boot_partition(int fd, bool rae,
16991699
.nsid = NVME_NSID_NONE,
17001700
.csi = NVME_CSI_NVM,
17011701
.lsi = NVME_LOG_LSI_NONE,
1702-
.lsp = NVME_LOG_LSP_NONE,
17031702
.domid = NVME_DOMID_NONE,
1703+
.lsp = NVME_LOG_LSP_NONE,
17041704
.uuidx = NVME_UUID_NONE,
17051705
.rae = rae,
17061706
.ot = false,
@@ -1737,8 +1737,8 @@ static inline int nvme_get_log_discovery(int fd, bool rae,
17371737
.nsid = NVME_NSID_NONE,
17381738
.csi = NVME_CSI_NVM,
17391739
.lsi = NVME_LOG_LSI_NONE,
1740-
.lsp = NVME_LOG_LSP_NONE,
17411740
.domid = NVME_DOMID_NONE,
1741+
.lsp = NVME_LOG_LSP_NONE,
17421742
.uuidx = NVME_UUID_NONE,
17431743
.rae = rae,
17441744
.ot = false,
@@ -1769,8 +1769,8 @@ static inline int nvme_get_log_media_unit_stat(int fd, __u16 domid,
17691769
.nsid = NVME_NSID_NONE,
17701770
.csi = NVME_CSI_NVM,
17711771
.lsi = NVME_LOG_LSI_NONE,
1772-
.lsp = NVME_LOG_LSP_NONE,
17731772
.domid = domid,
1773+
.lsp = NVME_LOG_LSP_NONE,
17741774
.uuidx = NVME_UUID_NONE,
17751775
.rae = false,
17761776
.ot = false,
@@ -1836,8 +1836,8 @@ static inline int nvme_get_log_zns_changed_zones(int fd, __u32 nsid, bool rae,
18361836
.nsid = nsid,
18371837
.csi = NVME_CSI_ZNS,
18381838
.lsi = NVME_LOG_LSI_NONE,
1839-
.lsp = NVME_LOG_LSP_NONE,
18401839
.domid = NVME_DOMID_NONE,
1840+
.lsp = NVME_LOG_LSP_NONE,
18411841
.uuidx = NVME_UUID_NONE,
18421842
.rae = rae,
18431843
.ot = false,
@@ -1868,8 +1868,8 @@ static inline int nvme_get_log_persistent_event(int fd,
18681868
.nsid = NVME_NSID_ALL,
18691869
.csi = NVME_CSI_NVM,
18701870
.lsi = NVME_LOG_LSI_NONE,
1871-
.lsp = NVME_LOG_LSP_NONE,
18721871
.domid = NVME_DOMID_NONE,
1872+
.lsp = NVME_LOG_LSP_NONE,
18731873
.uuidx = NVME_UUID_NONE,
18741874
.rae = false,
18751875
.ot = false,

0 commit comments

Comments
 (0)