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