ホーム › Storage.Nvme › NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE
NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Header | NVME_RESERVATION_REPORT_STATUS_HEADER | 24 | +0 | +0 | 予約状態の世代やタイプなどを格納するヘッダ構造体である。 |
| Reserved1 | BYTE | 40 | +24 | +24 | 将来の拡張用に予約された未使用バイトである。 |
| RegisteredControllersExtendedData | NVME_REGISTERED_CONTROLLER_EXTENDED_DATA | 64 | +64 | +64 | 拡張形式の登録済みコントローラ予約データ配列の先頭要素である。 |
各言語での定義
#include <windows.h>
// NVME_RESERVATION_REPORT_STATUS_HEADER (x64 24 / x86 24 バイト)
#pragma pack(push, 1)
typedef struct NVME_RESERVATION_REPORT_STATUS_HEADER {
DWORD GEN;
BYTE RTYPE;
WORD REGCTL;
BYTE Reserved[2];
BYTE PTPLS;
BYTE Reserved1[14];
} NVME_RESERVATION_REPORT_STATUS_HEADER;
#pragma pack(pop)
// NVME_REGISTERED_CONTROLLER_EXTENDED_DATA (x64 64 / x86 64 バイト)
typedef struct NVME_REGISTERED_CONTROLLER_EXTENDED_DATA {
WORD CNTLID;
_RCSTS_e__Struct RCSTS;
BYTE Reserved[5];
ULONGLONG RKEY;
BYTE HOSTID[16];
BYTE Reserved1[32];
} NVME_REGISTERED_CONTROLLER_EXTENDED_DATA;
// NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE (x64 128 / x86 128 バイト)
typedef struct NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE {
NVME_RESERVATION_REPORT_STATUS_HEADER Header;
BYTE Reserved1[40];
NVME_REGISTERED_CONTROLLER_EXTENDED_DATA RegisteredControllersExtendedData[1];
} NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct NVME_RESERVATION_REPORT_STATUS_HEADER
{
public uint GEN;
public byte RTYPE;
public ushort REGCTL;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] Reserved;
public byte PTPLS;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] public byte[] Reserved1;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_REGISTERED_CONTROLLER_EXTENDED_DATA
{
public ushort CNTLID;
public _RCSTS_e__Struct RCSTS;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] Reserved;
public ulong RKEY;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] HOSTID;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] Reserved1;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE
{
public NVME_RESERVATION_REPORT_STATUS_HEADER Header;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)] public byte[] Reserved1;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public NVME_REGISTERED_CONTROLLER_EXTENDED_DATA[] RegisteredControllersExtendedData;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure NVME_RESERVATION_REPORT_STATUS_HEADER
Public GEN As UInteger
Public RTYPE As Byte
Public REGCTL As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Reserved() As Byte
Public PTPLS As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=14)> Public Reserved1() As Byte
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_REGISTERED_CONTROLLER_EXTENDED_DATA
Public CNTLID As UShort
Public RCSTS As _RCSTS_e__Struct
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=5)> Public Reserved() As Byte
Public RKEY As ULong
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public HOSTID() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public Reserved1() As Byte
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE
Public Header As NVME_RESERVATION_REPORT_STATUS_HEADER
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=40)> Public Reserved1() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public RegisteredControllersExtendedData() As NVME_REGISTERED_CONTROLLER_EXTENDED_DATA
End Structureimport ctypes
from ctypes import wintypes
class NVME_RESERVATION_REPORT_STATUS_HEADER(ctypes.Structure):
_pack_ = 1
_fields_ = [
("GEN", wintypes.DWORD),
("RTYPE", ctypes.c_ubyte),
("REGCTL", ctypes.c_ushort),
("Reserved", ctypes.c_ubyte * 2),
("PTPLS", ctypes.c_ubyte),
("Reserved1", ctypes.c_ubyte * 14),
]
class NVME_REGISTERED_CONTROLLER_EXTENDED_DATA(ctypes.Structure):
_fields_ = [
("CNTLID", ctypes.c_ushort),
("RCSTS", _RCSTS_e__Struct),
("Reserved", ctypes.c_ubyte * 5),
("RKEY", ctypes.c_ulonglong),
("HOSTID", ctypes.c_ubyte * 16),
("Reserved1", ctypes.c_ubyte * 32),
]
class NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE(ctypes.Structure):
_fields_ = [
("Header", NVME_RESERVATION_REPORT_STATUS_HEADER),
("Reserved1", ctypes.c_ubyte * 40),
("RegisteredControllersExtendedData", NVME_REGISTERED_CONTROLLER_EXTENDED_DATA * 1),
]#[repr(C, packed(1))]
pub struct NVME_RESERVATION_REPORT_STATUS_HEADER {
pub GEN: u32,
pub RTYPE: u8,
pub REGCTL: u16,
pub Reserved: [u8; 2],
pub PTPLS: u8,
pub Reserved1: [u8; 14],
}
#[repr(C)]
pub struct NVME_REGISTERED_CONTROLLER_EXTENDED_DATA {
pub CNTLID: u16,
pub RCSTS: _RCSTS_e__Struct,
pub Reserved: [u8; 5],
pub RKEY: u64,
pub HOSTID: [u8; 16],
pub Reserved1: [u8; 32],
}
#[repr(C)]
pub struct NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE {
pub Header: NVME_RESERVATION_REPORT_STATUS_HEADER,
pub Reserved1: [u8; 40],
pub RegisteredControllersExtendedData: [NVME_REGISTERED_CONTROLLER_EXTENDED_DATA; 1],
}import "golang.org/x/sys/windows"
type NVME_RESERVATION_REPORT_STATUS_HEADER struct {
GEN uint32
RTYPE byte
REGCTL uint16
Reserved [2]byte
PTPLS byte
Reserved1 [14]byte
}
type NVME_REGISTERED_CONTROLLER_EXTENDED_DATA struct {
CNTLID uint16
RCSTS _RCSTS_e__Struct
Reserved [5]byte
RKEY uint64
HOSTID [16]byte
Reserved1 [32]byte
}
type NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE struct {
Header NVME_RESERVATION_REPORT_STATUS_HEADER
Reserved1 [40]byte
RegisteredControllersExtendedData [1]NVME_REGISTERED_CONTROLLER_EXTENDED_DATA
}type
NVME_RESERVATION_REPORT_STATUS_HEADER = packed record
GEN: DWORD;
RTYPE: Byte;
REGCTL: Word;
Reserved: array[0..1] of Byte;
PTPLS: Byte;
Reserved1: array[0..13] of Byte;
end;
NVME_REGISTERED_CONTROLLER_EXTENDED_DATA = record
CNTLID: Word;
RCSTS: _RCSTS_e__Struct;
Reserved: array[0..4] of Byte;
RKEY: UInt64;
HOSTID: array[0..15] of Byte;
Reserved1: array[0..31] of Byte;
end;
NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE = record
Header: NVME_RESERVATION_REPORT_STATUS_HEADER;
Reserved1: array[0..39] of Byte;
RegisteredControllersExtendedData: array[0..0] of NVME_REGISTERED_CONTROLLER_EXTENDED_DATA;
end;const NVME_RESERVATION_REPORT_STATUS_HEADER = extern struct {
GEN: u32,
RTYPE: u8,
REGCTL: u16,
Reserved: [2]u8,
PTPLS: u8,
Reserved1: [14]u8,
};
const NVME_REGISTERED_CONTROLLER_EXTENDED_DATA = extern struct {
CNTLID: u16,
RCSTS: _RCSTS_e__Struct,
Reserved: [5]u8,
RKEY: u64,
HOSTID: [16]u8,
Reserved1: [32]u8,
};
const NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE = extern struct {
Header: NVME_RESERVATION_REPORT_STATUS_HEADER,
Reserved1: [40]u8,
RegisteredControllersExtendedData: [1]NVME_REGISTERED_CONTROLLER_EXTENDED_DATA,
};type
NVME_RESERVATION_REPORT_STATUS_HEADER {.packed.} = object
GEN: uint32
RTYPE: uint8
REGCTL: uint16
Reserved: array[2, uint8]
PTPLS: uint8
Reserved1: array[14, uint8]
NVME_REGISTERED_CONTROLLER_EXTENDED_DATA {.bycopy.} = object
CNTLID: uint16
RCSTS: _RCSTS_e__Struct
Reserved: array[5, uint8]
RKEY: uint64
HOSTID: array[16, uint8]
Reserved1: array[32, uint8]
NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE {.bycopy.} = object
Header: NVME_RESERVATION_REPORT_STATUS_HEADER
Reserved1: array[40, uint8]
RegisteredControllersExtendedData: array[1, NVME_REGISTERED_CONTROLLER_EXTENDED_DATA]align(1)
struct NVME_RESERVATION_REPORT_STATUS_HEADER
{
uint GEN;
ubyte RTYPE;
ushort REGCTL;
ubyte[2] Reserved;
ubyte PTPLS;
ubyte[14] Reserved1;
}
struct NVME_REGISTERED_CONTROLLER_EXTENDED_DATA
{
ushort CNTLID;
_RCSTS_e__Struct RCSTS;
ubyte[5] Reserved;
ulong RKEY;
ubyte[16] HOSTID;
ubyte[32] Reserved1;
}
struct NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE
{
NVME_RESERVATION_REPORT_STATUS_HEADER Header;
ubyte[40] Reserved1;
NVME_REGISTERED_CONTROLLER_EXTENDED_DATA[1] RegisteredControllersExtendedData;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE サイズ: 128 バイト(x64)
dim st, 32 ; 4byte整数×32(構造体サイズ 128 / 4 切り上げ)
; Header : NVME_RESERVATION_REPORT_STATUS_HEADER (+0, 24byte) varptr(st)+0 を基点に操作(24byte:入れ子/配列)
; Reserved1 : BYTE (+24, 40byte) varptr(st)+24 を基点に操作(40byte:入れ子/配列)
; RegisteredControllersExtendedData : NVME_REGISTERED_CONTROLLER_EXTENDED_DATA (+64, 64byte) varptr(st)+64 を基点に操作(64byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global NVME_RESERVATION_REPORT_STATUS_HEADER, pack=1
#field int GEN
#field byte RTYPE
#field short REGCTL
#field byte Reserved 2
#field byte PTPLS
#field byte Reserved1 14
#endstruct
#defstruct global NVME_REGISTERED_CONTROLLER_EXTENDED_DATA
#field short CNTLID
#field _RCSTS_e__Struct RCSTS
#field byte Reserved 5
#field int64 RKEY
#field byte HOSTID 16
#field byte Reserved1 32
#endstruct
#defstruct global NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE
#field NVME_RESERVATION_REPORT_STATUS_HEADER Header
#field byte Reserved1 40
#field NVME_REGISTERED_CONTROLLER_EXTENDED_DATA RegisteredControllersExtendedData 1
#endstruct
stdim st, NVME_RESERVATION_REPORT_STATUS_EXTENDED_DATA_STRUCTURE ; NSTRUCT 変数を確保