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

implement name

Signed-off-by: Pascal Bauer <pascal.bauer@rwth-aachen.de>
This commit is contained in:
Pascal Bauer 2024-08-23 20:48:01 +02:00 committed by Niklas Eiling
parent d43caed903
commit a33d67b34a
2 changed files with 17 additions and 0 deletions

View file

@ -73,6 +73,7 @@ public:
// Implement device interface
std::optional<std::unique_ptr<Driver>> driver() const override;
std::optional<int> iommu_group() const override;
std::string name() const override;
// Bind a new LKM to the PCI device
bool attachDriver(const std::string &driver) const;

View file

@ -459,3 +459,19 @@ std::fstream PciDevice::openSysFs(const std::string &subPath,
return file;
}
// TODO: test
std::string PciDevice::name() const {
int ret;
char *group;
// readlink() does not add a null terminator!
char link[1024] = {0};
char sysfs[1024];
snprintf(sysfs, sizeof(sysfs),
"%04x:%02x:%02x.%x",
slot.domain, slot.bus, slot.device, slot.function);
return std::string(sysfs);
}