Annotation of nono/vm/virtio_block.h, revision 1.1.1.2

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2024 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
                      7: //
                      8: // VirtIO ブロックデバイス
                      9: //
                     10: 
                     11: #pragma once
                     12: 
                     13: #include "virtio_base.h"
                     14: #include "diskimage.h"
                     15: #include "monitor.h"
                     16: #include "scsidev.h"
                     17: 
                     18: class VirtIOBlockDevice : public VirtIODevice
                     19: {
                     20:        using inherited = VirtIODevice;
                     21: 
                     22:  public:
1.1.1.2 ! root       23:        VirtIOBlockDevice(uint slot_, uint id_);
1.1       root       24:        ~VirtIOBlockDevice() override;
                     25: 
                     26:        bool Init() override;
                     27: 
                     28:        // メディアの書き込みモードを返す
                     29:        SCSIDisk::RW GetWriteMode() const { return write_mode; }
                     30: 
                     31:        // 現在のアクセス状況を返す
                     32:        uint32 GetAccessRead() const    { return access_read; }
                     33:        uint32 GetAccessWrite() const   { return access_write; }
                     34: 
                     35:  private:
                     36:        DECLARE_MONITOR_CALLBACK(MonitorUpdate);
                     37: 
1.1.1.2 ! root       38:        const char *GetFeatureName(uint feature) const override;
1.1       root       39: 
                     40:        bool LoadDisk(const std::string& pathname_);
                     41: 
                     42:        // ディスクリプタを一つ処理する。
1.1.1.2 ! root       43:        void ProcessDesc(VirtIOReq&) override;
        !            44:        uint32 CmdRead(VirtIOReq&, uint64 sector, uint32 datalen);
        !            45:        uint32 CmdWrite(VirtIOReq&, uint64 sector, uint32 datalen);
1.1       root       46: 
1.1.1.2 ! root       47:        uint id {};                                     // 識別番号
1.1       root       48:        std::string pathname {};        // イメージファイルのフルパス
                     49:        bool write_ignore {};           // 書き込み無視オプション
                     50: 
                     51:        DiskImage image {};                     // イメージファイル
                     52:        uint32 blocksize {};            // 論理ブロック長
                     53:        SCSIDisk::RW write_mode {};     // メディアの書き込みモード
                     54: 
                     55:        // アクセスインジケータ (GUI) 用のカウンタ。
                     56:        uint32 access_read {};
                     57:        uint32 access_write {};
                     58: };

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.