ホーム › Storage.Nvme › NVME_RESERVATION_REPORT_STATUS_HEADER
NVME_RESERVATION_REPORT_STATUS_HEADER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| GEN | DWORD | 4 | +0 | +0 | 予約状態の世代カウンタ(Generation)で、予約状態が変化するたびに増加する32ビット値である。 |
| RTYPE | BYTE | 1 | +4 | +4 | 現在有効な予約タイプ(Reservation Type)を示す8ビット値である。 |
| REGCTL | WORD | 2 | +5 | +5 | 登録済みコントローラの数(Number of Registered Controllers)を表す16ビット値である。 |
| Reserved | BYTE | 2 | +7 | +7 | 将来の拡張用に予約された未使用バイトである。 |
| PTPLS | BYTE | 1 | +9 | +9 | 電源喪失後も予約を保持する状態(Persist Through Power Loss State)を示す8ビット値である。 |
| Reserved1 | BYTE | 14 | +10 | +10 | 将来の拡張用に予約された未使用バイトである。 |
各言語での定義
#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)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;
}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 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),
]#[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],
}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_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;const NVME_RESERVATION_REPORT_STATUS_HEADER = extern struct {
GEN: u32,
RTYPE: u8,
REGCTL: u16,
Reserved: [2]u8,
PTPLS: u8,
Reserved1: [14]u8,
};type
NVME_RESERVATION_REPORT_STATUS_HEADER {.packed.} = object
GEN: uint32
RTYPE: uint8
REGCTL: uint16
Reserved: array[2, uint8]
PTPLS: uint8
Reserved1: array[14, uint8]align(1)
struct NVME_RESERVATION_REPORT_STATUS_HEADER
{
uint GEN;
ubyte RTYPE;
ushort REGCTL;
ubyte[2] Reserved;
ubyte PTPLS;
ubyte[14] 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_RESERVATION_REPORT_STATUS_HEADER サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; GEN : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; RTYPE : BYTE (+4, 1byte) poke st,4,値 / 値 = peek(st,4)
; REGCTL : WORD (+5, 2byte) wpoke st,5,値 / 値 = wpeek(st,5)
; Reserved : BYTE (+7, 2byte) varptr(st)+7 を基点に操作(2byte:入れ子/配列)
; PTPLS : BYTE (+9, 1byte) poke st,9,値 / 値 = peek(st,9)
; Reserved1 : BYTE (+10, 14byte) varptr(st)+10 を基点に操作(14byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#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
stdim st, NVME_RESERVATION_REPORT_STATUS_HEADER ; NSTRUCT 変数を確保
st->GEN = 100
mes "GEN=" + st->GEN