mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
minor fixes for VILLASfpga
This commit is contained in:
parent
1be03ffab6
commit
7703f9e23a
2 changed files with 13 additions and 5 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <libgen.h>
|
||||
#include <cstring>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <linux/limits.h>
|
||||
|
||||
#include <villas/log.hpp>
|
||||
|
@ -92,9 +93,11 @@ DeviceList::lookupDevice(const Id &i)
|
|||
DeviceList::value_type
|
||||
DeviceList::lookupDevice(const Device &d)
|
||||
{
|
||||
return *std::find_if(begin(), end(), [d](const DeviceList::value_type &e) {
|
||||
auto dev = std::find_if(begin(), end(), [d](const DeviceList::value_type &e) {
|
||||
return *e == d;
|
||||
});
|
||||
|
||||
return dev == end() ? value_type() : *dev;
|
||||
}
|
||||
|
||||
Id::Id(const std::string &str) :
|
||||
|
@ -327,6 +330,11 @@ Device::getDriver() const
|
|||
snprintf(sysfs, sizeof(sysfs), "%s/bus/pci/devices/%04x:%02x:%02x.%x/driver", SYSFS_PATH,
|
||||
slot.domain, slot.bus, slot.device, slot.function);
|
||||
|
||||
struct stat st;
|
||||
ret = stat(sysfs, &st);
|
||||
if (ret)
|
||||
return "";
|
||||
|
||||
ret = readlink(sysfs, syml, sizeof(syml));
|
||||
if (ret < 0)
|
||||
throw SystemError("Failed to follow link: {}", sysfs);
|
||||
|
|
|
@ -115,7 +115,7 @@ MemoryTranslation
|
|||
MemoryManager::getTranslation(MemoryManager::AddressSpaceId fromAddrSpaceId,
|
||||
MemoryManager::AddressSpaceId toAddrSpaceId)
|
||||
{
|
||||
/* Find a path through the memory graph */
|
||||
// Find a path through the memory graph
|
||||
MemoryGraph::Path path;
|
||||
if (not memoryGraph.getPath(fromAddrSpaceId, toAddrSpaceId, path, pathCheckFunc)) {
|
||||
|
||||
|
@ -127,10 +127,10 @@ MemoryManager::getTranslation(MemoryManager::AddressSpaceId fromAddrSpaceId,
|
|||
throw std::out_of_range("no translation found");
|
||||
}
|
||||
|
||||
/* Start with an identity mapping */
|
||||
// Start with an identity mapping
|
||||
MemoryTranslation translation(0, 0, SIZE_MAX);
|
||||
|
||||
/* Iterate through path and merge all mappings into a single translation */
|
||||
// Iterate through path and merge all mappings into a single translation
|
||||
for (auto &mappingId : path) {
|
||||
auto mapping = memoryGraph.getEdge(mappingId);
|
||||
translation += getTranslationFromMapping(*mapping);
|
||||
|
@ -142,7 +142,7 @@ MemoryManager::getTranslation(MemoryManager::AddressSpaceId fromAddrSpaceId,
|
|||
bool
|
||||
MemoryManager::pathCheck(const MemoryGraph::Path &path)
|
||||
{
|
||||
/* Start with an identity mapping */
|
||||
// Start with an identity mapping
|
||||
MemoryTranslation translation(0, 0, SIZE_MAX);
|
||||
|
||||
/* Try to add all mappings together to a common translation. If this fails
|
||||
|
|
Loading…
Add table
Reference in a new issue