ホーム › Storage.Nvme › NVME_WCS_DEVICE_ERROR_RECOVERY_LOG
NVME_WCS_DEVICE_ERROR_RECOVERY_LOG
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| PanicResetWaitTime | WORD | 2 | +0 | +0 | パニック発生時にリセットを待つ時間。単位は実装規定である。 |
| PanicResetAction | NVME_WCS_DEVICE_RESET_ACTION | 8/4 | +2 | +2 | パニック時に実行するリセット動作を示す。 |
| DriveRecoveryAction | BYTE | 1 | +10 | +6 | ドライブ回復のために推奨されるアクション。 |
| PanicId | ULONGLONG | 8 | +11 | +7 | 発生したパニックを識別する64ビットID。 |
| DeviceCapabilitiesA | NVME_WCS_DEVICE_CAPABILITIES | 8/4 | +19 | +15 | デバイスの回復関連機能を示す能力フラグ。 |
| VendorSpecificRecoveryCode | BYTE | 1 | +27 | +19 | ベンダー固有の回復コード。 |
| Reserved0 | BYTE | 3 | +28 | +20 | 予約領域。将来拡張用で0とする。 |
| VendorSpecificCommandCDW12 | DWORD | 4 | +31 | +23 | ベンダー固有回復コマンドのDWORD12値。 |
| VendorSpecificCommandCDW13 | DWORD | 4 | +35 | +27 | ベンダー固有回復コマンドのDWORD13値。 |
| Reserved1 | BYTE | 466 | +39 | +31 | 予約領域。将来拡張用で0とする。 |
| LogPageVersionNumber | WORD | 2 | +505 | +497 | このログページの版数。 |
| LogPageGUID | GUID | 16 | +507 | +499 | ログページを識別する16バイトGUID。 |
各言語での定義
#include <windows.h>
// NVME_WCS_DEVICE_RESET_ACTION (x64 8 / x86 4 バイト)
typedef struct NVME_WCS_DEVICE_RESET_ACTION {
_Anonymous_e__Union Anonymous;
} NVME_WCS_DEVICE_RESET_ACTION;
// NVME_WCS_DEVICE_CAPABILITIES (x64 8 / x86 4 バイト)
typedef struct NVME_WCS_DEVICE_CAPABILITIES {
_Anonymous_e__Union Anonymous;
} NVME_WCS_DEVICE_CAPABILITIES;
// NVME_WCS_DEVICE_ERROR_RECOVERY_LOG (x64 523 / x86 515 バイト)
#pragma pack(push, 1)
typedef struct NVME_WCS_DEVICE_ERROR_RECOVERY_LOG {
WORD PanicResetWaitTime;
NVME_WCS_DEVICE_RESET_ACTION PanicResetAction;
BYTE DriveRecoveryAction;
ULONGLONG PanicId;
NVME_WCS_DEVICE_CAPABILITIES DeviceCapabilitiesA;
BYTE VendorSpecificRecoveryCode;
BYTE Reserved0[3];
DWORD VendorSpecificCommandCDW12;
DWORD VendorSpecificCommandCDW13;
BYTE Reserved1[466];
WORD LogPageVersionNumber;
GUID LogPageGUID;
} NVME_WCS_DEVICE_ERROR_RECOVERY_LOG;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_WCS_DEVICE_RESET_ACTION
{
public _Anonymous_e__Union Anonymous;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_WCS_DEVICE_CAPABILITIES
{
public _Anonymous_e__Union Anonymous;
}
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct NVME_WCS_DEVICE_ERROR_RECOVERY_LOG
{
public ushort PanicResetWaitTime;
public NVME_WCS_DEVICE_RESET_ACTION PanicResetAction;
public byte DriveRecoveryAction;
public ulong PanicId;
public NVME_WCS_DEVICE_CAPABILITIES DeviceCapabilitiesA;
public byte VendorSpecificRecoveryCode;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] Reserved0;
public uint VendorSpecificCommandCDW12;
public uint VendorSpecificCommandCDW13;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 466)] public byte[] Reserved1;
public ushort LogPageVersionNumber;
public Guid LogPageGUID;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_WCS_DEVICE_RESET_ACTION
Public Anonymous As _Anonymous_e__Union
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_WCS_DEVICE_CAPABILITIES
Public Anonymous As _Anonymous_e__Union
End Structure
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure NVME_WCS_DEVICE_ERROR_RECOVERY_LOG
Public PanicResetWaitTime As UShort
Public PanicResetAction As NVME_WCS_DEVICE_RESET_ACTION
Public DriveRecoveryAction As Byte
Public PanicId As ULong
Public DeviceCapabilitiesA As NVME_WCS_DEVICE_CAPABILITIES
Public VendorSpecificRecoveryCode As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public Reserved0() As Byte
Public VendorSpecificCommandCDW12 As UInteger
Public VendorSpecificCommandCDW13 As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=466)> Public Reserved1() As Byte
Public LogPageVersionNumber As UShort
Public LogPageGUID As Guid
End Structureimport ctypes
from ctypes import wintypes
class NVME_WCS_DEVICE_RESET_ACTION(ctypes.Structure):
_fields_ = [
("Anonymous", _Anonymous_e__Union),
]
class NVME_WCS_DEVICE_CAPABILITIES(ctypes.Structure):
_fields_ = [
("Anonymous", _Anonymous_e__Union),
]
class NVME_WCS_DEVICE_ERROR_RECOVERY_LOG(ctypes.Structure):
_pack_ = 1
_fields_ = [
("PanicResetWaitTime", ctypes.c_ushort),
("PanicResetAction", NVME_WCS_DEVICE_RESET_ACTION),
("DriveRecoveryAction", ctypes.c_ubyte),
("PanicId", ctypes.c_ulonglong),
("DeviceCapabilitiesA", NVME_WCS_DEVICE_CAPABILITIES),
("VendorSpecificRecoveryCode", ctypes.c_ubyte),
("Reserved0", ctypes.c_ubyte * 3),
("VendorSpecificCommandCDW12", wintypes.DWORD),
("VendorSpecificCommandCDW13", wintypes.DWORD),
("Reserved1", ctypes.c_ubyte * 466),
("LogPageVersionNumber", ctypes.c_ushort),
("LogPageGUID", GUID),
]#[repr(C)]
pub struct NVME_WCS_DEVICE_RESET_ACTION {
pub Anonymous: _Anonymous_e__Union,
}
#[repr(C)]
pub struct NVME_WCS_DEVICE_CAPABILITIES {
pub Anonymous: _Anonymous_e__Union,
}
#[repr(C, packed(1))]
pub struct NVME_WCS_DEVICE_ERROR_RECOVERY_LOG {
pub PanicResetWaitTime: u16,
pub PanicResetAction: NVME_WCS_DEVICE_RESET_ACTION,
pub DriveRecoveryAction: u8,
pub PanicId: u64,
pub DeviceCapabilitiesA: NVME_WCS_DEVICE_CAPABILITIES,
pub VendorSpecificRecoveryCode: u8,
pub Reserved0: [u8; 3],
pub VendorSpecificCommandCDW12: u32,
pub VendorSpecificCommandCDW13: u32,
pub Reserved1: [u8; 466],
pub LogPageVersionNumber: u16,
pub LogPageGUID: GUID,
}import "golang.org/x/sys/windows"
type NVME_WCS_DEVICE_RESET_ACTION struct {
Anonymous _Anonymous_e__Union
}
type NVME_WCS_DEVICE_CAPABILITIES struct {
Anonymous _Anonymous_e__Union
}
type NVME_WCS_DEVICE_ERROR_RECOVERY_LOG struct {
PanicResetWaitTime uint16
PanicResetAction NVME_WCS_DEVICE_RESET_ACTION
DriveRecoveryAction byte
PanicId uint64
DeviceCapabilitiesA NVME_WCS_DEVICE_CAPABILITIES
VendorSpecificRecoveryCode byte
Reserved0 [3]byte
VendorSpecificCommandCDW12 uint32
VendorSpecificCommandCDW13 uint32
Reserved1 [466]byte
LogPageVersionNumber uint16
LogPageGUID windows.GUID
}type
NVME_WCS_DEVICE_RESET_ACTION = record
Anonymous: _Anonymous_e__Union;
end;
NVME_WCS_DEVICE_CAPABILITIES = record
Anonymous: _Anonymous_e__Union;
end;
NVME_WCS_DEVICE_ERROR_RECOVERY_LOG = packed record
PanicResetWaitTime: Word;
PanicResetAction: NVME_WCS_DEVICE_RESET_ACTION;
DriveRecoveryAction: Byte;
PanicId: UInt64;
DeviceCapabilitiesA: NVME_WCS_DEVICE_CAPABILITIES;
VendorSpecificRecoveryCode: Byte;
Reserved0: array[0..2] of Byte;
VendorSpecificCommandCDW12: DWORD;
VendorSpecificCommandCDW13: DWORD;
Reserved1: array[0..465] of Byte;
LogPageVersionNumber: Word;
LogPageGUID: TGUID;
end;const NVME_WCS_DEVICE_RESET_ACTION = extern struct {
Anonymous: _Anonymous_e__Union,
};
const NVME_WCS_DEVICE_CAPABILITIES = extern struct {
Anonymous: _Anonymous_e__Union,
};
const NVME_WCS_DEVICE_ERROR_RECOVERY_LOG = extern struct {
PanicResetWaitTime: u16,
PanicResetAction: NVME_WCS_DEVICE_RESET_ACTION,
DriveRecoveryAction: u8,
PanicId: u64,
DeviceCapabilitiesA: NVME_WCS_DEVICE_CAPABILITIES,
VendorSpecificRecoveryCode: u8,
Reserved0: [3]u8,
VendorSpecificCommandCDW12: u32,
VendorSpecificCommandCDW13: u32,
Reserved1: [466]u8,
LogPageVersionNumber: u16,
LogPageGUID: GUID,
};type
NVME_WCS_DEVICE_RESET_ACTION {.bycopy.} = object
Anonymous: _Anonymous_e__Union
NVME_WCS_DEVICE_CAPABILITIES {.bycopy.} = object
Anonymous: _Anonymous_e__Union
NVME_WCS_DEVICE_ERROR_RECOVERY_LOG {.packed.} = object
PanicResetWaitTime: uint16
PanicResetAction: NVME_WCS_DEVICE_RESET_ACTION
DriveRecoveryAction: uint8
PanicId: uint64
DeviceCapabilitiesA: NVME_WCS_DEVICE_CAPABILITIES
VendorSpecificRecoveryCode: uint8
Reserved0: array[3, uint8]
VendorSpecificCommandCDW12: uint32
VendorSpecificCommandCDW13: uint32
Reserved1: array[466, uint8]
LogPageVersionNumber: uint16
LogPageGUID: GUIDstruct NVME_WCS_DEVICE_RESET_ACTION
{
_Anonymous_e__Union Anonymous;
}
struct NVME_WCS_DEVICE_CAPABILITIES
{
_Anonymous_e__Union Anonymous;
}
align(1)
struct NVME_WCS_DEVICE_ERROR_RECOVERY_LOG
{
ushort PanicResetWaitTime;
NVME_WCS_DEVICE_RESET_ACTION PanicResetAction;
ubyte DriveRecoveryAction;
ulong PanicId;
NVME_WCS_DEVICE_CAPABILITIES DeviceCapabilitiesA;
ubyte VendorSpecificRecoveryCode;
ubyte[3] Reserved0;
uint VendorSpecificCommandCDW12;
uint VendorSpecificCommandCDW13;
ubyte[466] Reserved1;
ushort LogPageVersionNumber;
GUID LogPageGUID;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; NVME_WCS_DEVICE_ERROR_RECOVERY_LOG サイズ: 515 バイト(x86)
dim st, 129 ; 4byte整数×129(構造体サイズ 515 / 4 切り上げ)
; PanicResetWaitTime : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; PanicResetAction : NVME_WCS_DEVICE_RESET_ACTION (+2, 4byte) varptr(st)+2 を基点に操作(4byte:入れ子/配列)
; DriveRecoveryAction : BYTE (+6, 1byte) poke st,6,値 / 値 = peek(st,6)
; PanicId : ULONGLONG (+7, 8byte) qpoke st,7,値 / qpeek(st,7) ※IronHSPのみ。3.7/3.8は lpoke st,7,下位 : lpoke st,11,上位
; DeviceCapabilitiesA : NVME_WCS_DEVICE_CAPABILITIES (+15, 4byte) varptr(st)+15 を基点に操作(4byte:入れ子/配列)
; VendorSpecificRecoveryCode : BYTE (+19, 1byte) poke st,19,値 / 値 = peek(st,19)
; Reserved0 : BYTE (+20, 3byte) varptr(st)+20 を基点に操作(3byte:入れ子/配列)
; VendorSpecificCommandCDW12 : DWORD (+23, 4byte) lpoke st,23,値 / 値 = lpeek(st,23)
; VendorSpecificCommandCDW13 : DWORD (+27, 4byte) lpoke st,27,値 / 値 = lpeek(st,27)
; Reserved1 : BYTE (+31, 466byte) varptr(st)+31 を基点に操作(466byte:入れ子/配列)
; LogPageVersionNumber : WORD (+497, 2byte) wpoke st,497,値 / 値 = wpeek(st,497)
; LogPageGUID : GUID (+499, 16byte) varptr(st)+499 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NVME_WCS_DEVICE_ERROR_RECOVERY_LOG サイズ: 523 バイト(x64)
dim st, 131 ; 4byte整数×131(構造体サイズ 523 / 4 切り上げ)
; PanicResetWaitTime : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; PanicResetAction : NVME_WCS_DEVICE_RESET_ACTION (+2, 8byte) varptr(st)+2 を基点に操作(8byte:入れ子/配列)
; DriveRecoveryAction : BYTE (+10, 1byte) poke st,10,値 / 値 = peek(st,10)
; PanicId : ULONGLONG (+11, 8byte) qpoke st,11,値 / qpeek(st,11) ※IronHSPのみ。3.7/3.8は lpoke st,11,下位 : lpoke st,15,上位
; DeviceCapabilitiesA : NVME_WCS_DEVICE_CAPABILITIES (+19, 8byte) varptr(st)+19 を基点に操作(8byte:入れ子/配列)
; VendorSpecificRecoveryCode : BYTE (+27, 1byte) poke st,27,値 / 値 = peek(st,27)
; Reserved0 : BYTE (+28, 3byte) varptr(st)+28 を基点に操作(3byte:入れ子/配列)
; VendorSpecificCommandCDW12 : DWORD (+31, 4byte) lpoke st,31,値 / 値 = lpeek(st,31)
; VendorSpecificCommandCDW13 : DWORD (+35, 4byte) lpoke st,35,値 / 値 = lpeek(st,35)
; Reserved1 : BYTE (+39, 466byte) varptr(st)+39 を基点に操作(466byte:入れ子/配列)
; LogPageVersionNumber : WORD (+505, 2byte) wpoke st,505,値 / 値 = wpeek(st,505)
; LogPageGUID : GUID (+507, 16byte) varptr(st)+507 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global NVME_WCS_DEVICE_RESET_ACTION
#field byte Anonymous 8
#endstruct
#defstruct global NVME_WCS_DEVICE_CAPABILITIES
#field byte Anonymous 8
#endstruct
#defstruct global GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global NVME_WCS_DEVICE_ERROR_RECOVERY_LOG, pack=1
#field short PanicResetWaitTime
#field NVME_WCS_DEVICE_RESET_ACTION PanicResetAction
#field byte DriveRecoveryAction
#field int64 PanicId
#field NVME_WCS_DEVICE_CAPABILITIES DeviceCapabilitiesA
#field byte VendorSpecificRecoveryCode
#field byte Reserved0 3
#field int VendorSpecificCommandCDW12
#field int VendorSpecificCommandCDW13
#field byte Reserved1 466
#field short LogPageVersionNumber
#field GUID LogPageGUID
#endstruct
stdim st, NVME_WCS_DEVICE_ERROR_RECOVERY_LOG ; NSTRUCT 変数を確保
st->PanicResetWaitTime = 100
mes "PanicResetWaitTime=" + st->PanicResetWaitTime