1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

vfio: convert container from singleton to normal class

Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
Niklas Eiling 2022-12-05 09:18:26 +01:00 committed by Steffen Vogel
parent e743b42c6f
commit e68b9d4e64
3 changed files with 10 additions and 10 deletions

View file

@ -25,19 +25,11 @@ namespace kernel {
namespace vfio {
class Container {
private:
// This is a singleton: There can only be one container to rule them all.
public:
Container();
public:
// The Container instance is lazily initialized and correctly destroyed.
static Container* getInstance()
{
static Container instance;
return &instance;
}
// No copying allowed
// No copying allowed because we manage the vfio state in constructor and destructors
Container(Container const&) = delete;
void operator=(Container const&) = delete;

View file

@ -38,6 +38,10 @@ public:
Device(const std::string &name, int groupFileDescriptor, const kernel::pci::Device *pci_device = nullptr);
~Device();
// No copying allowed because we manage the vfio state in constructor and destructors
Device(Device const&) = delete;
void operator=(Device const&) = delete;
bool reset();
// Map a device memory region to the application address space (e.g. PCI BARs)

View file

@ -30,6 +30,10 @@ public:
Group(int index, bool iommuEnabled);
~Group();
// No copying allowed because we manage the vfio state in constructor and destructors
Group(Group const&) = delete;
void operator=(Group const&) = delete;
void setAttachedToContainer()
{
attachedToContainer = true;