From 00e80c54b962b90ee8faac0914e2f2911278b081 Mon Sep 17 00:00:00 2001 From: Pascal Bauer Date: Sat, 24 Aug 2024 12:36:02 +0200 Subject: [PATCH 1/2] Refactor FPGA device and drivers Signed-off-by: Pascal Bauer --- .../include/villas/kernel/devices/device.hpp | 33 ++++++++++++ .../include/villas/kernel/devices/driver.hpp | 29 ++++++++++ .../villas/kernel/devices/ip_device.hpp | 35 ++++++++++++ .../villas/kernel/devices/linux_driver.hpp | 52 ++++++++++++++++++ .../villas/kernel/devices/platform_device.hpp | 51 ++++++++++++++++++ common/include/villas/utils.hpp | 6 ++- common/lib/CMakeLists.txt | 3 ++ common/lib/kernel/devices/ip_device.cpp | 54 +++++++++++++++++++ common/lib/kernel/devices/linux_driver.cpp | 40 ++++++++++++++ common/lib/kernel/devices/platform_device.cpp | 50 +++++++++++++++++ common/lib/utils.cpp | 26 +++++++++ 11 files changed, 378 insertions(+), 1 deletion(-) create mode 100644 common/include/villas/kernel/devices/device.hpp create mode 100644 common/include/villas/kernel/devices/driver.hpp create mode 100644 common/include/villas/kernel/devices/ip_device.hpp create mode 100644 common/include/villas/kernel/devices/linux_driver.hpp create mode 100644 common/include/villas/kernel/devices/platform_device.hpp create mode 100644 common/lib/kernel/devices/ip_device.cpp create mode 100644 common/lib/kernel/devices/linux_driver.cpp create mode 100644 common/lib/kernel/devices/platform_device.cpp diff --git a/common/include/villas/kernel/devices/device.hpp b/common/include/villas/kernel/devices/device.hpp new file mode 100644 index 000000000..896cab042 --- /dev/null +++ b/common/include/villas/kernel/devices/device.hpp @@ -0,0 +1,33 @@ +/* Interface for Linux/Unix devices. + * + * Author: Pascal Bauer + * + * SPDX-FileCopyrightText: 2023-2024 Pascal Bauer + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include +#include +#include + +namespace villas { +namespace kernel { +namespace devices { + +class Device { +public: + virtual ~Device(){}; + + virtual std::optional> driver() const = 0; + virtual std::optional iommu_group() const = 0; + virtual std::string name() const = 0; + virtual std::filesystem::path override_path() const = 0; + virtual std::filesystem::path path() const = 0; + virtual void probe() const = 0; +}; + +} // namespace devices +} // namespace kernel +} // namespace villas diff --git a/common/include/villas/kernel/devices/driver.hpp b/common/include/villas/kernel/devices/driver.hpp new file mode 100644 index 000000000..7578f1e66 --- /dev/null +++ b/common/include/villas/kernel/devices/driver.hpp @@ -0,0 +1,29 @@ +/* Interface for device drivers. OS/platform independend. + * Implemented for Linux/Unix drivers in linux_driver.hpp + * + * Author: Pascal Bauer + * + * SPDX-FileCopyrightText: 2023-2024 Pascal Bauer + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +namespace villas { +namespace kernel { +namespace devices { + +class Device; + +class Driver { +public: + virtual void attach(const Device &device) const = 0; + virtual void bind(const Device &device) const = 0; + virtual std::string name() const = 0; + virtual void override(const Device &device) const = 0; + virtual void unbind(const Device &device) const = 0; +}; + +} // namespace devices +} // namespace kernel +} // namespace villas \ No newline at end of file diff --git a/common/include/villas/kernel/devices/ip_device.hpp b/common/include/villas/kernel/devices/ip_device.hpp new file mode 100644 index 000000000..240f80d6d --- /dev/null +++ b/common/include/villas/kernel/devices/ip_device.hpp @@ -0,0 +1,35 @@ +/* Linux/Unix device which represents an IP component of a FPGA. + * + * Author: Pascal Bauer + * + * SPDX-FileCopyrightText: 2023-2024 Pascal Bauer + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include +#include + +namespace villas { +namespace kernel { +namespace devices { + +class IpDevice : public PlatformDevice { +public: + static IpDevice from(const std::filesystem::path unsafe_path); + static bool is_path_valid(const std::filesystem::path unsafe_path); + +private: + IpDevice() = delete; + IpDevice(const std::filesystem::path valid_path) //! Dont allow unvalidated paths + : PlatformDevice(valid_path){}; + +public: + size_t addr() const; + std::string ip_name() const; +}; + +} // namespace devices +} // namespace kernel +} // namespace villas diff --git a/common/include/villas/kernel/devices/linux_driver.hpp b/common/include/villas/kernel/devices/linux_driver.hpp new file mode 100644 index 000000000..71dbce8d7 --- /dev/null +++ b/common/include/villas/kernel/devices/linux_driver.hpp @@ -0,0 +1,52 @@ +/* Implementation of driver interface for Linux/Unix based operation system drivers. + * + * Author: Pascal Bauer + * + * SPDX-FileCopyrightText: 2023-2024 Pascal Bauer + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include +#include +#include +#include + +namespace villas { +namespace kernel { +namespace devices { + +class LinuxDriver : public Driver { +private: + static constexpr char BIND_DEFAULT[] = "bind"; + static constexpr char UNBIND_DEFAULT[] = "unbind"; + +public: + const std::filesystem::path path; + +private: + const std::filesystem::path bind_path; + const std::filesystem::path unbind_path; + +public: + LinuxDriver(const std::filesystem::path path) + : LinuxDriver(path, path / std::filesystem::path(BIND_DEFAULT), + path / std::filesystem::path(UNBIND_DEFAULT)){}; + + 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: + void attach(const Device &device) const override; + void bind(const Device &device) const override; + std::string name() const override; + void override(const Device &device) const override; + void unbind(const Device &device) const override; +}; + +} // namespace devices +} // namespace kernel +} // namespace villas \ No newline at end of file diff --git a/common/include/villas/kernel/devices/platform_device.hpp b/common/include/villas/kernel/devices/platform_device.hpp new file mode 100644 index 000000000..57c3ec915 --- /dev/null +++ b/common/include/villas/kernel/devices/platform_device.hpp @@ -0,0 +1,51 @@ +/* Platform bus based Linux/Unix device. + * + * Author: Pascal Bauer + * + * SPDX-FileCopyrightText: 2023-2024 Pascal Bauer + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include +#include +#include + +namespace villas { +namespace kernel { +namespace devices { + +class PlatformDevice : public Device { +private: + static constexpr char PROBE_DEFAULT[] = "/sys/bus/platform/drivers_probe"; + static constexpr char OVERRIDE_DEFAULT[] = "driver_override"; + +private: + const std::filesystem::path m_path; + const std::filesystem::path m_probe_path; + const std::filesystem::path m_override_path; + +public: + PlatformDevice(const std::filesystem::path path) + : PlatformDevice(path, std::filesystem::path(PROBE_DEFAULT), + path / std::filesystem::path(OVERRIDE_DEFAULT)){}; + + PlatformDevice(const std::filesystem::path path, + const std::filesystem::path probe_path, + const std::filesystem::path override_path) + : m_path(path), m_probe_path(probe_path), + m_override_path(override_path){}; + + // Implement device interface + std::optional> driver() const override; + std::optional iommu_group() const override; + std::string name() const override; + std::filesystem::path override_path() const override; + std::filesystem::path path() const override; + void probe() const override; +}; + +} // namespace devices +} // namespace kernel +} // namespace villas diff --git a/common/include/villas/utils.hpp b/common/include/villas/utils.hpp index a65fb6cba..afd6eebc0 100644 --- a/common/include/villas/utils.hpp +++ b/common/include/villas/utils.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -208,9 +209,12 @@ template struct overloaded : Ts... { using Ts::operator()...; }; -// explicit deduction guide (not needed as of C++20) +// Explicit deduction guide (not needed as of C++20) template overloaded(Ts...) -> overloaded; +void write_to_file(std::string data, const std::filesystem::path file); +std::vector read_names_in_directory(const std::filesystem::path &directory); + namespace base64 { using byte = std::uint8_t; diff --git a/common/lib/CMakeLists.txt b/common/lib/CMakeLists.txt index 116d786e6..74581897c 100644 --- a/common/lib/CMakeLists.txt +++ b/common/lib/CMakeLists.txt @@ -39,7 +39,10 @@ endif() if(CMAKE_SYSTEM_NAME STREQUAL Linux) target_sources(villas-common PRIVATE + kernel/devices/ip_device.cpp + kernel/devices/linux_driver.cpp kernel/devices/pci_device.cpp + kernel/devices/platform_device.cpp kernel/vfio_device.cpp kernel/vfio_group.cpp kernel/vfio_container.cpp diff --git a/common/lib/kernel/devices/ip_device.cpp b/common/lib/kernel/devices/ip_device.cpp new file mode 100644 index 000000000..3c321b6f6 --- /dev/null +++ b/common/lib/kernel/devices/ip_device.cpp @@ -0,0 +1,54 @@ +/* Linux/Unix device which represents an IP component of a FPGA. + * + * Author: Pascal Bauer + * + * SPDX-FileCopyrightText: 2023-2024 Pascal Bauer + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +#include +#include + +using villas::kernel::devices::IpDevice; + +IpDevice IpDevice::from(const std::filesystem::path unsafe_path) { + if (!is_path_valid(unsafe_path)) + throw RuntimeError( + "Path {} failed validation as IpDevicePath [adress in hex].[name] ", + unsafe_path.u8string()); + return IpDevice(unsafe_path); +} + +std::string IpDevice::ip_name() const { + int pos = name().find('.'); + return name().substr(pos + 1); +} + +size_t IpDevice::addr() const { + size_t pos = name().find('.'); + std::string addr_hex = name().substr(0, pos); + + // Convert from hex-string to number + std::stringstream ss; + ss << std::hex << addr_hex; + size_t addr = 0; + ss >> addr; + + return addr; +} + +bool IpDevice::is_path_valid(const std::filesystem::path unsafe_path) { + std::string assumed_device_name = unsafe_path.filename(); + + // Match format of hexaddr.devicename + if (!std::regex_match(assumed_device_name, + std::regex(R"([0-9A-Fa-f]+\..*)"))) { + return false; + } + + return true; +} diff --git a/common/lib/kernel/devices/linux_driver.cpp b/common/lib/kernel/devices/linux_driver.cpp new file mode 100644 index 000000000..1f5a20537 --- /dev/null +++ b/common/lib/kernel/devices/linux_driver.cpp @@ -0,0 +1,40 @@ +/* Implementation of driver interface for Linux/Unix based operation system drivers. + * + * Author: Pascal Bauer + * + * SPDX-FileCopyrightText: 2023-2024 Pascal Bauer + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include +#include + +using villas::kernel::devices::Device, villas::kernel::devices::LinuxDriver; +using villas::utils::write_to_file; + +void LinuxDriver::attach(const Device &device) const { + if (device.driver().has_value()) { + device.driver().value()->unbind(device); + } + this->override(device); + device.probe(); +} + +void LinuxDriver::bind(const Device &device) const { + write_to_file(device.name(), this->bind_path); +} + +std::string LinuxDriver::name() const { + size_t pos = path.u8string().rfind('/'); + return path.u8string().substr(pos + 1); +} + +void LinuxDriver::override(const Device &device) const { + write_to_file(this->name(), device.override_path()); +} + +void LinuxDriver::unbind(const Device &device) const { + write_to_file(device.name(), this->unbind_path); +} diff --git a/common/lib/kernel/devices/platform_device.cpp b/common/lib/kernel/devices/platform_device.cpp new file mode 100644 index 000000000..e1f3610c6 --- /dev/null +++ b/common/lib/kernel/devices/platform_device.cpp @@ -0,0 +1,50 @@ +/* Platform bus based Linux/Unix device. + * + * Author: Pascal Bauer + * + * SPDX-FileCopyrightText: 2023-2024 Pascal Bauer + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include + +using villas::kernel::devices::Driver, villas::kernel::devices::LinuxDriver; +using villas::kernel::devices::PlatformDevice; +using villas::utils::write_to_file; + +std::optional> PlatformDevice::driver() const { + std::filesystem::path driver_symlink = + this->m_path / std::filesystem::path("driver"); + + if (!std::filesystem::is_symlink(driver_symlink)) + return std::nullopt; + + std::filesystem::path driver_path = + std::filesystem::canonical(driver_symlink); + return std::make_optional(std::make_unique(driver_path)); +} + +std::optional PlatformDevice::iommu_group() const { + std::filesystem::path symlink = + std::filesystem::path(this->m_path.u8string() + "/iommu_group"); + + std::filesystem::path link = std::filesystem::read_symlink(symlink); + std::string delimiter = "iommu_groups/"; + int pos = link.u8string().find(delimiter); + int iommu_group = std::stoi(link.u8string().substr(pos + delimiter.length())); + return std::make_optional(iommu_group); +} + +std::filesystem::path PlatformDevice::path() const { return this->m_path; }; + +void PlatformDevice::probe() const { + write_to_file(this->name(), this->m_probe_path); +} + +std::filesystem::path PlatformDevice::override_path() const { + return this->m_override_path; +} + +std::string PlatformDevice::name() const { return this->m_path.filename(); } diff --git a/common/lib/utils.cpp b/common/lib/utils.cpp index f495d8121..b137bf25e 100644 --- a/common/lib/utils.cpp +++ b/common/lib/utils.cpp @@ -17,7 +17,11 @@ #include #include #include +#include #include +#include +#include +#include #include #include @@ -351,5 +355,27 @@ bool isPrivileged() { return true; } +void write_to_file(std::string data, const std::filesystem::path file) { + villas::Log::get("Filewriter")->debug("{} > {}", data, file.u8string()); + std::ofstream outputFile(file.u8string()); + + if (outputFile.is_open()) { + outputFile << data; + outputFile.close(); + } else { + throw std::filesystem::filesystem_error("Cannot open outputfile", + std::error_code()); + } +} + +std::vector +read_names_in_directory(const std::filesystem::path &directory) { + std::vector names; + for (auto const &dir_entry : std::filesystem::directory_iterator{directory}) { + names.push_back(dir_entry.path().filename()); + } + return names; +} + } // namespace utils } // namespace villas From f1a025bb2008b34b10e218d43b89166d4a146b49 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 31 Oct 2024 11:52:20 +0100 Subject: [PATCH 2/2] fix: Formatting with clang-format Signed-off-by: Steffen Vogel --- .../include/villas/kernel/devices/ip_device.hpp | 3 ++- .../include/villas/kernel/devices/pci_device.hpp | 2 +- common/include/villas/task.hpp | 2 +- common/include/villas/utils.hpp | 13 +++++++------ common/lib/base64.cpp | 2 +- common/lib/utils.cpp | 2 +- fpga/include/villas/fpga/ips/i2c.hpp | 5 +++-- fpga/include/villas/fpga/utils.hpp | 6 +++--- include/villas/nodes/iec61850.hpp | 3 ++- include/villas/nodes/test_rtt.hpp | 4 ++-- lib/hook_list.cpp | 2 +- tests/unit/queue_signalled.cpp | 16 ++++++++-------- 12 files changed, 32 insertions(+), 28 deletions(-) diff --git a/common/include/villas/kernel/devices/ip_device.hpp b/common/include/villas/kernel/devices/ip_device.hpp index 240f80d6d..6851b6845 100644 --- a/common/include/villas/kernel/devices/ip_device.hpp +++ b/common/include/villas/kernel/devices/ip_device.hpp @@ -22,7 +22,8 @@ class IpDevice : public PlatformDevice { private: IpDevice() = delete; - IpDevice(const std::filesystem::path valid_path) //! Dont allow unvalidated paths + IpDevice( + const std::filesystem::path valid_path) //! Dont allow unvalidated paths : PlatformDevice(valid_path){}; public: diff --git a/common/include/villas/kernel/devices/pci_device.hpp b/common/include/villas/kernel/devices/pci_device.hpp index 65794644b..49d9ea31d 100644 --- a/common/include/villas/kernel/devices/pci_device.hpp +++ b/common/include/villas/kernel/devices/pci_device.hpp @@ -20,7 +20,7 @@ namespace kernel { namespace devices { #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) -#define PCI_FUNC(devfn) ((devfn) & 0x07) +#define PCI_FUNC(devfn) ((devfn)&0x07) class Id { public: diff --git a/common/include/villas/task.hpp b/common/include/villas/task.hpp index bf88a0c3a..3ef65461e 100644 --- a/common/include/villas/task.hpp +++ b/common/include/villas/task.hpp @@ -45,7 +45,7 @@ struct Task { #if PERIODIC_TASK_IMPL == TIMERFD int fd; // The timerfd_create(2) file descriptior. #elif PERIODIC_TASK_IMPL == RDTSC - struct Tsc tsc; // Initialized by tsc_init(). + struct Tsc tsc; // Initialized by tsc_init(). #endif // Create a new task with the given rate. diff --git a/common/include/villas/utils.hpp b/common/include/villas/utils.hpp index afd6eebc0..ed6d9d3f6 100644 --- a/common/include/villas/utils.hpp +++ b/common/include/villas/utils.hpp @@ -8,10 +8,10 @@ #pragma once +#include #include #include #include -#include #include #include @@ -53,7 +53,7 @@ #ifdef ALIGN #undef ALIGN #endif -#define ALIGN(x, a) ALIGN_MASK(x, (uintptr_t)(a) - 1) +#define ALIGN(x, a) ALIGN_MASK(x, (uintptr_t)(a)-1) #define ALIGN_MASK(x, m) (((uintptr_t)(x) + (m)) & ~(m)) #define IS_ALIGNED(x, a) (ALIGN(x, a) == (uintptr_t)x) @@ -65,13 +65,13 @@ } while (0) // Round-up integer division -#define CEIL(x, y) (((x) + (y) - 1) / (y)) +#define CEIL(x, y) (((x) + (y)-1) / (y)) // Get nearest up-rounded power of 2 -#define LOG2_CEIL(x) (1 << (villas::utils::log2i((x) - 1) + 1)) +#define LOG2_CEIL(x) (1 << (villas::utils::log2i((x)-1) + 1)) // Check if the number is a power of 2 -#define IS_POW2(x) (((x) != 0) && !((x) & ((x) - 1))) +#define IS_POW2(x) (((x) != 0) && !((x) & ((x)-1))) // Calculate the number of elements in an array. #define ARRAY_LEN(a) (sizeof(a) / sizeof(a)[0]) @@ -213,7 +213,8 @@ template struct overloaded : Ts... { template overloaded(Ts...) -> overloaded; void write_to_file(std::string data, const std::filesystem::path file); -std::vector read_names_in_directory(const std::filesystem::path &directory); +std::vector +read_names_in_directory(const std::filesystem::path &directory); namespace base64 { diff --git a/common/lib/base64.cpp b/common/lib/base64.cpp index ac3c8536f..bcd3e58ec 100644 --- a/common/lib/base64.cpp +++ b/common/lib/base64.cpp @@ -110,7 +110,7 @@ std::vector decode(const std::string &input) { decoded.push_back((temp >> 16) & 0x000000FF); decoded.push_back((temp >> 8) & 0x000000FF); - decoded.push_back((temp) & 0x000000FF); + decoded.push_back((temp)&0x000000FF); } return decoded; diff --git a/common/lib/utils.cpp b/common/lib/utils.cpp index b137bf25e..62ae139e3 100644 --- a/common/lib/utils.cpp +++ b/common/lib/utils.cpp @@ -372,7 +372,7 @@ std::vector read_names_in_directory(const std::filesystem::path &directory) { std::vector names; for (auto const &dir_entry : std::filesystem::directory_iterator{directory}) { - names.push_back(dir_entry.path().filename()); + names.push_back(dir_entry.path().filename()); } return names; } diff --git a/fpga/include/villas/fpga/ips/i2c.hpp b/fpga/include/villas/fpga/ips/i2c.hpp index 3c3ce2cff..072a72157 100644 --- a/fpga/include/villas/fpga/ips/i2c.hpp +++ b/fpga/include/villas/fpga/ips/i2c.hpp @@ -19,7 +19,8 @@ namespace fpga { namespace ip { #define I2C_SWTICH_ADDR 0x70 -#define I2C_SWITCH_CHANNEL_MAP {0x20, 0x80, 0x02, 0x08, 0x10, 0x40, 0x01, 0x04} +#define I2C_SWITCH_CHANNEL_MAP \ + { 0x20, 0x80, 0x02, 0x08, 0x10, 0x40, 0x01, 0x04 } #define I2C_IOEXT_ADDR 0x20 #define I2C_IOEXT_REG_DIR 0x03 #define I2C_IOEXT_REG_OUT 0x01 @@ -46,7 +47,7 @@ class I2c : public Node { public: Switch(I2c *i2c, uint8_t address, Logger logger = villas::Log::get("i2c")) : i2c(i2c), address(address), channel(0), readOnce(false), switchLock(), - logger(logger) {}; + logger(logger){}; Switch(const Switch &other) = delete; Switch &operator=(const Switch &other) = delete; void setChannel(uint8_t channel); diff --git a/fpga/include/villas/fpga/utils.hpp b/fpga/include/villas/fpga/utils.hpp index b078936fb..42f3afbb5 100644 --- a/fpga/include/villas/fpga/utils.hpp +++ b/fpga/include/villas/fpga/utils.hpp @@ -89,7 +89,7 @@ class BufferedSampleFormatter { BufferedSampleFormatter(const size_t bufSamples, const size_t bufSampleSize) : buf(bufSamples * bufSampleSize + 1), // Leave room for a final `\0' bufSamples(bufSamples), bufSampleSize(bufSampleSize), - currentBufLoc(0) {}; + currentBufLoc(0){}; BufferedSampleFormatter() = delete; BufferedSampleFormatter(const BufferedSampleFormatter &) = delete; virtual char *nextBufPos() { return &buf[(currentBufLoc++) * bufSampleSize]; } @@ -98,7 +98,7 @@ class BufferedSampleFormatter { class BufferedSampleFormatterShort : public BufferedSampleFormatter { public: BufferedSampleFormatterShort(size_t bufSizeInSamples) - : BufferedSampleFormatter(bufSizeInSamples, formatStringSize) {}; + : BufferedSampleFormatter(bufSizeInSamples, formatStringSize){}; virtual void format(float value) override { size_t chars; @@ -119,7 +119,7 @@ class BufferedSampleFormatterLong : public BufferedSampleFormatter { public: BufferedSampleFormatterLong(size_t bufSizeInSamples) : BufferedSampleFormatter(bufSizeInSamples, formatStringSize), - sampleCnt(0) {}; + sampleCnt(0){}; virtual void format(float value) override { if (std::snprintf(nextBufPos(), formatStringSize + 1, formatString, diff --git a/include/villas/nodes/iec61850.hpp b/include/villas/nodes/iec61850.hpp index 85c008c2f..bbb1afc0f 100644 --- a/include/villas/nodes/iec61850.hpp +++ b/include/villas/nodes/iec61850.hpp @@ -20,7 +20,8 @@ #include #ifndef CONFIG_GOOSE_DEFAULT_DST_ADDRESS -#define CONFIG_GOOSE_DEFAULT_DST_ADDRESS {0x01, 0x0c, 0xcd, 0x01, 0x00, 0x01} +#define CONFIG_GOOSE_DEFAULT_DST_ADDRESS \ + { 0x01, 0x0c, 0xcd, 0x01, 0x00, 0x01 } #endif namespace villas { diff --git a/include/villas/nodes/test_rtt.hpp b/include/villas/nodes/test_rtt.hpp index fd5c55d4d..c33db2d8c 100644 --- a/include/villas/nodes/test_rtt.hpp +++ b/include/villas/nodes/test_rtt.hpp @@ -58,7 +58,7 @@ class TestRTT : public Node { : node(n), id(id), rate(rate), warmup(warmup), cooldown(cooldown), values(values), count(count), sent(0), received(0), missed(0), count_warmup(count_warmup), sent_warmup(0), received_warmup(0), - missed_warmup(0), filename(filename) {}; + missed_warmup(0), filename(filename){}; int start(); int stop(); @@ -96,7 +96,7 @@ class TestRTT : public Node { : Node(id, name), task(CLOCK_MONOTONIC), formatter(nullptr), stream(nullptr), shutdown(false) {} - virtual ~TestRTT() {}; + virtual ~TestRTT(){}; virtual int prepare(); diff --git a/lib/hook_list.cpp b/lib/hook_list.cpp index c0f31bb1c..2eadc93c9 100644 --- a/lib/hook_list.cpp +++ b/lib/hook_list.cpp @@ -134,7 +134,7 @@ int HookList::process(struct Sample *smps[], unsigned cnt) { stop: SWAP(smps[processed], smps[current]); processed++; - skip: {} + skip : {} } return processed; diff --git a/tests/unit/queue_signalled.cpp b/tests/unit/queue_signalled.cpp index ca831eb63..3f440e523 100644 --- a/tests/unit/queue_signalled.cpp +++ b/tests/unit/queue_signalled.cpp @@ -93,15 +93,15 @@ void *polled_consumer(void *ctx) { ParameterizedTestParameters(queue_signalled, simple) { static struct param params[] = { - {QueueSignalledMode::AUTO, 0, false}, - {QueueSignalledMode::PTHREAD, 0, false}, - {QueueSignalledMode::PTHREAD, 0, false}, - {QueueSignalledMode::PTHREAD, (int)QueueSignalledFlags::PROCESS_SHARED, - false}, - {QueueSignalledMode::POLLING, 0, false}, + {QueueSignalledMode::AUTO, 0, false}, + {QueueSignalledMode::PTHREAD, 0, false}, + {QueueSignalledMode::PTHREAD, 0, false}, + {QueueSignalledMode::PTHREAD, (int)QueueSignalledFlags::PROCESS_SHARED, + false}, + {QueueSignalledMode::POLLING, 0, false}, #if defined(__linux__) && defined(HAS_EVENTFD) - {QueueSignalledMode::EVENTFD, 0, false}, - {QueueSignalledMode::EVENTFD, 0, true} + {QueueSignalledMode::EVENTFD, 0, false}, + {QueueSignalledMode::EVENTFD, 0, true} #endif };