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

NVME_RESERVATION_NOTIFICATION_LOG

構造体
サイズx64: 64 バイト / x86: 64 バイト

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

フィールド

フィールドサイズx64x86説明
LogPageCountULONGLONG8+0+0生成された予約通知ログページの通し番号。
LogPageTypeBYTE1+8+8予約通知の種別(登録先取り/予約解放/予約取得等)。
AvailableLogPageCountBYTE1+9+9未取得で利用可能なログページ数。
Reserved0BYTE2+10+10予約領域。将来拡張用で0とする。
NameSpaceIdDWORD4+12+12通知が関連付く名前空間ID。
Reserved1BYTE48+16+16予約領域。将来拡張用で0とする。

各言語での定義

#include <windows.h>

// NVME_RESERVATION_NOTIFICATION_LOG  (x64 64 / x86 64 バイト)
typedef struct NVME_RESERVATION_NOTIFICATION_LOG {
    ULONGLONG LogPageCount;
    BYTE LogPageType;
    BYTE AvailableLogPageCount;
    BYTE Reserved0[2];
    DWORD NameSpaceId;
    BYTE Reserved1[48];
} NVME_RESERVATION_NOTIFICATION_LOG;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_RESERVATION_NOTIFICATION_LOG
{
    public ulong LogPageCount;
    public byte LogPageType;
    public byte AvailableLogPageCount;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] Reserved0;
    public uint NameSpaceId;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)] public byte[] Reserved1;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_RESERVATION_NOTIFICATION_LOG
    Public LogPageCount As ULong
    Public LogPageType As Byte
    Public AvailableLogPageCount As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public Reserved0() As Byte
    Public NameSpaceId As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=48)> Public Reserved1() As Byte
End Structure
import ctypes
from ctypes import wintypes

class NVME_RESERVATION_NOTIFICATION_LOG(ctypes.Structure):
    _fields_ = [
        ("LogPageCount", ctypes.c_ulonglong),
        ("LogPageType", ctypes.c_ubyte),
        ("AvailableLogPageCount", ctypes.c_ubyte),
        ("Reserved0", ctypes.c_ubyte * 2),
        ("NameSpaceId", wintypes.DWORD),
        ("Reserved1", ctypes.c_ubyte * 48),
    ]
#[repr(C)]
pub struct NVME_RESERVATION_NOTIFICATION_LOG {
    pub LogPageCount: u64,
    pub LogPageType: u8,
    pub AvailableLogPageCount: u8,
    pub Reserved0: [u8; 2],
    pub NameSpaceId: u32,
    pub Reserved1: [u8; 48],
}
import "golang.org/x/sys/windows"

type NVME_RESERVATION_NOTIFICATION_LOG struct {
	LogPageCount uint64
	LogPageType byte
	AvailableLogPageCount byte
	Reserved0 [2]byte
	NameSpaceId uint32
	Reserved1 [48]byte
}
type
  NVME_RESERVATION_NOTIFICATION_LOG = record
    LogPageCount: UInt64;
    LogPageType: Byte;
    AvailableLogPageCount: Byte;
    Reserved0: array[0..1] of Byte;
    NameSpaceId: DWORD;
    Reserved1: array[0..47] of Byte;
  end;
const NVME_RESERVATION_NOTIFICATION_LOG = extern struct {
    LogPageCount: u64,
    LogPageType: u8,
    AvailableLogPageCount: u8,
    Reserved0: [2]u8,
    NameSpaceId: u32,
    Reserved1: [48]u8,
};
type
  NVME_RESERVATION_NOTIFICATION_LOG {.bycopy.} = object
    LogPageCount: uint64
    LogPageType: uint8
    AvailableLogPageCount: uint8
    Reserved0: array[2, uint8]
    NameSpaceId: uint32
    Reserved1: array[48, uint8]
struct NVME_RESERVATION_NOTIFICATION_LOG
{
    ulong LogPageCount;
    ubyte LogPageType;
    ubyte AvailableLogPageCount;
    ubyte[2] Reserved0;
    uint NameSpaceId;
    ubyte[48] 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_NOTIFICATION_LOG サイズ: 64 バイト(x64)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; LogPageCount : ULONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; LogPageType : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; AvailableLogPageCount : BYTE (+9, 1byte)  poke st,9,値  /  値 = peek(st,9)
; Reserved0 : BYTE (+10, 2byte)  varptr(st)+10 を基点に操作(2byte:入れ子/配列)
; NameSpaceId : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; Reserved1 : BYTE (+16, 48byte)  varptr(st)+16 を基点に操作(48byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NVME_RESERVATION_NOTIFICATION_LOG
    #field int64 LogPageCount
    #field byte LogPageType
    #field byte AvailableLogPageCount
    #field byte Reserved0 2
    #field int NameSpaceId
    #field byte Reserved1 48
#endstruct

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