RASCSI/cpp/disk_image/posix_file_handle.h

33 lines
981 B
C
Raw Normal View History

2023-01-09 02:04:49 +00:00
//---------------------------------------------------------------------------
//
// SCSI Target Emulator RaSCSI (*^..^*)
// for Raspberry Pi
//
2023-01-11 03:08:22 +00:00
// Copyright (C) 2022-2023 akuker
2023-01-09 02:04:49 +00:00
//
// [ PosixFileHandle ]
//
//---------------------------------------------------------------------------
#pragma once
#include "disk_image/disk_image_handle.h"
class PosixFileHandle : public DiskImageHandle
{
public:
2023-01-09 03:39:07 +00:00
PosixFileHandle(const string &path, int size, uint32_t blocks, off_t imgoff = 0);
2023-01-11 03:08:22 +00:00
~PosixFileHandle() override;
2023-01-09 02:04:49 +00:00
// Access
2023-01-11 03:08:22 +00:00
bool Save() override { return true; }; // Save and release all
bool ReadSector(vector<uint8_t>& buf, int block) override ; // Sector Read
bool WriteSector(const vector<uint8_t>& buf, int block) override ; // Sector Write
bool GetCache(int index, int &track, uint32_t &serial) const override { (void)index; (void)track; (void)serial; return true; }; // Get cache information
2023-01-09 02:04:49 +00:00
private:
int fd;
bool initialized = false;
};