ホーム › Storage.Nvme › NVMEOF_DISCONNECT_COMMAND
NVMEOF_DISCONNECT_COMMAND
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| OPC | BYTE | 1 | +0 | +0 | Fabricsコマンドを示すオペコードを表す8ビット値である。 |
| Reserved0 | BYTE | 1 | +1 | +1 | 将来の拡張用に予約された未使用バイトである。 |
| CID | WORD | 2 | +2 | +2 | コマンド識別子(Command Identifier)を表す16ビット値である。 |
| FCTYPE | BYTE | 1 | +4 | +4 | Disconnectコマンドを示すFabricsコマンド種別を表す8ビット値である。 |
| Reserved1 | BYTE | 19 | +5 | +5 | 将来の拡張用に予約された未使用バイト列である。 |
| SGL1 | NVME_SGL_DATABLOCK_DESC | 24 | +24 | +24 | Disconnect用データを指すSGLデータブロック記述子である。 |
| RECFMT | WORD | 2 | +48 | +48 | レコードフォーマット(Record Format)を表す16ビット値である。 |
| Reserved2 | BYTE | 22 | +50 | +50 | 将来の拡張用に予約された未使用バイト列である。 |
各言語での定義
#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;
// NVMEOF_DISCONNECT_COMMAND (x64 72 / x86 72 バイト)
typedef struct NVMEOF_DISCONNECT_COMMAND {
BYTE OPC;
BYTE Reserved0;
WORD CID;
BYTE FCTYPE;
BYTE Reserved1[19];
NVME_SGL_DATABLOCK_DESC SGL1;
WORD RECFMT;
BYTE Reserved2[22];
} NVMEOF_DISCONNECT_COMMAND;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;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NVMEOF_DISCONNECT_COMMAND
{
public byte OPC;
public byte Reserved0;
public ushort CID;
public byte FCTYPE;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] public byte[] Reserved1;
public NVME_SGL_DATABLOCK_DESC SGL1;
public ushort RECFMT;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)] public byte[] Reserved2;
}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 Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NVMEOF_DISCONNECT_COMMAND
Public OPC As Byte
Public Reserved0 As Byte
Public CID As UShort
Public FCTYPE As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=19)> Public Reserved1() As Byte
Public SGL1 As NVME_SGL_DATABLOCK_DESC
Public RECFMT As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=22)> Public Reserved2() As Byte
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),
]
class NVMEOF_DISCONNECT_COMMAND(ctypes.Structure):
_fields_ = [
("OPC", ctypes.c_ubyte),
("Reserved0", ctypes.c_ubyte),
("CID", ctypes.c_ushort),
("FCTYPE", ctypes.c_ubyte),
("Reserved1", ctypes.c_ubyte * 19),
("SGL1", NVME_SGL_DATABLOCK_DESC),
("RECFMT", ctypes.c_ushort),
("Reserved2", ctypes.c_ubyte * 22),
]#[repr(C)]
pub struct NVME_SGL_DATABLOCK_DESC {
pub Address: u64,
pub Length: u32,
pub Reserved0: [u8; 3],
pub Identifier: _Identifier_e__Union,
}
#[repr(C)]
pub struct NVMEOF_DISCONNECT_COMMAND {
pub OPC: u8,
pub Reserved0: u8,
pub CID: u16,
pub FCTYPE: u8,
pub Reserved1: [u8; 19],
pub SGL1: NVME_SGL_DATABLOCK_DESC,
pub RECFMT: u16,
pub Reserved2: [u8; 22],
}import "golang.org/x/sys/windows"
type NVME_SGL_DATABLOCK_DESC struct {
Address uint64
Length uint32
Reserved0 [3]byte
Identifier _Identifier_e__Union
}
type NVMEOF_DISCONNECT_COMMAND struct {
OPC byte
Reserved0 byte
CID uint16
FCTYPE byte
Reserved1 [19]byte
SGL1 NVME_SGL_DATABLOCK_DESC
RECFMT uint16
Reserved2 [22]byte
}type
NVME_SGL_DATABLOCK_DESC = record
Address: UInt64;
Length: DWORD;
Reserved0: array[0..2] of Byte;
Identifier: _Identifier_e__Union;
end;
NVMEOF_DISCONNECT_COMMAND = record
OPC: Byte;
Reserved0: Byte;
CID: Word;
FCTYPE: Byte;
Reserved1: array[0..18] of Byte;
SGL1: NVME_SGL_DATABLOCK_DESC;
RECFMT: Word;
Reserved2: array[0..21] of Byte;
end;const NVME_SGL_DATABLOCK_DESC = extern struct {
Address: u64,
Length: u32,
Reserved0: [3]u8,
Identifier: _Identifier_e__Union,
};
const NVMEOF_DISCONNECT_COMMAND = extern struct {
OPC: u8,
Reserved0: u8,
CID: u16,
FCTYPE: u8,
Reserved1: [19]u8,
SGL1: NVME_SGL_DATABLOCK_DESC,
RECFMT: u16,
Reserved2: [22]u8,
};type
NVME_SGL_DATABLOCK_DESC {.bycopy.} = object
Address: uint64
Length: uint32
Reserved0: array[3, uint8]
Identifier: _Identifier_e__Union
NVMEOF_DISCONNECT_COMMAND {.bycopy.} = object
OPC: uint8
Reserved0: uint8
CID: uint16
FCTYPE: uint8
Reserved1: array[19, uint8]
SGL1: NVME_SGL_DATABLOCK_DESC
RECFMT: uint16
Reserved2: array[22, uint8]struct NVME_SGL_DATABLOCK_DESC
{
ulong Address;
uint Length;
ubyte[3] Reserved0;
_Identifier_e__Union Identifier;
}
struct NVMEOF_DISCONNECT_COMMAND
{
ubyte OPC;
ubyte Reserved0;
ushort CID;
ubyte FCTYPE;
ubyte[19] Reserved1;
NVME_SGL_DATABLOCK_DESC SGL1;
ushort RECFMT;
ubyte[22] Reserved2;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; NVMEOF_DISCONNECT_COMMAND サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; OPC : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; Reserved0 : BYTE (+1, 1byte) poke st,1,値 / 値 = peek(st,1)
; CID : WORD (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; FCTYPE : BYTE (+4, 1byte) poke st,4,値 / 値 = peek(st,4)
; Reserved1 : BYTE (+5, 19byte) varptr(st)+5 を基点に操作(19byte:入れ子/配列)
; SGL1 : NVME_SGL_DATABLOCK_DESC (+24, 24byte) varptr(st)+24 を基点に操作(24byte:入れ子/配列)
; RECFMT : WORD (+48, 2byte) wpoke st,48,値 / 値 = wpeek(st,48)
; Reserved2 : BYTE (+50, 22byte) varptr(st)+50 を基点に操作(22byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global NVME_SGL_DATABLOCK_DESC
#field int64 Address
#field int Length
#field byte Reserved0 3
#field byte Identifier 8
#endstruct
#defstruct global NVMEOF_DISCONNECT_COMMAND
#field byte OPC
#field byte Reserved0
#field short CID
#field byte FCTYPE
#field byte Reserved1 19
#field NVME_SGL_DATABLOCK_DESC SGL1
#field short RECFMT
#field byte Reserved2 22
#endstruct
stdim st, NVMEOF_DISCONNECT_COMMAND ; NSTRUCT 変数を確保
st->OPC = 100
mes "OPC=" + st->OPC