Skip to content

Commit b8ebad6

Browse files
committed
nvme: Use relative seeks for deku decoding
Seeking from start is relative to the buffer, not to the struct definition, so it's rarely sensible. Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au> fixup: AdminIdentifyNvmIdentifyNamespaceResponse Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
1 parent c006e34 commit b8ebad6

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

src/nvme.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,9 @@ pub struct AdminIdentifyNvmIdentifyNamespaceResponse {
258258
mc: u8,
259259
dpc: u8,
260260
dps: u8,
261-
#[deku(seek_from_start = "48")]
261+
#[deku(seek_from_current = "18")]
262262
nvmcap: u128,
263-
#[deku(seek_from_start = "128")]
263+
#[deku(seek_from_current = "64")]
264264
// FIXME: use another struct
265265
lbaf0: u16,
266266
lbaf0_lbads: u8,
@@ -324,9 +324,9 @@ struct AdminIdentifyControllerResponse {
324324
rtd3e: u32,
325325
oaes: u32,
326326
ctratt: u32,
327-
#[deku(seek_from_start = "111")]
327+
#[deku(seek_from_current = "11")]
328328
cntrltype: crate::nvme::ControllerType,
329-
#[deku(seek_from_start = "253")]
329+
#[deku(seek_from_current = "141")]
330330
nvmsr: u8,
331331
vwci: u8,
332332
mec: u8,
@@ -338,15 +338,15 @@ struct AdminIdentifyControllerResponse {
338338
elpe: u8,
339339
npss: u8,
340340
avscc: u8,
341-
#[deku(seek_from_start = "266")]
341+
apsta: u8,
342342
wctemp: u16,
343343
cctemp: u16,
344-
#[deku(seek_from_start = "319")]
344+
#[deku(seek_from_current = "49")]
345345
fwug: u8,
346346
kas: u16,
347-
#[deku(seek_from_start = "386")]
347+
#[deku(seek_from_current = "64")]
348348
cqt: u16,
349-
#[deku(seek_from_start = "512")]
349+
#[deku(seek_from_current = "124")]
350350
sqes: u8,
351351
cqes: u8,
352352
maxcmd: u16,
@@ -359,11 +359,11 @@ struct AdminIdentifyControllerResponse {
359359
awupf: u16,
360360
icsvscc: u8,
361361
nwpc: u8,
362-
#[deku(seek_from_start = "540")]
362+
#[deku(seek_from_current = "8")]
363363
mnan: u32,
364-
#[deku(seek_from_start = "768")]
364+
#[deku(seek_from_current = "224")]
365365
subnqn: WireString<256>,
366-
#[deku(seek_from_start = "1802")]
366+
#[deku(seek_from_current = "778")]
367367
fcatt: u8,
368368
msdbd: u8,
369369
ofcs: u16,

src/nvme/mi/dev.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,7 @@ impl RequestHandler for AdminIdentifyRequest {
11901190
fcatt: 0,
11911191
msdbd: 0,
11921192
ofcs: 0,
1193+
apsta: 0,
11931194
}
11941195
.encode()?;
11951196

0 commit comments

Comments
 (0)