ホーム › Storage.Nvme › NVME_PERSISTENT_EVENT_LOG_HEADER
NVME_PERSISTENT_EVENT_LOG_HEADER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| LogIdentifier | BYTE | 1 | +0 | +0 | 永続イベントログの識別子。 |
| Reserved0 | BYTE | 3 | +1 | +1 | 予約領域。将来拡張用で0とする。 |
| TotalNumberOfEvents | DWORD | 4 | +4 | +4 | ログに含まれる総イベント数。 |
| TotalLogLength | ULONGLONG | 8 | +8 | +8 | ログ全体のバイト長。 |
| LogRevision | BYTE | 1 | +16 | +16 | 永続イベントログのリビジョン番号。 |
| Reserved1 | BYTE | 1 | +17 | +17 | 予約領域。将来拡張用で0とする。 |
| LogHeaderLength | WORD | 2 | +18 | +18 | このログヘッダのバイト長。 |
| Timestamp | ULONGLONG | 8 | +20 | +20 | ログ作成時刻のタイムスタンプ。 |
| PowerOnHours | BYTE | 16 | +28 | +28 | 通電時間(128ビット)。 |
| PowerCycleCount | ULONGLONG | 8 | +44 | +44 | 電源投入回数。 |
| PciVendorId | WORD | 2 | +52 | +52 | PCIベンダーID。 |
| PciSubsystemVendorId | WORD | 2 | +54 | +54 | PCIサブシステムベンダーID。 |
| SerialNumber | BYTE | 20 | +56 | +56 | デバイスのシリアル番号(20バイトASCII)。 |
| ModelNumber | BYTE | 40 | +76 | +76 | デバイスのモデル番号(40バイトASCII)。 |
| NVMSubsystemNVMeQualifiedName | BYTE | 256 | +116 | +116 | NVMサブシステムのNQN(256バイト)。 |
| Reserved | BYTE | 108 | +372 | +372 | 予約領域。将来拡張用で0とする。 |
| SupportedEventsBitmap | BYTE | 32 | +480 | +480 | サポートされるイベントタイプを示すビットマップ。 |
各言語での定義
#include <windows.h>
// NVME_PERSISTENT_EVENT_LOG_HEADER (x64 512 / x86 512 バイト)
#pragma pack(push, 1)
typedef struct NVME_PERSISTENT_EVENT_LOG_HEADER {
BYTE LogIdentifier;
BYTE Reserved0[3];
DWORD TotalNumberOfEvents;
ULONGLONG TotalLogLength;
BYTE LogRevision;
BYTE Reserved1;
WORD LogHeaderLength;
ULONGLONG Timestamp;
BYTE PowerOnHours[16];
ULONGLONG PowerCycleCount;
WORD PciVendorId;
WORD PciSubsystemVendorId;
BYTE SerialNumber[20];
BYTE ModelNumber[40];
BYTE NVMSubsystemNVMeQualifiedName[256];
BYTE Reserved[108];
BYTE SupportedEventsBitmap[32];
} NVME_PERSISTENT_EVENT_LOG_HEADER;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct NVME_PERSISTENT_EVENT_LOG_HEADER
{
public byte LogIdentifier;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] Reserved0;
public uint TotalNumberOfEvents;
public ulong TotalLogLength;
public byte LogRevision;
public byte Reserved1;
public ushort LogHeaderLength;
public ulong Timestamp;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] PowerOnHours;
public ulong PowerCycleCount;
public ushort PciVendorId;
public ushort PciSubsystemVendorId;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] SerialNumber;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)] public byte[] ModelNumber;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] NVMSubsystemNVMeQualifiedName;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 108)] public byte[] Reserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] SupportedEventsBitmap;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure NVME_PERSISTENT_EVENT_LOG_HEADER
Public LogIdentifier As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public Reserved0() As Byte
Public TotalNumberOfEvents As UInteger
Public TotalLogLength As ULong
Public LogRevision As Byte
Public Reserved1 As Byte
Public LogHeaderLength As UShort
Public Timestamp As ULong
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public PowerOnHours() As Byte
Public PowerCycleCount As ULong
Public PciVendorId As UShort
Public PciSubsystemVendorId As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=20)> Public SerialNumber() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=40)> Public ModelNumber() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=256)> Public NVMSubsystemNVMeQualifiedName() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=108)> Public Reserved() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public SupportedEventsBitmap() As Byte
End Structureimport ctypes
from ctypes import wintypes
class NVME_PERSISTENT_EVENT_LOG_HEADER(ctypes.Structure):
_pack_ = 1
_fields_ = [
("LogIdentifier", ctypes.c_ubyte),
("Reserved0", ctypes.c_ubyte * 3),
("TotalNumberOfEvents", wintypes.DWORD),
("TotalLogLength", ctypes.c_ulonglong),
("LogRevision", ctypes.c_ubyte),
("Reserved1", ctypes.c_ubyte),
("LogHeaderLength", ctypes.c_ushort),
("Timestamp", ctypes.c_ulonglong),
("PowerOnHours", ctypes.c_ubyte * 16),
("PowerCycleCount", ctypes.c_ulonglong),
("PciVendorId", ctypes.c_ushort),
("PciSubsystemVendorId", ctypes.c_ushort),
("SerialNumber", ctypes.c_ubyte * 20),
("ModelNumber", ctypes.c_ubyte * 40),
("NVMSubsystemNVMeQualifiedName", ctypes.c_ubyte * 256),
("Reserved", ctypes.c_ubyte * 108),
("SupportedEventsBitmap", ctypes.c_ubyte * 32),
]#[repr(C, packed(1))]
pub struct NVME_PERSISTENT_EVENT_LOG_HEADER {
pub LogIdentifier: u8,
pub Reserved0: [u8; 3],
pub TotalNumberOfEvents: u32,
pub TotalLogLength: u64,
pub LogRevision: u8,
pub Reserved1: u8,
pub LogHeaderLength: u16,
pub Timestamp: u64,
pub PowerOnHours: [u8; 16],
pub PowerCycleCount: u64,
pub PciVendorId: u16,
pub PciSubsystemVendorId: u16,
pub SerialNumber: [u8; 20],
pub ModelNumber: [u8; 40],
pub NVMSubsystemNVMeQualifiedName: [u8; 256],
pub Reserved: [u8; 108],
pub SupportedEventsBitmap: [u8; 32],
}import "golang.org/x/sys/windows"
type NVME_PERSISTENT_EVENT_LOG_HEADER struct {
LogIdentifier byte
Reserved0 [3]byte
TotalNumberOfEvents uint32
TotalLogLength uint64
LogRevision byte
Reserved1 byte
LogHeaderLength uint16
Timestamp uint64
PowerOnHours [16]byte
PowerCycleCount uint64
PciVendorId uint16
PciSubsystemVendorId uint16
SerialNumber [20]byte
ModelNumber [40]byte
NVMSubsystemNVMeQualifiedName [256]byte
Reserved [108]byte
SupportedEventsBitmap [32]byte
}type
NVME_PERSISTENT_EVENT_LOG_HEADER = packed record
LogIdentifier: Byte;
Reserved0: array[0..2] of Byte;
TotalNumberOfEvents: DWORD;
TotalLogLength: UInt64;
LogRevision: Byte;
Reserved1: Byte;
LogHeaderLength: Word;
Timestamp: UInt64;
PowerOnHours: array[0..15] of Byte;
PowerCycleCount: UInt64;
PciVendorId: Word;
PciSubsystemVendorId: Word;
SerialNumber: array[0..19] of Byte;
ModelNumber: array[0..39] of Byte;
NVMSubsystemNVMeQualifiedName: array[0..255] of Byte;
Reserved: array[0..107] of Byte;
SupportedEventsBitmap: array[0..31] of Byte;
end;const NVME_PERSISTENT_EVENT_LOG_HEADER = extern struct {
LogIdentifier: u8,
Reserved0: [3]u8,
TotalNumberOfEvents: u32,
TotalLogLength: u64,
LogRevision: u8,
Reserved1: u8,
LogHeaderLength: u16,
Timestamp: u64,
PowerOnHours: [16]u8,
PowerCycleCount: u64,
PciVendorId: u16,
PciSubsystemVendorId: u16,
SerialNumber: [20]u8,
ModelNumber: [40]u8,
NVMSubsystemNVMeQualifiedName: [256]u8,
Reserved: [108]u8,
SupportedEventsBitmap: [32]u8,
};type
NVME_PERSISTENT_EVENT_LOG_HEADER {.packed.} = object
LogIdentifier: uint8
Reserved0: array[3, uint8]
TotalNumberOfEvents: uint32
TotalLogLength: uint64
LogRevision: uint8
Reserved1: uint8
LogHeaderLength: uint16
Timestamp: uint64
PowerOnHours: array[16, uint8]
PowerCycleCount: uint64
PciVendorId: uint16
PciSubsystemVendorId: uint16
SerialNumber: array[20, uint8]
ModelNumber: array[40, uint8]
NVMSubsystemNVMeQualifiedName: array[256, uint8]
Reserved: array[108, uint8]
SupportedEventsBitmap: array[32, uint8]align(1)
struct NVME_PERSISTENT_EVENT_LOG_HEADER
{
ubyte LogIdentifier;
ubyte[3] Reserved0;
uint TotalNumberOfEvents;
ulong TotalLogLength;
ubyte LogRevision;
ubyte Reserved1;
ushort LogHeaderLength;
ulong Timestamp;
ubyte[16] PowerOnHours;
ulong PowerCycleCount;
ushort PciVendorId;
ushort PciSubsystemVendorId;
ubyte[20] SerialNumber;
ubyte[40] ModelNumber;
ubyte[256] NVMSubsystemNVMeQualifiedName;
ubyte[108] Reserved;
ubyte[32] SupportedEventsBitmap;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NVME_PERSISTENT_EVENT_LOG_HEADER サイズ: 512 バイト(x64)
dim st, 128 ; 4byte整数×128(構造体サイズ 512 / 4 切り上げ)
; LogIdentifier : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; Reserved0 : BYTE (+1, 3byte) varptr(st)+1 を基点に操作(3byte:入れ子/配列)
; TotalNumberOfEvents : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; TotalLogLength : ULONGLONG (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; LogRevision : BYTE (+16, 1byte) poke st,16,値 / 値 = peek(st,16)
; Reserved1 : BYTE (+17, 1byte) poke st,17,値 / 値 = peek(st,17)
; LogHeaderLength : WORD (+18, 2byte) wpoke st,18,値 / 値 = wpeek(st,18)
; Timestamp : ULONGLONG (+20, 8byte) qpoke st,20,値 / qpeek(st,20) ※IronHSPのみ。3.7/3.8は lpoke st,20,下位 : lpoke st,24,上位
; PowerOnHours : BYTE (+28, 16byte) varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; PowerCycleCount : ULONGLONG (+44, 8byte) qpoke st,44,値 / qpeek(st,44) ※IronHSPのみ。3.7/3.8は lpoke st,44,下位 : lpoke st,48,上位
; PciVendorId : WORD (+52, 2byte) wpoke st,52,値 / 値 = wpeek(st,52)
; PciSubsystemVendorId : WORD (+54, 2byte) wpoke st,54,値 / 値 = wpeek(st,54)
; SerialNumber : BYTE (+56, 20byte) varptr(st)+56 を基点に操作(20byte:入れ子/配列)
; ModelNumber : BYTE (+76, 40byte) varptr(st)+76 を基点に操作(40byte:入れ子/配列)
; NVMSubsystemNVMeQualifiedName : BYTE (+116, 256byte) varptr(st)+116 を基点に操作(256byte:入れ子/配列)
; Reserved : BYTE (+372, 108byte) varptr(st)+372 を基点に操作(108byte:入れ子/配列)
; SupportedEventsBitmap : BYTE (+480, 32byte) varptr(st)+480 を基点に操作(32byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NVME_PERSISTENT_EVENT_LOG_HEADER, pack=1
#field byte LogIdentifier
#field byte Reserved0 3
#field int TotalNumberOfEvents
#field int64 TotalLogLength
#field byte LogRevision
#field byte Reserved1
#field short LogHeaderLength
#field int64 Timestamp
#field byte PowerOnHours 16
#field int64 PowerCycleCount
#field short PciVendorId
#field short PciSubsystemVendorId
#field byte SerialNumber 20
#field byte ModelNumber 40
#field byte NVMSubsystemNVMeQualifiedName 256
#field byte Reserved 108
#field byte SupportedEventsBitmap 32
#endstruct
stdim st, NVME_PERSISTENT_EVENT_LOG_HEADER ; NSTRUCT 変数を確保
st->LogIdentifier = 100
mes "LogIdentifier=" + st->LogIdentifier