mirror of
https://github.com/akuker/RASCSI.git
synced 2024-06-26 22:29:45 +00:00
* Added unit tests * Fixed SonarCloud issues * Updated error handling * Updated deletion of controllers * Image folder handling cleanup * Fixed clang warning * Removed duplicate code * Reduced code complexity * Updated array handling * Initialize device with ID and LUN * Use smart pointers * Updated memory management * Logging updates * Extracted methods * Split scsi.h
48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator RaSCSI Reloaded
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2021-2022 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#pragma once
|
|
|
|
#include "rascsi_interface.pb.h"
|
|
#include "command_context.h"
|
|
#include <string>
|
|
|
|
using namespace rascsi_interface;
|
|
|
|
class RascsiImage
|
|
{
|
|
public:
|
|
|
|
RascsiImage();
|
|
~RascsiImage() = default;
|
|
|
|
void SetDepth(int d) { depth = d; }
|
|
int GetDepth() const { return depth; }
|
|
bool CheckDepth(string_view) const;
|
|
bool CreateImageFolder(const CommandContext&, const string&) const;
|
|
string GetDefaultFolder() const { return default_folder; }
|
|
string SetDefaultFolder(const string&);
|
|
bool IsValidSrcFilename(const string&) const;
|
|
bool IsValidDstFilename(const string&) const;
|
|
bool CreateImage(const CommandContext&, const PbCommand&) const;
|
|
bool DeleteImage(const CommandContext&, const PbCommand&) const;
|
|
bool RenameImage(const CommandContext&, const PbCommand&) const;
|
|
bool CopyImage(const CommandContext&, const PbCommand&) const;
|
|
bool SetImagePermissions(const CommandContext&, const PbCommand&) const;
|
|
string GetFullName(const string& filename) const { return default_folder + "/" + filename; }
|
|
|
|
private:
|
|
|
|
string GetHomeDir() const;
|
|
|
|
string default_folder;
|
|
|
|
int depth = 1;
|
|
};
|