Win32 API 日本語リファレンス
ホームStorage.Nvme › NVME_OCP_DEVICE_ERROR_RECOVERY_LOG_V2

NVME_OCP_DEVICE_ERROR_RECOVERY_LOG_V2

構造体
サイズx64: 523 バイト / x86: 515 バイトパッキング1

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
PanicResetWaitTimeWORD2+0+0パニック時にリセットを待つ時間。単位は実装規定である。
PanicResetActionNVME_WCS_DEVICE_RESET_ACTION8/4+2+2パニック時に実行するリセット動作を示す。
DeviceRecoveryAction1BYTE1+10+6デバイス回復アクション1。推奨される最初の回復手順。
PanicIdULONGLONG8+11+7発生したパニックを識別する64ビットID。
DeviceCapabilitiesANVME_WCS_DEVICE_CAPABILITIES8/4+19+15デバイスの回復関連機能を示す能力フラグ。
VendorSpecificRecoveryCodeBYTE1+27+19ベンダー固有の回復コード。
Reserved0BYTE3+28+20予約領域。将来拡張用で0とする。
VendorSpecificCommandCDW12DWORD4+31+23ベンダー固有回復コマンドのDWORD12値。
VendorSpecificCommandCDW13DWORD4+35+27ベンダー固有回復コマンドのDWORD13値。
VendorSpecificCommandTimeoutBYTE1+39+31ベンダー固有回復コマンドのタイムアウト時間。
DeviceRecoveryAction2BYTE1+40+32デバイス回復アクション2。追加の回復手順。
DeviceRecoveryAction2TimeoutBYTE1+41+33回復アクション2のタイムアウト時間。
Reserved1BYTE463+42+34予約領域。将来拡張用で0とする。
LogPageVersionNumberWORD2+505+497このログページの版数。
LogPageGUIDGUID16+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_OCP_DEVICE_ERROR_RECOVERY_LOG_V2  (x64 523 / x86 515 バイト)
#pragma pack(push, 1)
typedef struct NVME_OCP_DEVICE_ERROR_RECOVERY_LOG_V2 {
    WORD PanicResetWaitTime;
    NVME_WCS_DEVICE_RESET_ACTION PanicResetAction;
    BYTE DeviceRecoveryAction1;
    ULONGLONG PanicId;
    NVME_WCS_DEVICE_CAPABILITIES DeviceCapabilitiesA;
    BYTE VendorSpecificRecoveryCode;
    BYTE Reserved0[3];
    DWORD VendorSpecificCommandCDW12;
    DWORD VendorSpecificCommandCDW13;
    BYTE VendorSpecificCommandTimeout;
    BYTE DeviceRecoveryAction2;
    BYTE DeviceRecoveryAction2Timeout;
    BYTE Reserved1[463];
    WORD LogPageVersionNumber;
    GUID LogPageGUID;
} NVME_OCP_DEVICE_ERROR_RECOVERY_LOG_V2;
#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_OCP_DEVICE_ERROR_RECOVERY_LOG_V2
{
    public ushort PanicResetWaitTime;
    public NVME_WCS_DEVICE_RESET_ACTION PanicResetAction;
    public byte DeviceRecoveryAction1;
    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;
    public byte VendorSpecificCommandTimeout;
    public byte DeviceRecoveryAction2;
    public byte DeviceRecoveryAction2Timeout;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 463)] 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_OCP_DEVICE_ERROR_RECOVERY_LOG_V2
    Public PanicResetWaitTime As UShort
    Public PanicResetAction As NVME_WCS_DEVICE_RESET_ACTION
    Public DeviceRecoveryAction1 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
    Public VendorSpecificCommandTimeout As Byte
    Public DeviceRecoveryAction2 As Byte
    Public DeviceRecoveryAction2Timeout As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=463)> Public Reserved1() As Byte
    Public LogPageVersionNumber As UShort
    Public LogPageGUID As Guid
End Structure
import 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_OCP_DEVICE_ERROR_RECOVERY_LOG_V2(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("PanicResetWaitTime", ctypes.c_ushort),
        ("PanicResetAction", NVME_WCS_DEVICE_RESET_ACTION),
        ("DeviceRecoveryAction1", 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),
        ("VendorSpecificCommandTimeout", ctypes.c_ubyte),
        ("DeviceRecoveryAction2", ctypes.c_ubyte),
        ("DeviceRecoveryAction2Timeout", ctypes.c_ubyte),
        ("Reserved1", ctypes.c_ubyte * 463),
        ("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_OCP_DEVICE_ERROR_RECOVERY_LOG_V2 {
    pub PanicResetWaitTime: u16,
    pub PanicResetAction: NVME_WCS_DEVICE_RESET_ACTION,
    pub DeviceRecoveryAction1: u8,
    pub PanicId: u64,
    pub DeviceCapabilitiesA: NVME_WCS_DEVICE_CAPABILITIES,
    pub VendorSpecificRecoveryCode: u8,
    pub Reserved0: [u8; 3],
    pub VendorSpecificCommandCDW12: u32,
    pub VendorSpecificCommandCDW13: u32,
    pub VendorSpecificCommandTimeout: u8,
    pub DeviceRecoveryAction2: u8,
    pub DeviceRecoveryAction2Timeout: u8,
    pub Reserved1: [u8; 463],
    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_OCP_DEVICE_ERROR_RECOVERY_LOG_V2 struct {
	PanicResetWaitTime uint16
	PanicResetAction NVME_WCS_DEVICE_RESET_ACTION
	DeviceRecoveryAction1 byte
	PanicId uint64
	DeviceCapabilitiesA NVME_WCS_DEVICE_CAPABILITIES
	VendorSpecificRecoveryCode byte
	Reserved0 [3]byte
	VendorSpecificCommandCDW12 uint32
	VendorSpecificCommandCDW13 uint32
	VendorSpecificCommandTimeout byte
	DeviceRecoveryAction2 byte
	DeviceRecoveryAction2Timeout byte
	Reserved1 [463]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_OCP_DEVICE_ERROR_RECOVERY_LOG_V2 = packed record
    PanicResetWaitTime: Word;
    PanicResetAction: NVME_WCS_DEVICE_RESET_ACTION;
    DeviceRecoveryAction1: Byte;
    PanicId: UInt64;
    DeviceCapabilitiesA: NVME_WCS_DEVICE_CAPABILITIES;
    VendorSpecificRecoveryCode: Byte;
    Reserved0: array[0..2] of Byte;
    VendorSpecificCommandCDW12: DWORD;
    VendorSpecificCommandCDW13: DWORD;
    VendorSpecificCommandTimeout: Byte;
    DeviceRecoveryAction2: Byte;
    DeviceRecoveryAction2Timeout: Byte;
    Reserved1: array[0..462] 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_OCP_DEVICE_ERROR_RECOVERY_LOG_V2 = extern struct {
    PanicResetWaitTime: u16,
    PanicResetAction: NVME_WCS_DEVICE_RESET_ACTION,
    DeviceRecoveryAction1: u8,
    PanicId: u64,
    DeviceCapabilitiesA: NVME_WCS_DEVICE_CAPABILITIES,
    VendorSpecificRecoveryCode: u8,
    Reserved0: [3]u8,
    VendorSpecificCommandCDW12: u32,
    VendorSpecificCommandCDW13: u32,
    VendorSpecificCommandTimeout: u8,
    DeviceRecoveryAction2: u8,
    DeviceRecoveryAction2Timeout: u8,
    Reserved1: [463]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_OCP_DEVICE_ERROR_RECOVERY_LOG_V2 {.packed.} = object
    PanicResetWaitTime: uint16
    PanicResetAction: NVME_WCS_DEVICE_RESET_ACTION
    DeviceRecoveryAction1: uint8
    PanicId: uint64
    DeviceCapabilitiesA: NVME_WCS_DEVICE_CAPABILITIES
    VendorSpecificRecoveryCode: uint8
    Reserved0: array[3, uint8]
    VendorSpecificCommandCDW12: uint32
    VendorSpecificCommandCDW13: uint32
    VendorSpecificCommandTimeout: uint8
    DeviceRecoveryAction2: uint8
    DeviceRecoveryAction2Timeout: uint8
    Reserved1: array[463, uint8]
    LogPageVersionNumber: uint16
    LogPageGUID: GUID
struct NVME_WCS_DEVICE_RESET_ACTION
{
    _Anonymous_e__Union Anonymous;
}

struct NVME_WCS_DEVICE_CAPABILITIES
{
    _Anonymous_e__Union Anonymous;
}

align(1)
struct NVME_OCP_DEVICE_ERROR_RECOVERY_LOG_V2
{
    ushort PanicResetWaitTime;
    NVME_WCS_DEVICE_RESET_ACTION PanicResetAction;
    ubyte DeviceRecoveryAction1;
    ulong PanicId;
    NVME_WCS_DEVICE_CAPABILITIES DeviceCapabilitiesA;
    ubyte VendorSpecificRecoveryCode;
    ubyte[3] Reserved0;
    uint VendorSpecificCommandCDW12;
    uint VendorSpecificCommandCDW13;
    ubyte VendorSpecificCommandTimeout;
    ubyte DeviceRecoveryAction2;
    ubyte DeviceRecoveryAction2Timeout;
    ubyte[463] 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_OCP_DEVICE_ERROR_RECOVERY_LOG_V2 サイズ: 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:入れ子/配列)
; DeviceRecoveryAction1 : 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)
; VendorSpecificCommandTimeout : BYTE (+31, 1byte)  poke st,31,値  /  値 = peek(st,31)
; DeviceRecoveryAction2 : BYTE (+32, 1byte)  poke st,32,値  /  値 = peek(st,32)
; DeviceRecoveryAction2Timeout : BYTE (+33, 1byte)  poke st,33,値  /  値 = peek(st,33)
; Reserved1 : BYTE (+34, 463byte)  varptr(st)+34 を基点に操作(463byte:入れ子/配列)
; 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_OCP_DEVICE_ERROR_RECOVERY_LOG_V2 サイズ: 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:入れ子/配列)
; DeviceRecoveryAction1 : 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)
; VendorSpecificCommandTimeout : BYTE (+39, 1byte)  poke st,39,値  /  値 = peek(st,39)
; DeviceRecoveryAction2 : BYTE (+40, 1byte)  poke st,40,値  /  値 = peek(st,40)
; DeviceRecoveryAction2Timeout : BYTE (+41, 1byte)  poke st,41,値  /  値 = peek(st,41)
; Reserved1 : BYTE (+42, 463byte)  varptr(st)+42 を基点に操作(463byte:入れ子/配列)
; 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_OCP_DEVICE_ERROR_RECOVERY_LOG_V2, pack=1
    #field short PanicResetWaitTime
    #field NVME_WCS_DEVICE_RESET_ACTION PanicResetAction
    #field byte DeviceRecoveryAction1
    #field int64 PanicId
    #field NVME_WCS_DEVICE_CAPABILITIES DeviceCapabilitiesA
    #field byte VendorSpecificRecoveryCode
    #field byte Reserved0 3
    #field int VendorSpecificCommandCDW12
    #field int VendorSpecificCommandCDW13
    #field byte VendorSpecificCommandTimeout
    #field byte DeviceRecoveryAction2
    #field byte DeviceRecoveryAction2Timeout
    #field byte Reserved1 463
    #field short LogPageVersionNumber
    #field GUID LogPageGUID
#endstruct

stdim st, NVME_OCP_DEVICE_ERROR_RECOVERY_LOG_V2        ; NSTRUCT 変数を確保
st->PanicResetWaitTime = 100
mes "PanicResetWaitTime=" + st->PanicResetWaitTime