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

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 "scsidev.h"
                     16: 
                     17: class VirtIOBlockDevice : public VirtIODevice
                     18: {
                     19:        using inherited = VirtIODevice;
                     20: 
                     21:  public:
1.1.1.2   root       22:        VirtIOBlockDevice(uint slot_, uint id_);
1.1       root       23:        ~VirtIOBlockDevice() override;
                     24: 
                     25:        bool Init() override;
                     26: 
                     27:        // メディアの書き込みモードを返す
                     28:        SCSIDisk::RW GetWriteMode() const { return write_mode; }
                     29: 
                     30:        // 現在のアクセス状況を返す
                     31:        uint32 GetAccessRead() const    { return access_read; }
                     32:        uint32 GetAccessWrite() const   { return access_write; }
                     33: 
                     34:  private:
                     35:        DECLARE_MONITOR_CALLBACK(MonitorUpdate);
                     36: 
1.1.1.2   root       37:        const char *GetFeatureName(uint feature) const override;
1.1       root       38: 
                     39:        bool LoadDisk(const std::string& pathname_);
                     40: 
                     41:        // ディスクリプタを一つ処理する。
1.1.1.2   root       42:        void ProcessDesc(VirtIOReq&) override;
                     43:        uint32 CmdRead(VirtIOReq&, uint64 sector, uint32 datalen);
                     44:        uint32 CmdWrite(VirtIOReq&, uint64 sector, uint32 datalen);
1.1.1.4 ! root       45:        uint32 CmdGetID(VirtIOReq&, 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.