ホーム › Storage.Nvme › NVME_SGL_DATABLOCK_DESC
NVME_SGL_DATABLOCK_DESC
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Address | ULONGLONG | 8 | +0 | +0 | データブロックが格納されたメモリの先頭アドレスを表す64ビット値である。 |
| Length | DWORD | 4 | +8 | +8 | データブロックの長さ(Length)をバイト単位で表す32ビット値である。 |
| Reserved0 | BYTE | 3 | +12 | +12 | 将来の拡張用に予約された未使用バイト列である。 |
| Identifier | _Identifier_e__Union | 8/4 | +16 | +16 | SGL記述子の種別を識別する共用体である。 |
共用体: _Identifier_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| Anonymous | _Anonymous_e__Struct | 8/4 | +0 | +0 |
| AsUchar | BYTE | 1 | +0 | +0 |
各言語での定義
#include <windows.h>
// NVME_SGL_DATABLOCK_DESC (x64 24 / x86 24 バイト)
typedef struct NVME_SGL_DATABLOCK_DESC {
ULONGLONG Address;
DWORD Length;
BYTE Reserved0[3];
_Identifier_e__Union Identifier;
} NVME_SGL_DATABLOCK_DESC;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_SGL_DATABLOCK_DESC
{
public ulong Address;
public uint Length;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] Reserved0;
public _Identifier_e__Union Identifier;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_SGL_DATABLOCK_DESC
Public Address As ULong
Public Length As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public Reserved0() As Byte
Public Identifier As _Identifier_e__Union
End Structureimport ctypes
from ctypes import wintypes
class NVME_SGL_DATABLOCK_DESC(ctypes.Structure):
_fields_ = [
("Address", ctypes.c_ulonglong),
("Length", wintypes.DWORD),
("Reserved0", ctypes.c_ubyte * 3),
("Identifier", _Identifier_e__Union),
]#[repr(C)]
pub struct NVME_SGL_DATABLOCK_DESC {
pub Address: u64,
pub Length: u32,
pub Reserved0: [u8; 3],
pub Identifier: _Identifier_e__Union,
}import "golang.org/x/sys/windows"
type NVME_SGL_DATABLOCK_DESC struct {
Address uint64
Length uint32
Reserved0 [3]byte
Identifier _Identifier_e__Union
}type
NVME_SGL_DATABLOCK_DESC = record
Address: UInt64;
Length: DWORD;
Reserved0: array[0..2] of Byte;
Identifier: _Identifier_e__Union;
end;const NVME_SGL_DATABLOCK_DESC = extern struct {
Address: u64,
Length: u32,
Reserved0: [3]u8,
Identifier: _Identifier_e__Union,
};type
NVME_SGL_DATABLOCK_DESC {.bycopy.} = object
Address: uint64
Length: uint32
Reserved0: array[3, uint8]
Identifier: _Identifier_e__Unionstruct NVME_SGL_DATABLOCK_DESC
{
ulong Address;
uint Length;
ubyte[3] Reserved0;
_Identifier_e__Union Identifier;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; NVME_SGL_DATABLOCK_DESC サイズ: 24 バイト(x86)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Address : ULONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; Length : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Reserved0 : BYTE (+12, 3byte) varptr(st)+12 を基点に操作(3byte:入れ子/配列)
; Identifier : _Identifier_e__Union (+16, 4byte) varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NVME_SGL_DATABLOCK_DESC サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Address : ULONGLONG (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; Length : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Reserved0 : BYTE (+12, 3byte) varptr(st)+12 を基点に操作(3byte:入れ子/配列)
; Identifier : _Identifier_e__Union (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NVME_SGL_DATABLOCK_DESC
#field int64 Address
#field int Length
#field byte Reserved0 3
#field byte Identifier 8
#endstruct
stdim st, NVME_SGL_DATABLOCK_DESC ; NSTRUCT 変数を確保
st->Address = 100
mes "Address=" + st->Address
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。