--- nono/vm/scsicmd.h 2026/04/29 17:04:59 1.1 +++ nono/vm/scsicmd.h 2026/04/29 17:05:18 1.1.1.5 @@ -4,19 +4,18 @@ // Licensed under nono-license.txt // +// // SCSI コマンド +// #pragma once #include "scsi.h" -#include #include // READ/WRITE は多すぎるのでログを省略したい場合に定義。 //#define NO_READWRITE_LOG -class SCSITarget; - // // SCSI コマンドの基本クラス // (黙って成功するコマンドとしても使用可能) @@ -34,8 +33,8 @@ class SCSICmd // OUT(ターゲットが受信側)なら、各フェーズ開始前までに受信バイト数を // recvbytes にセットすること。buf は操作不要。 // なお parent は OUT(受信)フェーズ中にこの recvbytes を変更しない。 - std::vector buf; - uint32 recvbytes; + std::vector buf {}; + uint32 recvbytes {}; // このコマンドの動作時間 [nsec] // シークタイムとかを簡易的に再現するため、次フェーズ遷移時の最初の @@ -96,7 +95,7 @@ class SCSICmd protected: // このコマンドを実行しているターゲットデバイス。 - SCSITarget *parent; + SCSITarget *parent {}; // ステータスバイト (デフォルトは 0 = Good) uint8 status_byte {}; @@ -211,8 +210,6 @@ class SCSICmdModeSense : public SCSICmd SCSI::XferPhase Command(std::vector& cmdseq) override; private: - using PageFunc = std::function; - // Page Control enum PC { Current = 0x00, // 現在値 @@ -222,15 +219,17 @@ class SCSICmdModeSense : public SCSICmd }; // ページ処理関数の戻り値 (この値は大小比較する) enum ModePageResult { - NotImplemented = -1, // 未実装や知らないページ + NotSupported = -1, // 未実装や知らないページ Failed = 0, // 対応しない/出来ないと分かっているページ Success = 1, // 成功 }; + using PageFunc = ModePageResult (SCSICmdModeSense::*)(); + // 個別ページ処理 - int AddNotSupportedPage(); - int AddEmptyPage(); - int AddCachingPage(); + ModePageResult AddNotSupportedPage(); + ModePageResult AddEmptyPage(); + ModePageResult AddCachingPage(); // ページ処理関数のため uint pagecode {}; @@ -238,6 +237,8 @@ class SCSICmdModeSense : public SCSICmd // ログ用の文字列 std::string log {}; + + static const std::vector> Pagelist; }; //