mirror of
https://github.com/akuker/RASCSI.git
synced 2024-09-28 21:56:14 +00:00
1df7cdb1f3
* Use vector for INQUIRY data, Inquiry() is const, moved EVPD check
* Moved code
* Fixed warning
* Updated memcpy
* Set length
* Limit result vector size
* Limit result buffer size
* Inquiry() result buffer handling update
* Logging update
* Inquiry cleanup
* NEC drive can also use PrimaryDevice::Inquiry()
* NEC drive is never removable
* Comment update
* Bridge can also use PrimaryDevice::Inquiry()
* Removed unused method argument
* Comment update
* Updated comment
* Updated REQUEST SENSE buffer handling
* Fixed typo
* Fixed typo
* Re-added comment
* Updated additional length handling
* Check for INQUIRY command support first
* Added assertion
* Size handling update
* Renaming
* Renaming
* Removed obsolete casts
* Cleanup
* Moved error codes to scsi_defs namespace
* Fixed ReadDefectData10
* Comment update
* Updated buffer handling
* Data type update
* SendDiagnostic is now const
* Removed obsolete forward declaration
* removed unused enum
* Reduced method visibility
* Renaming
* GetSendDelay() can be const
* Made method const
* Made method const
* Added TODO
* Use iterator
* Made method const
* Revert "Made method const"
This reverts commit 38412b8ddd
.
* No need to sort all set/maps
* Do not sort all sets
* Removed more unnecessary sorting
* Cleaned up includes
* More include cleanups
* Updated REPORT LUNS
* LUNs must not be consecutive anymore
* Updated detaching of LUN
* Improvements for devices without LUN 0
* Assume LUN 0 is always present
* Enforce presence of LUN 0
* Updated error handling
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator RaSCSI (*^..^*)
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2021 Uwe Seimet
|
|
//
|
|
// Devices inheriting from FileSupport support image files
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include <unordered_map>
|
|
#include <string>
|
|
#include "filepath.h"
|
|
|
|
using namespace std;
|
|
|
|
typedef pair<int, int> id_set;
|
|
|
|
class FileSupport
|
|
{
|
|
private:
|
|
Filepath diskpath;
|
|
|
|
// The list of image files in use and the IDs and LUNs using these files
|
|
static unordered_map<string, id_set> reserved_files;
|
|
|
|
public:
|
|
|
|
FileSupport() {}
|
|
virtual ~FileSupport() {}
|
|
|
|
void GetPath(Filepath& path) const { path = diskpath; }
|
|
void SetPath(const Filepath& path) { diskpath = path; }
|
|
void ReserveFile(const Filepath&, int, int);
|
|
void UnreserveFile();
|
|
|
|
static const unordered_map<string, id_set> GetReservedFiles() { return reserved_files; }
|
|
static void SetReservedFiles(const unordered_map<string, id_set>& files_in_use)
|
|
{ FileSupport::reserved_files = files_in_use; }
|
|
static bool GetIdsForReservedFile(const Filepath&, int&, int&);
|
|
static void UnreserveAll();
|
|
|
|
virtual void Open(const Filepath&) = 0;
|
|
};
|