ホーム › Storage.Nvme › NVMEOF_CONNECT_RESPONSE
NVMEOF_CONNECT_RESPONSE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| SCSpecific | _SCSpecific_e__Union | 8/4 | +0 | +0 | Connect応答に固有のステータスや割り当て情報を格納する共用体である。 |
| Reserved0 | DWORD | 4 | +8 | +4 | 将来の拡張用に予約された32ビットフィールドである。 |
| SQHD | WORD | 2 | +12 | +8 | 送信キューヘッドポインタ(SQ Head Pointer)を表す16ビット値である。 |
| Reserved1 | WORD | 2 | +14 | +10 | 将来の拡張用に予約された16ビットフィールドである。 |
| CID | WORD | 2 | +16 | +12 | 対応するコマンドの識別子(Command Identifier)を表す16ビット値である。 |
| STS | WORD | 2 | +18 | +14 | 完了状態を示すステータスフィールド(Status)を表す16ビット値である。 |
共用体: _SCSpecific_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| Success | _Success_e__Struct | 8/4 | +0 | +0 |
| AsUlong | DWORD | 4 | +0 | +0 |
各言語での定義
#include <windows.h>
// NVMEOF_CONNECT_RESPONSE (x64 24 / x86 16 バイト)
typedef struct NVMEOF_CONNECT_RESPONSE {
_SCSpecific_e__Union SCSpecific;
DWORD Reserved0;
WORD SQHD;
WORD Reserved1;
WORD CID;
WORD STS;
} NVMEOF_CONNECT_RESPONSE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVMEOF_CONNECT_RESPONSE
{
public _SCSpecific_e__Union SCSpecific;
public uint Reserved0;
public ushort SQHD;
public ushort Reserved1;
public ushort CID;
public ushort STS;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVMEOF_CONNECT_RESPONSE
Public SCSpecific As _SCSpecific_e__Union
Public Reserved0 As UInteger
Public SQHD As UShort
Public Reserved1 As UShort
Public CID As UShort
Public STS As UShort
End Structureimport ctypes
from ctypes import wintypes
class NVMEOF_CONNECT_RESPONSE(ctypes.Structure):
_fields_ = [
("SCSpecific", _SCSpecific_e__Union),
("Reserved0", wintypes.DWORD),
("SQHD", ctypes.c_ushort),
("Reserved1", ctypes.c_ushort),
("CID", ctypes.c_ushort),
("STS", ctypes.c_ushort),
]#[repr(C)]
pub struct NVMEOF_CONNECT_RESPONSE {
pub SCSpecific: _SCSpecific_e__Union,
pub Reserved0: u32,
pub SQHD: u16,
pub Reserved1: u16,
pub CID: u16,
pub STS: u16,
}import "golang.org/x/sys/windows"
type NVMEOF_CONNECT_RESPONSE struct {
SCSpecific _SCSpecific_e__Union
Reserved0 uint32
SQHD uint16
Reserved1 uint16
CID uint16
STS uint16
}type
NVMEOF_CONNECT_RESPONSE = record
SCSpecific: _SCSpecific_e__Union;
Reserved0: DWORD;
SQHD: Word;
Reserved1: Word;
CID: Word;
STS: Word;
end;const NVMEOF_CONNECT_RESPONSE = extern struct {
SCSpecific: _SCSpecific_e__Union,
Reserved0: u32,
SQHD: u16,
Reserved1: u16,
CID: u16,
STS: u16,
};type
NVMEOF_CONNECT_RESPONSE {.bycopy.} = object
SCSpecific: _SCSpecific_e__Union
Reserved0: uint32
SQHD: uint16
Reserved1: uint16
CID: uint16
STS: uint16struct NVMEOF_CONNECT_RESPONSE
{
_SCSpecific_e__Union SCSpecific;
uint Reserved0;
ushort SQHD;
ushort Reserved1;
ushort CID;
ushort STS;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; NVMEOF_CONNECT_RESPONSE サイズ: 16 バイト(x86)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; SCSpecific : _SCSpecific_e__Union (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; Reserved0 : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; SQHD : WORD (+8, 2byte) wpoke st,8,値 / 値 = wpeek(st,8)
; Reserved1 : WORD (+10, 2byte) wpoke st,10,値 / 値 = wpeek(st,10)
; CID : WORD (+12, 2byte) wpoke st,12,値 / 値 = wpeek(st,12)
; STS : WORD (+14, 2byte) wpoke st,14,値 / 値 = wpeek(st,14)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NVMEOF_CONNECT_RESPONSE サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; SCSpecific : _SCSpecific_e__Union (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; Reserved0 : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; SQHD : WORD (+12, 2byte) wpoke st,12,値 / 値 = wpeek(st,12)
; Reserved1 : WORD (+14, 2byte) wpoke st,14,値 / 値 = wpeek(st,14)
; CID : WORD (+16, 2byte) wpoke st,16,値 / 値 = wpeek(st,16)
; STS : WORD (+18, 2byte) wpoke st,18,値 / 値 = wpeek(st,18)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global NVMEOF_CONNECT_RESPONSE
#field byte SCSpecific 8
#field int Reserved0
#field short SQHD
#field short Reserved1
#field short CID
#field short STS
#endstruct
stdim st, NVMEOF_CONNECT_RESPONSE ; NSTRUCT 変数を確保
st->Reserved0 = 100
mes "Reserved0=" + st->Reserved0
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。