ホーム › Storage.Nvme › NVME_FEATURE_HOST_METADATA_DATA
NVME_FEATURE_HOST_METADATA_DATA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| NumberOfMetadataElementDescriptors | BYTE | 1 | +0 | +0 | 続くメタデータ要素記述子の個数。 |
| Reserved0 | BYTE | 1 | +1 | +1 | 予約領域。将来拡張用で0とする。 |
| MetadataElementDescriptors | BYTE | 4094 | +2 | +2 | メタデータ要素記述子群の先頭バイト。可変長である。 |
各言語での定義
#include <windows.h>
// NVME_FEATURE_HOST_METADATA_DATA (x64 4096 / x86 4096 バイト)
typedef struct NVME_FEATURE_HOST_METADATA_DATA {
BYTE NumberOfMetadataElementDescriptors;
BYTE Reserved0;
BYTE MetadataElementDescriptors[4094];
} NVME_FEATURE_HOST_METADATA_DATA;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVME_FEATURE_HOST_METADATA_DATA
{
public byte NumberOfMetadataElementDescriptors;
public byte Reserved0;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4094)] public byte[] MetadataElementDescriptors;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVME_FEATURE_HOST_METADATA_DATA
Public NumberOfMetadataElementDescriptors As Byte
Public Reserved0 As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=4094)> Public MetadataElementDescriptors() As Byte
End Structureimport ctypes
from ctypes import wintypes
class NVME_FEATURE_HOST_METADATA_DATA(ctypes.Structure):
_fields_ = [
("NumberOfMetadataElementDescriptors", ctypes.c_ubyte),
("Reserved0", ctypes.c_ubyte),
("MetadataElementDescriptors", ctypes.c_ubyte * 4094),
]#[repr(C)]
pub struct NVME_FEATURE_HOST_METADATA_DATA {
pub NumberOfMetadataElementDescriptors: u8,
pub Reserved0: u8,
pub MetadataElementDescriptors: [u8; 4094],
}import "golang.org/x/sys/windows"
type NVME_FEATURE_HOST_METADATA_DATA struct {
NumberOfMetadataElementDescriptors byte
Reserved0 byte
MetadataElementDescriptors [4094]byte
}type
NVME_FEATURE_HOST_METADATA_DATA = record
NumberOfMetadataElementDescriptors: Byte;
Reserved0: Byte;
MetadataElementDescriptors: array[0..4093] of Byte;
end;const NVME_FEATURE_HOST_METADATA_DATA = extern struct {
NumberOfMetadataElementDescriptors: u8,
Reserved0: u8,
MetadataElementDescriptors: [4094]u8,
};type
NVME_FEATURE_HOST_METADATA_DATA {.bycopy.} = object
NumberOfMetadataElementDescriptors: uint8
Reserved0: uint8
MetadataElementDescriptors: array[4094, uint8]struct NVME_FEATURE_HOST_METADATA_DATA
{
ubyte NumberOfMetadataElementDescriptors;
ubyte Reserved0;
ubyte[4094] MetadataElementDescriptors;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NVME_FEATURE_HOST_METADATA_DATA サイズ: 4096 バイト(x64)
dim st, 1024 ; 4byte整数×1024(構造体サイズ 4096 / 4 切り上げ)
; NumberOfMetadataElementDescriptors : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; Reserved0 : BYTE (+1, 1byte) poke st,1,値 / 値 = peek(st,1)
; MetadataElementDescriptors : BYTE (+2, 4094byte) varptr(st)+2 を基点に操作(4094byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NVME_FEATURE_HOST_METADATA_DATA
#field byte NumberOfMetadataElementDescriptors
#field byte Reserved0
#field byte MetadataElementDescriptors 4094
#endstruct
stdim st, NVME_FEATURE_HOST_METADATA_DATA ; NSTRUCT 変数を確保
st->NumberOfMetadataElementDescriptors = 100
mes "NumberOfMetadataElementDescriptors=" + st->NumberOfMetadataElementDescriptors