Skip to content

Commit df8c26c

Browse files
IgnoreWarningsn-eiling
authored andcommitted
refactor: rename DeviceList to PciDeviceList
Signed-off-by: Pascal Bauer <pascal.bauer@rwth-aachen.de>
1 parent a162f6f commit df8c26c

7 files changed

Lines changed: 26 additions & 25 deletions

File tree

common/include/villas/kernel/devices/pci_device.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,23 +106,23 @@ class PciDevice {
106106
std::ios_base::out) const;
107107
};
108108

109-
class DeviceList : public std::list<std::shared_ptr<PciDevice>> {
109+
class PciDeviceList : public std::list<std::shared_ptr<PciDevice>> {
110110
private:
111111
// Initialize Linux PCI handle.
112112
//
113113
// This search for all available PCI devices under /sys/bus/pci
114-
DeviceList();
115-
DeviceList &operator=(const DeviceList &);
116-
static DeviceList *instance;
114+
PciDeviceList();
115+
PciDeviceList &operator=(const PciDeviceList &);
116+
static PciDeviceList *instance;
117117

118118
public:
119-
static DeviceList *getInstance();
119+
static PciDeviceList *getInstance();
120120

121-
DeviceList::value_type lookupDevice(const Slot &s);
121+
PciDeviceList::value_type lookupDevice(const Slot &s);
122122

123-
DeviceList::value_type lookupDevice(const Id &i);
123+
PciDeviceList::value_type lookupDevice(const Id &i);
124124

125-
DeviceList::value_type lookupDevice(const PciDevice &f);
125+
PciDeviceList::value_type lookupDevice(const PciDevice &f);
126126
};
127127

128128
} // namespace pci

common/lib/kernel/devices/pci_device.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ using namespace villas::kernel::pci;
2525

2626
#define PCI_BASE_ADDRESS_N(n) (PCI_BASE_ADDRESS_0 + sizeof(uint32_t) * (n))
2727

28-
DeviceList *DeviceList::instance = nullptr;
28+
PciDeviceList *PciDeviceList::instance = nullptr;
2929

30-
DeviceList *DeviceList::getInstance() {
30+
PciDeviceList *PciDeviceList::getInstance() {
3131
if (instance == nullptr) {
32-
instance = new DeviceList();
32+
instance = new PciDeviceList();
3333
}
3434
return instance;
3535
};
3636

37-
DeviceList::DeviceList() {
37+
PciDeviceList::PciDeviceList() {
3838
struct dirent *e;
3939
DIR *dp;
4040
FILE *f;
@@ -88,21 +88,22 @@ DeviceList::DeviceList() {
8888
closedir(dp);
8989
}
9090

91-
DeviceList::value_type DeviceList::lookupDevice(const Slot &s) {
92-
return *std::find_if(begin(), end(), [s](const DeviceList::value_type &d) {
91+
PciDeviceList::value_type PciDeviceList::lookupDevice(const Slot &s) {
92+
return *std::find_if(begin(), end(), [s](const PciDeviceList::value_type &d) {
9393
return d->slot == s;
9494
});
9595
}
9696

97-
DeviceList::value_type DeviceList::lookupDevice(const Id &i) {
98-
return *std::find_if(begin(), end(), [i](const DeviceList::value_type &d) {
97+
PciDeviceList::value_type PciDeviceList::lookupDevice(const Id &i) {
98+
return *std::find_if(begin(), end(), [i](const PciDeviceList::value_type &d) {
9999
return d->id == i;
100100
});
101101
}
102102

103-
DeviceList::value_type DeviceList::lookupDevice(const PciDevice &d) {
104-
auto dev = std::find_if(
105-
begin(), end(), [d](const DeviceList::value_type &e) { return *e == d; });
103+
PciDeviceList::value_type PciDeviceList::lookupDevice(const PciDevice &d) {
104+
auto dev =
105+
std::find_if(begin(), end(),
106+
[d](const PciDeviceList::value_type &e) { return *e == d; });
106107

107108
return dev == end() ? value_type() : *dev;
108109
}

fpga/lib/dma.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
using namespace villas;
2323

24-
static std::shared_ptr<kernel::pci::DeviceList> pciDevices;
24+
static std::shared_ptr<kernel::pci::PciDeviceList> pciDevices;
2525
static auto logger = villas::Log::get("villasfpga_dma");
2626

2727
struct villasfpga_handle_t {

fpga/lib/pcie_card.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ PCIeCardFactory::make(json_t *json_card, std::string card_name,
7171
filter.slot = kernel::pci::Slot(pci_slot);
7272

7373
// Search for FPGA card
74-
card->pdev = kernel::pci::DeviceList::getInstance()->lookupDevice(filter);
74+
card->pdev = kernel::pci::PciDeviceList::getInstance()->lookupDevice(filter);
7575
if (!card->pdev) {
7676
logger->warn("Failed to find PCI device");
7777
return nullptr;

fpga/src/villas-fpga-ctrl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
using namespace villas;
3636

37-
static std::shared_ptr<kernel::pci::DeviceList> pciDevices;
37+
static std::shared_ptr<kernel::pci::PciDeviceList> pciDevices;
3838
static auto logger = villas::Log::get("ctrl");
3939

4040
void writeToDmaFromStdIn(std::shared_ptr<villas::fpga::ip::Dma> dma) {

fpga/src/villas-fpga-pipe.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
using namespace villas;
2929

30-
static std::shared_ptr<kernel::pci::DeviceList> pciDevices;
30+
static std::shared_ptr<kernel::pci::PciDeviceList> pciDevices;
3131
static auto logger = villas::Log::get("streamer");
3232

3333
int main(int argc, char *argv[]) {

fpga/tests/unit/fpga.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
using namespace villas;
2929

30-
static kernel::pci::DeviceList *pciDevices;
30+
static kernel::pci::PciDeviceList *pciDevices;
3131

3232
FpgaState state;
3333

@@ -40,7 +40,7 @@ static void init() {
4040

4141
plugin::registry->dump();
4242

43-
pciDevices = kernel::pci::DeviceList::getInstance();
43+
pciDevices = kernel::pci::PciDeviceList::getInstance();
4444

4545
auto vfioContainer = std::make_shared<kernel::vfio::Container>();
4646

0 commit comments

Comments
 (0)