--- nono/host/diskimage.h 2026/04/29 17:05:00 1.1.1.2 +++ nono/host/diskimage.h 2026/04/29 17:05:30 1.1.1.4 @@ -6,8 +6,9 @@ #pragma once -#include "header.h" +#include "nono.h" #include "autofd.h" +#include #include // ディスクイメージを実際に処理するドライバ @@ -15,10 +16,10 @@ class DiskImageDriver { public: - DiskImageDriver(const std::string& pathname_); + explicit DiskImageDriver(const std::string& pathname_); virtual ~DiskImageDriver(); - virtual bool GetInfo(off_t *size, bool *w_ok) = 0; + virtual int IsWriteable() const = 0; virtual bool Open(bool read_only) = 0; virtual void Close() = 0; virtual off_t GetSize() const = 0; @@ -46,10 +47,11 @@ class DiskImage // コンストラクタ後最初に実行すること。 bool CreateHandler(const std::string& pathname_); - // このディスクイメージのサイズと書き込み可能かどうかを返す。 + // このディスクイメージが書き込み可能かどうかを返す。 // Open() 前でも動作する。 - // 成功すれば true、失敗なら errno をセットして false を返す。 - bool GetInfo(off_t *size, bool *w_ok); + // 書き込み可能なら 1、不可なら 0 を返す。 + // 失敗なら errno をセットして -1 を返す。 + int IsWriteable() const; // このディスクイメージを実際のアクセス用にオープンする。 // read_only == true なら、ディスクイメージを読み込み専用でオープンする。