ホーム › Storage.Nvme › NVME_ERROR_INFO_LOG
NVME_ERROR_INFO_LOG
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ErrorCount | ULONGLONG | 8 | +0 | +0 | コントローラ起動以降に発生したエラーの通し番号。 |
| SQID | WORD | 2 | +8 | +8 | エラーに関連付く送信キュー識別子。 |
| CMDID | WORD | 2 | +10 | +10 | エラーに関連付くコマンド識別子。 |
| Status | NVME_COMMAND_STATUS | 2 | +12 | +12 | エラー発生時のコマンドステータスフィールド。 |
| ParameterErrorLocation | _ParameterErrorLocation_e__Struct | 2 | +14 | +14 | エラーの原因となったパラメータの位置(バイト/ビット)。 |
| Lba | ULONGLONG | 8 | +16 | +16 | エラーが発生した論理ブロックアドレス。 |
| NameSpace | DWORD | 4 | +24 | +24 | エラーに関連付く名前空間ID。 |
| VendorInfoAvailable | BYTE | 1 | +28 | +28 | ベンダー固有情報のログページ番号。0は無効。 |
| TRTYPE | BYTE | 1 | +29 | +29 | ファブリック転送タイプ(Transport Type)。 |
| Reserved0 | BYTE | 2 | +30 | +30 | 予約領域。将来拡張用で0とする。 |
| CommandSpecificInfo | ULONGLONG | 8 | +32 | +32 | コマンド固有のエラー情報。 |
| TransportTypeSpecificInfo | WORD | 2 | +40 | +40 | 転送タイプ固有のエラー情報。 |
| Reserved1 | BYTE | 22 | +42 | +42 | 予約領域。将来拡張用で0とする。 |
構造体: _ParameterErrorLocation_e__Struct x64 2B / x86 2B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| _bitfield | WORD | 2 | +0 | +0 |
各言語での定義
#include <windows.h>
// NVME_COMMAND_STATUS (x64 2 / x86 2 バイト)
typedef struct NVME_COMMAND_STATUS {
_Anonymous_e__Struct Anonymous;
WORD AsUshort;
} NVME_COMMAND_STATUS;
// NVME_ERROR_INFO_LOG (x64 64 / x86 64 バイト)
typedef struct NVME_ERROR_INFO_LOG {
ULONGLONG ErrorCount;
WORD SQID;
WORD CMDID;
NVME_COMMAND_STATUS Status;
_ParameterErrorLocation_e__Struct ParameterErrorLocation;
ULONGLONG Lba;
DWORD NameSpace;
BYTE VendorInfoAvailable;
BYTE TRTYPE;
BYTE Reserved0[2];
ULONGLONG CommandSpecificInfo;
WORD TransportTypeSpecificInfo;
BYTE Reserved1[22];
} NVME_ERROR_INFO_LOG;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_COMMAND_STATUS
{
public _Anonymous_e__Struct Anonymous;
public ushort AsUshort;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_ERROR_INFO_LOG
{
public ulong ErrorCount;
public ushort SQID;
public ushort CMDID;
public NVME_COMMAND_STATUS Status;
public _ParameterErrorLocation_e__Struct ParameterErrorLocation;
public ulong Lba;
public uint NameSpace;
public byte VendorInfoAvailable;
public byte TRTYPE;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] Reserved0;
public ulong CommandSpecificInfo;
public ushort TransportTypeSpecificInfo;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)] public byte[] Reserved1;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_COMMAND_STATUS
Public Anonymous As _Anonymous_e__Struct
Public AsUshort As UShort
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_ERROR_INFO_LOG
Public ErrorCount As ULong
Public SQID As UShort
Public CMDID As UShort
Public Status As NVME_COMMAND_STATUS
Public ParameterErrorLocation As _ParameterErrorLocation_e__Struct
Public Lba As ULong
Public NameSpace As UInteger
Public VendorInfoAvailable As Byte
Public TRTYPE As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Reserved0() As Byte
Public CommandSpecificInfo As ULong
Public TransportTypeSpecificInfo As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=22)> Public Reserved1() As Byte
End Structureimport ctypes
from ctypes import wintypes
class NVME_COMMAND_STATUS(ctypes.Structure):
_fields_ = [
("Anonymous", _Anonymous_e__Struct),
("AsUshort", ctypes.c_ushort),
]
class NVME_ERROR_INFO_LOG(ctypes.Structure):
_fields_ = [
("ErrorCount", ctypes.c_ulonglong),
("SQID", ctypes.c_ushort),
("CMDID", ctypes.c_ushort),
("Status", NVME_COMMAND_STATUS),
("ParameterErrorLocation", _ParameterErrorLocation_e__Struct),
("Lba", ctypes.c_ulonglong),
("NameSpace", wintypes.DWORD),
("VendorInfoAvailable", ctypes.c_ubyte),
("TRTYPE", ctypes.c_ubyte),
("Reserved0", ctypes.c_ubyte * 2),
("CommandSpecificInfo", ctypes.c_ulonglong),
("TransportTypeSpecificInfo", ctypes.c_ushort),
("Reserved1", ctypes.c_ubyte * 22),
]#[repr(C)]
pub struct NVME_COMMAND_STATUS {
pub Anonymous: _Anonymous_e__Struct,
pub AsUshort: u16,
}
#[repr(C)]
pub struct NVME_ERROR_INFO_LOG {
pub ErrorCount: u64,
pub SQID: u16,
pub CMDID: u16,
pub Status: NVME_COMMAND_STATUS,
pub ParameterErrorLocation: _ParameterErrorLocation_e__Struct,
pub Lba: u64,
pub NameSpace: u32,
pub VendorInfoAvailable: u8,
pub TRTYPE: u8,
pub Reserved0: [u8; 2],
pub CommandSpecificInfo: u64,
pub TransportTypeSpecificInfo: u16,
pub Reserved1: [u8; 22],
}import "golang.org/x/sys/windows"
type NVME_COMMAND_STATUS struct {
Anonymous _Anonymous_e__Struct
AsUshort uint16
}
type NVME_ERROR_INFO_LOG struct {
ErrorCount uint64
SQID uint16
CMDID uint16
Status NVME_COMMAND_STATUS
ParameterErrorLocation _ParameterErrorLocation_e__Struct
Lba uint64
NameSpace uint32
VendorInfoAvailable byte
TRTYPE byte
Reserved0 [2]byte
CommandSpecificInfo uint64
TransportTypeSpecificInfo uint16
Reserved1 [22]byte
}type
NVME_COMMAND_STATUS = record
Anonymous: _Anonymous_e__Struct;
AsUshort: Word;
end;
NVME_ERROR_INFO_LOG = record
ErrorCount: UInt64;
SQID: Word;
CMDID: Word;
Status: NVME_COMMAND_STATUS;
ParameterErrorLocation: _ParameterErrorLocation_e__Struct;
Lba: UInt64;
NameSpace: DWORD;
VendorInfoAvailable: Byte;
TRTYPE: Byte;
Reserved0: array[0..1] of Byte;
CommandSpecificInfo: UInt64;
TransportTypeSpecificInfo: Word;
Reserved1: array[0..21] of Byte;
end;const NVME_COMMAND_STATUS = extern struct {
Anonymous: _Anonymous_e__Struct,
AsUshort: u16,
};
const NVME_ERROR_INFO_LOG = extern struct {
ErrorCount: u64,
SQID: u16,
CMDID: u16,
Status: NVME_COMMAND_STATUS,
ParameterErrorLocation: _ParameterErrorLocation_e__Struct,
Lba: u64,
NameSpace: u32,
VendorInfoAvailable: u8,
TRTYPE: u8,
Reserved0: [2]u8,
CommandSpecificInfo: u64,
TransportTypeSpecificInfo: u16,
Reserved1: [22]u8,
};type
NVME_COMMAND_STATUS {.bycopy.} = object
Anonymous: _Anonymous_e__Struct
AsUshort: uint16
NVME_ERROR_INFO_LOG {.bycopy.} = object
ErrorCount: uint64
SQID: uint16
CMDID: uint16
Status: NVME_COMMAND_STATUS
ParameterErrorLocation: _ParameterErrorLocation_e__Struct
Lba: uint64
NameSpace: uint32
VendorInfoAvailable: uint8
TRTYPE: uint8
Reserved0: array[2, uint8]
CommandSpecificInfo: uint64
TransportTypeSpecificInfo: uint16
Reserved1: array[22, uint8]struct NVME_COMMAND_STATUS
{
_Anonymous_e__Struct Anonymous;
ushort AsUshort;
}
struct NVME_ERROR_INFO_LOG
{
ulong ErrorCount;
ushort SQID;
ushort CMDID;
NVME_COMMAND_STATUS Status;
_ParameterErrorLocation_e__Struct ParameterErrorLocation;
ulong Lba;
uint NameSpace;
ubyte VendorInfoAvailable;
ubyte TRTYPE;
ubyte[2] Reserved0;
ulong CommandSpecificInfo;
ushort TransportTypeSpecificInfo;
ubyte[22] Reserved1;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NVME_ERROR_INFO_LOG サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; ErrorCount : ULONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; SQID : WORD (+8, 2byte) wpoke st,8,値 / 値 = wpeek(st,8)
; CMDID : WORD (+10, 2byte) wpoke st,10,値 / 値 = wpeek(st,10)
; Status : NVME_COMMAND_STATUS (+12, 2byte) varptr(st)+12 を基点に操作(2byte:入れ子/配列)
; ParameterErrorLocation : _ParameterErrorLocation_e__Struct (+14, 2byte) varptr(st)+14 を基点に操作(2byte:入れ子/配列)
; Lba : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; NameSpace : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; VendorInfoAvailable : BYTE (+28, 1byte) poke st,28,値 / 値 = peek(st,28)
; TRTYPE : BYTE (+29, 1byte) poke st,29,値 / 値 = peek(st,29)
; Reserved0 : BYTE (+30, 2byte) varptr(st)+30 を基点に操作(2byte:入れ子/配列)
; CommandSpecificInfo : ULONGLONG (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; TransportTypeSpecificInfo : WORD (+40, 2byte) wpoke st,40,値 / 値 = wpeek(st,40)
; Reserved1 : BYTE (+42, 22byte) varptr(st)+42 を基点に操作(22byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NVME_ERROR_INFO_LOG
#field int64 ErrorCount
#field short SQID
#field short CMDID
#field byte Status 2
#field _ParameterErrorLocation_e__Struct ParameterErrorLocation
#field int64 Lba
#field int NameSpace
#field byte VendorInfoAvailable
#field byte TRTYPE
#field byte Reserved0 2
#field int64 CommandSpecificInfo
#field short TransportTypeSpecificInfo
#field byte Reserved1 22
#endstruct
stdim st, NVME_ERROR_INFO_LOG ; NSTRUCT 変数を確保
st->ErrorCount = 100
mes "ErrorCount=" + st->ErrorCount
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。