ホーム › Storage.Nvme › NVME_SGL_KEYDATABLOCK_DESC
NVME_SGL_KEYDATABLOCK_DESC
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Address | ULONGLONG | 8 | +0 | +0 | キー付きデータブロックが格納されたメモリの先頭アドレスを表す64ビット値である。 |
| Length | BYTE | 3 | +8 | +8 | キー付きデータブロックの長さを表すバイト列である。 |
| Key | BYTE | 4 | +11 | +11 | リモートメモリへのアクセスに用いるキー(Key)を表すバイト列である。 |
| 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_KEYDATABLOCK_DESC (x64 24 / x86 24 バイト)
typedef struct NVME_SGL_KEYDATABLOCK_DESC {
ULONGLONG Address;
BYTE Length[3];
BYTE Key[4];
_Identifier_e__Union Identifier;
} NVME_SGL_KEYDATABLOCK_DESC;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_SGL_KEYDATABLOCK_DESC
{
public ulong Address;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] Length;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] Key;
public _Identifier_e__Union Identifier;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_SGL_KEYDATABLOCK_DESC
Public Address As ULong
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public Length() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public Key() As Byte
Public Identifier As _Identifier_e__Union
End Structureimport ctypes
from ctypes import wintypes
class NVME_SGL_KEYDATABLOCK_DESC(ctypes.Structure):
_fields_ = [
("Address", ctypes.c_ulonglong),
("Length", ctypes.c_ubyte * 3),
("Key", ctypes.c_ubyte * 4),
("Identifier", _Identifier_e__Union),
]#[repr(C)]
pub struct NVME_SGL_KEYDATABLOCK_DESC {
pub Address: u64,
pub Length: [u8; 3],
pub Key: [u8; 4],
pub Identifier: _Identifier_e__Union,
}import "golang.org/x/sys/windows"
type NVME_SGL_KEYDATABLOCK_DESC struct {
Address uint64
Length [3]byte
Key [4]byte
Identifier _Identifier_e__Union
}type
NVME_SGL_KEYDATABLOCK_DESC = record
Address: UInt64;
Length: array[0..2] of Byte;
Key: array[0..3] of Byte;
Identifier: _Identifier_e__Union;
end;const NVME_SGL_KEYDATABLOCK_DESC = extern struct {
Address: u64,
Length: [3]u8,
Key: [4]u8,
Identifier: _Identifier_e__Union,
};type
NVME_SGL_KEYDATABLOCK_DESC {.bycopy.} = object
Address: uint64
Length: array[3, uint8]
Key: array[4, uint8]
Identifier: _Identifier_e__Unionstruct NVME_SGL_KEYDATABLOCK_DESC
{
ulong Address;
ubyte[3] Length;
ubyte[4] Key;
_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_KEYDATABLOCK_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 : BYTE (+8, 3byte) varptr(st)+8 を基点に操作(3byte:入れ子/配列)
; Key : BYTE (+11, 4byte) varptr(st)+11 を基点に操作(4byte:入れ子/配列)
; 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_KEYDATABLOCK_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 : BYTE (+8, 3byte) varptr(st)+8 を基点に操作(3byte:入れ子/配列)
; Key : BYTE (+11, 4byte) varptr(st)+11 を基点に操作(4byte:入れ子/配列)
; 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_KEYDATABLOCK_DESC
#field int64 Address
#field byte Length 3
#field byte Key 4
#field byte Identifier 8
#endstruct
stdim st, NVME_SGL_KEYDATABLOCK_DESC ; NSTRUCT 変数を確保
st->Address = 100
mes "Address=" + st->Address
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。