mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
rename GenericDriver to LinuxDriver
Signed-off-by: Pascal Bauer <pascal.bauer@rwth-aachen.de>
This commit is contained in:
parent
5a48e38aee
commit
ca2715ddbd
3 changed files with 17 additions and 17 deletions
|
@ -1,4 +1,4 @@
|
|||
/* GenericDriver - Works for standard Linux drivers
|
||||
/* Implementation of driver interface for Linux/Unix based operation system drivers.
|
||||
*
|
||||
* Author: Pascal Bauer <pascal.bauer@rwth-aachen.de>
|
||||
*
|
||||
|
@ -17,7 +17,7 @@ namespace villas {
|
|||
namespace kernel {
|
||||
namespace devices {
|
||||
|
||||
class GenericDriver : public Driver {
|
||||
class LinuxDriver : public Driver {
|
||||
private:
|
||||
static constexpr char BIND_DEFAULT[] = "bind";
|
||||
static constexpr char UNBIND_DEFAULT[] = "unbind";
|
||||
|
@ -30,13 +30,13 @@ private:
|
|||
const std::filesystem::path unbind_path;
|
||||
|
||||
public:
|
||||
GenericDriver(const std::filesystem::path path)
|
||||
: GenericDriver(path, path / std::filesystem::path(BIND_DEFAULT),
|
||||
path / std::filesystem::path(UNBIND_DEFAULT)){};
|
||||
LinuxDriver(const std::filesystem::path path)
|
||||
: LinuxDriver(path, path / std::filesystem::path(BIND_DEFAULT),
|
||||
path / std::filesystem::path(UNBIND_DEFAULT)){};
|
||||
|
||||
GenericDriver(const std::filesystem::path path,
|
||||
const std::filesystem::path bind_path,
|
||||
const std::filesystem::path unbind_path)
|
||||
LinuxDriver(const std::filesystem::path path,
|
||||
const std::filesystem::path bind_path,
|
||||
const std::filesystem::path unbind_path)
|
||||
: path(path), bind_path(bind_path), unbind_path(unbind_path){};
|
||||
|
||||
public:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* GenericDriver
|
||||
/* LinuxDriver
|
||||
*
|
||||
* Author: Pascal Bauer <pascal.bauer@rwth-aachen.de>
|
||||
*
|
||||
|
@ -11,10 +11,10 @@
|
|||
#include <villas/kernel/devices/device.hpp>
|
||||
#include <villas/utils.hpp>
|
||||
|
||||
using villas::kernel::devices::Device, villas::kernel::devices::GenericDriver;
|
||||
using villas::kernel::devices::Device, villas::kernel::devices::LinuxDriver;
|
||||
using villas::utils::write_to_file;
|
||||
|
||||
void GenericDriver::attach(const Device &device) const {
|
||||
void LinuxDriver::attach(const Device &device) const {
|
||||
if (device.driver().has_value()) {
|
||||
device.driver().value()->unbind(device);
|
||||
}
|
||||
|
@ -22,19 +22,19 @@ void GenericDriver::attach(const Device &device) const {
|
|||
device.probe();
|
||||
}
|
||||
|
||||
void GenericDriver::bind(const Device &device) const {
|
||||
void LinuxDriver::bind(const Device &device) const {
|
||||
write_to_file(device.name(), this->bind_path);
|
||||
}
|
||||
|
||||
std::string GenericDriver::name() const {
|
||||
std::string LinuxDriver::name() const {
|
||||
size_t pos = path.u8string().rfind('/');
|
||||
return path.u8string().substr(pos + 1);
|
||||
}
|
||||
|
||||
void GenericDriver::override(const Device &device) const {
|
||||
void LinuxDriver::override(const Device &device) const {
|
||||
write_to_file(this->name(), device.override_path());
|
||||
}
|
||||
|
||||
void GenericDriver::unbind(const Device &device) const {
|
||||
void LinuxDriver::unbind(const Device &device) const {
|
||||
write_to_file(device.name(), this->unbind_path);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <villas/kernel/devices/platform_device.hpp>
|
||||
#include <villas/utils.hpp>
|
||||
|
||||
using villas::kernel::devices::Driver, villas::kernel::devices::GenericDriver;
|
||||
using villas::kernel::devices::Driver, villas::kernel::devices::LinuxDriver;
|
||||
using villas::kernel::devices::PlatformDevice;
|
||||
using villas::utils::write_to_file;
|
||||
|
||||
|
@ -23,7 +23,7 @@ std::optional<std::unique_ptr<Driver>> PlatformDevice::driver() const {
|
|||
|
||||
std::filesystem::path driver_path =
|
||||
std::filesystem::canonical(driver_symlink);
|
||||
return std::make_optional(std::make_unique<GenericDriver>(driver_path));
|
||||
return std::make_optional(std::make_unique<LinuxDriver>(driver_path));
|
||||
}
|
||||
|
||||
std::optional<int> PlatformDevice::iommu_group() const {
|
||||
|
|
Loading…
Add table
Reference in a new issue