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

NVME_LBA_ZONE_FORMAT

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

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

フィールド

フィールドサイズx64x86説明
ZoneSizeULONGLONG8+0+0ゾーンのサイズ。論理ブロック数で表すZNS用の値である。
ZDESBYTE1+8+8ゾーン記述子拡張サイズ。64バイト単位で表す。
ReservedBYTE7+9+9予約領域。将来拡張用で0とする。

各言語での定義

#include <windows.h>

// NVME_LBA_ZONE_FORMAT  (x64 16 / x86 16 バイト)
typedef struct NVME_LBA_ZONE_FORMAT {
    ULONGLONG ZoneSize;
    BYTE ZDES;
    BYTE Reserved[7];
} NVME_LBA_ZONE_FORMAT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_LBA_ZONE_FORMAT
{
    public ulong ZoneSize;
    public byte ZDES;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] public byte[] Reserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_LBA_ZONE_FORMAT
    Public ZoneSize As ULong
    Public ZDES As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=7)> Public Reserved() As Byte
End Structure
import ctypes
from ctypes import wintypes

class NVME_LBA_ZONE_FORMAT(ctypes.Structure):
    _fields_ = [
        ("ZoneSize", ctypes.c_ulonglong),
        ("ZDES", ctypes.c_ubyte),
        ("Reserved", ctypes.c_ubyte * 7),
    ]
#[repr(C)]
pub struct NVME_LBA_ZONE_FORMAT {
    pub ZoneSize: u64,
    pub ZDES: u8,
    pub Reserved: [u8; 7],
}
import "golang.org/x/sys/windows"

type NVME_LBA_ZONE_FORMAT struct {
	ZoneSize uint64
	ZDES byte
	Reserved [7]byte
}
type
  NVME_LBA_ZONE_FORMAT = record
    ZoneSize: UInt64;
    ZDES: Byte;
    Reserved: array[0..6] of Byte;
  end;
const NVME_LBA_ZONE_FORMAT = extern struct {
    ZoneSize: u64,
    ZDES: u8,
    Reserved: [7]u8,
};
type
  NVME_LBA_ZONE_FORMAT {.bycopy.} = object
    ZoneSize: uint64
    ZDES: uint8
    Reserved: array[7, uint8]
struct NVME_LBA_ZONE_FORMAT
{
    ulong ZoneSize;
    ubyte ZDES;
    ubyte[7] Reserved;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NVME_LBA_ZONE_FORMAT サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; ZoneSize : ULONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; ZDES : BYTE (+8, 1byte)  poke st,8,値  /  値 = peek(st,8)
; Reserved : BYTE (+9, 7byte)  varptr(st)+9 を基点に操作(7byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NVME_LBA_ZONE_FORMAT
    #field int64 ZoneSize
    #field byte ZDES
    #field byte Reserved 7
#endstruct

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