diff --git a/common/include/villas/kernel/vfio_container.hpp b/common/include/villas/kernel/vfio_container.hpp index 50d0a5614..90eee666a 100644 --- a/common/include/villas/kernel/vfio_container.hpp +++ b/common/include/villas/kernel/vfio_container.hpp @@ -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; diff --git a/common/include/villas/kernel/vfio_device.hpp b/common/include/villas/kernel/vfio_device.hpp index 6cb717cf2..796223142 100644 --- a/common/include/villas/kernel/vfio_device.hpp +++ b/common/include/villas/kernel/vfio_device.hpp @@ -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) diff --git a/common/include/villas/kernel/vfio_group.hpp b/common/include/villas/kernel/vfio_group.hpp index af1905519..169aa1e87 100644 --- a/common/include/villas/kernel/vfio_group.hpp +++ b/common/include/villas/kernel/vfio_group.hpp @@ -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;