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

Harmonize comment and code-style

Signed-off-by: Steffen Vogel <steffen.vogel@opal-rt.com>
This commit is contained in:
Steffen Vogel 2023-08-28 12:31:18 +02:00 committed by Steffen Vogel
parent cac2660f78
commit a6f89dceb5
76 changed files with 239 additions and 235 deletions

View file

@ -1,10 +1,10 @@
/** Various helper functions.
/* Various helper functions.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** A simple buffer for encoding streamed JSON messages.
/* A simple buffer for encoding streamed JSON messages.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** Various helper functions.
/* Various helper functions.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2017, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** Some common defines, enums and datastructures.
/* Some common defines, enums and datastructures.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,9 +1,9 @@
/** Compatability for different library versions.
/* Compatability for different library versions.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** Human readable cpusets.
/* Human readable cpusets.
*
* @file
* @author Steffen Vogel <github@daniel-krebs.net>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** An exponential window.
/* An exponential window.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** A moving average window.
/* A moving average window.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** A PID controller.
/* A PID controller.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** A sliding/moving window.
/* A sliding/moving window.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** A sliding/moving window.
/* A sliding/moving window.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once
@ -17,7 +17,6 @@
namespace villas {
namespace dsp {
template<typename T>// a0 = 1.0, double a1 = 0.0, double a2 = 0.0, double a3 = 0.0, double a4 = 0.0>
class CosineWindow : public Window<T> {
@ -54,7 +53,6 @@ public:
correctionFactor /= len;
}
virtual
T getCorrectionFactor() const
{

View file

@ -1,10 +1,10 @@
/** Common exceptions.
/* Common exceptions.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** A directed graph.
/* A directed graph.
*
* @file
* @author Daniel Krebs <github@daniel-krebs.net>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once
@ -21,11 +21,9 @@
#include <villas/graph/vertex.hpp>
#include <villas/graph/edge.hpp>
namespace villas {
namespace graph {
template<typename VertexType = Vertex, typename EdgeType = Edge>
class DirectedGraph {
public:
@ -114,7 +112,6 @@ public:
return edge->id;
}
EdgeIdentifier addDefaultEdge(VertexIdentifier fromVertexId,
VertexIdentifier toVertexId)
{

View file

@ -1,10 +1,10 @@
/** A graph edge.
/* A graph edge.
*
* @file
* @author Daniel Krebs <github@daniel-krebs.net>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** A graph vertex.
/* A graph vertex.
*
* @file
* @author Daniel Krebs <github@daniel-krebs.net>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** Histogram class.
/* Histogram class.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once
@ -110,7 +110,6 @@ protected:
cnt_t higher; // The number of values which are higher than #high.
cnt_t lower; // The number of values which are lower than #low.
std::vector<cnt_t> data; // Bucket counters.
double _m[2], _s[2]; // Private variables for online variance calculation.

View file

@ -1,10 +1,10 @@
/** Linux kernel related functions.
/* Linux kernel related functions.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once
@ -15,21 +15,21 @@
namespace villas {
namespace kernel {
// Get the version of the kernel.
// Get the version of the kernel
utils::Version getVersion();
// Get number of reserved hugepages.
// Get number of reserved hugepages
int getNrHugepages();
// Set number of reserved hugepages.
// Set number of reserved hugepages
int setNrHugepages(int nr);
// Get kernel cmdline parameter
//
// See https://www.kernel.org/doc/Documentation/kernel-parameters.txt
//
// @param param The cmdline parameter to look for.
// @param buf The string buffer to which the parameter value will be copied to.
// @param param The cmdline parameter to look for
// @param buf The string buffer to which the parameter value will be copied to
// @param len The length of the buffer \p value
// @retval 0 Parameter \p key was found and value was copied to \p value
// @reval <>0 Kernel was not booted with parameter \p key
@ -38,8 +38,8 @@ int getCmdlineParam(const char *param, char *buf, size_t len);
// Checks if a kernel module is loaded
//
// @param module the name of the module
// @retval 0 Module is loaded.
// @reval <>0 Module is not loaded.
// @retval 0 Module is loaded
// @reval <>0 Module is not loaded
int isModuleLoaded(const char *module);
// Load kernel module via modprobe
@ -51,10 +51,10 @@ int setModuleParam(const char *module, const char *param, const char *value);
// Get cacheline size in bytes
int getCachelineSize();
// Get the size of a standard page in bytes.
// Get the size of a standard page in bytes
int getPageSize();
// Get the size of a huge page in bytes.
// Get the size of a huge page in bytes
int getHugePageSize();
// Get CPU base frequency

View file

@ -1,10 +1,10 @@
/** Linux PCI helpers
/* Linux PCI helpers
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once
@ -87,13 +87,13 @@ public:
bool
operator==(const Device &other);
// Get currently loaded driver for device.
// Get currently loaded driver for device
std::string getDriver() const;
// Bind a new LKM to the PCI device.
// Bind a new LKM to the PCI device
bool attachDriver(const std::string &driver) const;
// Return the IOMMU group of this PCI device or -1 if the device is not in a group.
// Return the IOMMU group of this PCI device or -1 if the device is not in a group
int getIommuGroup() const;
std::list<Region> getRegions() const;
@ -102,14 +102,14 @@ public:
void writeBar(uint32_t addr, unsigned bar = 0);
// If BAR values in config space and in the kernel do not match, rewrite
// the BAR value of the kernel to PCIe config space.
// the BAR value of the kernel to PCIe config space
void rewriteBar(unsigned bar = 0);
// Read 32-bit BAR value from the PCI configuration space.
// Read 32-bit BAR value from the PCI configuration space
uint32_t readBar(unsigned bar = 0) const;
// Read 32-bit BAR value from the devices resource file. This is what the kernel
// thinks the BAR should be.
// Read 32-bit BAR value from the devices resource file.
// This is what the kernel thinks the BAR should be.
uint32_t readHostBar(unsigned bar = 0) const;
Id id;

View file

@ -1,11 +1,11 @@
/** Linux specific real-time optimizations
/* Linux specific real-time optimizations
*
* @see: https://wiki.linuxfoundation.org/realtime/documentation/howto/applications/application_base
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,4 +1,4 @@
/** Virtual Function IO wrapper around kernel API
/* Virtual Function IO wrapper around kernel API
*
* @file
* @author Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
@ -7,7 +7,7 @@
* @copyright 2022, Niklas Eiling
* @copyright 2014-2021, Steffen Vogel
* @copyright 2018, Daniel Krebs
*********************************************************************************/
*/
#pragma once
@ -26,18 +26,20 @@ namespace vfio {
// Backwards compatability with older kernels
#ifdef VFIO_UPDATE_VADDR
static constexpr size_t EXTENSION_SIZE = VFIO_UPDATE_VADDR+1;
static constexpr
size_t EXTENSION_SIZE = VFIO_UPDATE_VADDR+1;
#elif defined(VFIO_UNMAP_ALL)
static constexpr size_t EXTENSION_SIZE = VFIO_UNMAP_ALL+1;
static constexpr
size_t EXTENSION_SIZE = VFIO_UNMAP_ALL+1;
#else
static constexpr size_t EXTENSION_SIZE = VFIO_NOIOMMU_IOMMU+1;
static constexpr
size_t EXTENSION_SIZE = VFIO_NOIOMMU_IOMMU+1;
#endif
class Container {
public:
Container();
// No copying allowed because we manage the vfio state in constructor and destructors
Container(Container const&) = delete;
void operator=(Container const&) = delete;

View file

@ -1,4 +1,4 @@
/** Virtual Function IO wrapper around kernel API
/* Virtual Function IO wrapper around kernel API
*
* @file
* @author Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
@ -7,7 +7,7 @@
* @copyright 2022, Niklas Eiling
* @copyright 2014-2021, Steffen Vogel
* @copyright 2018, Daniel Krebs
*********************************************************************************/
*/
#pragma once

View file

@ -1,4 +1,4 @@
/** Virtual Function IO wrapper around kernel API
/* Virtual Function IO wrapper around kernel API
*
* @file
* @author Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
@ -7,7 +7,7 @@
* @copyright 2022, Niklas Eiling
* @copyright 2014-2021, Steffen Vogel
* @copyright 2018, Daniel Krebs
*********************************************************************************/
*/
#pragma once

View file

@ -1,4 +1,4 @@
/** A generic list implementation.
/* A generic list implementation.
*
* This is a generic implementation of a list which can store void pointers to
* arbitrary data. The data itself is not stored or managed by the list.
@ -9,9 +9,9 @@
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
*
*
* VILLAScommon
* *********************************************************************************/
* */
#pragma once
@ -25,14 +25,16 @@
#define LIST_CHUNKSIZE 16
// Static list initialization
#define LIST_INIT_STATIC(l) \
__attribute__((constructor(105))) static void UNIQUE(__ctor)() {\
int ret __attribute__((unused)); \
ret = list_init(l); \
} \
__attribute__((destructor(105))) static void UNIQUE(__dtor)() { \
int ret __attribute__((unused)); \
ret = list_destroy(l, nullptr, false); \
#define LIST_INIT_STATIC(l) \
__attribute__((constructor(105))) static \
void UNIQUE(__ctor)() { \
int ret __attribute__((unused)); \
ret = list_init(l); \
} \
__attribute__((destructor(105))) static \
void UNIQUE(__dtor)() { \
int ret __attribute__((unused)); \
ret = list_destroy(l, nullptr, false); \
}
#define list_length(list) ((list)->length)

View file

@ -1,11 +1,11 @@
/** Logging.
/* Logging.
*
* @file
* @author Daniel Krebs <github@daniel-krebs.net>
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once
@ -26,7 +26,8 @@ class Log;
using Logger = std::shared_ptr<spdlog::logger>;
extern Log logging;
extern
Log logging;
class Log {

View file

@ -1,10 +1,10 @@
/** Memory management.
/* Memory management.
*
* @file
* @author Daniel Krebs <github@daniel-krebs.net>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once
@ -254,8 +254,10 @@ public:
allocateBlock(size_t size);
private:
static constexpr size_t alignBytes = sizeof(uintptr_t);
static constexpr size_t alignMask = alignBytes - 1;
static constexpr
size_t alignBytes = sizeof(uintptr_t);
static constexpr
size_t alignMask = alignBytes - 1;
size_t getAlignmentPadding(uintptr_t addr) const
{
@ -268,7 +270,6 @@ private:
size_t allocationCount; // Number of individual allocations present
};
// Wrapper around mmap() to create villas memory blocks
//
// This class simply wraps around mmap() and munmap() to allocate memory in the
@ -288,17 +289,17 @@ public:
allocateBlock(size_t size);
};
static HostRamAllocator&
getAllocator()
static
HostRamAllocator& getAllocator()
{
return allocator;
}
private:
static HostRamAllocator allocator;
static
HostRamAllocator allocator;
};
class HostDmaRam {
public:
class HostDmaRamAllocator : public LinearAllocator {
@ -317,23 +318,28 @@ public:
int num;
};
static HostDmaRamAllocator&
static
HostDmaRamAllocator&
getAllocator(int num = 0);
private:
static
std::map<int, std::unique_ptr<HostDmaRamAllocator>> allocators;
static std::string
static
std::string
getUdmaBufName(int num);
static std::string
static
std::string
getUdmaBufBasePath(int num);
static size_t
static
size_t
getUdmaBufBufSize(int num);
static uintptr_t
static
uintptr_t
getUdmaBufPhysAddr(int num);
};

View file

@ -1,10 +1,10 @@
/** Memory manager.
/* Memory manager.
*
* @file
* @author Daniel Krebs <github@daniel-krebs.net>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once
@ -65,7 +65,6 @@ private:
size_t size; // Size of "memory window"
};
// Global memory manager to resolve addresses across address spaces
//
// Every entity in the system has to register its (master) address space and
@ -124,7 +123,6 @@ private:
}
};
// Custom vertex in memory graph representing an address space
//
// Since most information in the memory graph is stored in the edges (memory
@ -196,7 +194,6 @@ public:
AddressSpaceId fromAddrSpace,
AddressSpaceId toAddrSpace);
AddressSpaceId findAddressSpace(const std::string &name);
std::list<AddressSpaceId> findPath(const AddressSpaceId &fromAddrSpaceId, const AddressSpaceId &toAddrSpaceId);
@ -243,7 +240,8 @@ private:
MemoryGraph::check_path_fn pathCheckFunc;
// Static pointer to global instance, because this is a singleton
static MemoryManager* instance;
static
MemoryManager* instance;
};
} // namespace villas

View file

@ -1,11 +1,11 @@
/** Loadable / plugin support.
/* Loadable / plugin support.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @author Daniel Krebs <github@daniel-krebs.net>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once
@ -25,7 +25,8 @@ namespace plugin {
class Plugin;
class Registry;
extern Registry *registry;
extern
Registry *registry;
template<typename T = Plugin>
using List = std::list<T *>;

View file

@ -1,10 +1,10 @@
/** Bi-directional popen
/* Bi-directional popen
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** Print fancy tables
/* Print fancy tables
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** Run tasks periodically.
/* Run tasks periodically.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** Terminal handling.
/* Terminal handling.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once
@ -22,7 +22,8 @@ protected:
bool isTty;
static class Terminal *current;
static
class Terminal *current;
public:
Terminal();

View file

@ -1,10 +1,10 @@
/** Time related functions.
/* Time related functions.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** Common entry point for all villas command line tools.
/* Common entry point for all villas command line tools.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** Measure time and sleep with IA-32 time-stamp counter.
/* Measure time and sleep with IA-32 time-stamp counter.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,11 +1,11 @@
/** Utilities.
/* Utilities.
*
* @file
* @author Steffen Vogel <github@daniel-krebs.net>
* @author Daniel Krebs <github@daniel-krebs.net>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** UUID helpers.
/* UUID helpers.
*
* @file
* @author Steffen Vogel <github@daniel-krebs.net>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,10 +1,10 @@
/** Version.
/* Version.
*
* @file
* @author Steffen Vogel <github@daniel-krebs.net>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#pragma once

View file

@ -1,9 +1,9 @@
/** Base64 encoding/decoding
/* Base64 encoding/decoding
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <string>
#include <vector>
@ -16,8 +16,10 @@ namespace villas {
namespace utils {
namespace base64 {
static const char kEncodeLookup[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static const char kPadCharacter = '=';
static
const char kEncodeLookup[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static
const char kPadCharacter = '=';
std::string encode(const std::vector<byte>& input)
{

View file

@ -1,9 +1,9 @@
/** A simple buffer for encoding streamed JSON messages.
/* A simple buffer for encoding streamed JSON messages.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <villas/compat.hpp>
#include <villas/buffer.hpp>

View file

@ -1,9 +1,9 @@
/** Common code.
/* Common code.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <villas/common.hpp>

View file

@ -1,9 +1,9 @@
/** Compatability for different library versions.
/* Compatability for different library versions.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <cstring>
#include <jansson.h>
@ -43,7 +43,6 @@ json_t *json_loadfd(int input, size_t flags, json_error_t *error)
return json_load_callback(json_loadfd_callback, (void *) &input, flags, error);
}
static
int json_dumpfd_callback(const char *buffer, size_t size, void *data)
{

View file

@ -1,10 +1,10 @@
/** Human readable cpusets.
/* Human readable cpusets.
*
* @file
* @author Steffen Vogel <github@daniel-krebs.net>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <villas/cpuset.hpp>
#include <villas/utils.hpp>

View file

@ -1,9 +1,9 @@
/** A PID controller.
/* A PID controller.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <iostream>
#include <cmath>

View file

@ -1,9 +1,9 @@
/** Histogram class.
/* Histogram class.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <cmath>
#include <algorithm>

View file

@ -1,9 +1,9 @@
/** Linux kernel related functions.
/* Linux kernel related functions.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <sys/utsname.h>
#include <cstdio>

View file

@ -1,9 +1,9 @@
/** Linux PCI helpers
/* Linux PCI helpers
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <dirent.h>
#include <libgen.h>

View file

@ -1,9 +1,9 @@
/** Linux specific real-time optimizations
/* Linux specific real-time optimizations
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <sched.h>
#include <unistd.h>

View file

@ -1,11 +1,11 @@
/** Virtual Function IO wrapper around kernel API
/* Virtual Function IO wrapper around kernel API
*
* @author Steffen Vogel <post@steffenvogel.de>
* @author Daniel Krebs <github@daniel-krebs.net>
* @copyright 2014-2021, Steffen Vogel
* @copyright 2018, Daniel Krebs
* @license Apache License 2.0
*********************************************************************************/
*/
#define _DEFAULT_SOURCE
@ -41,8 +41,8 @@ using namespace villas::kernel::vfio;
#define VFIO_NOIOMMU_IOMMU 8
#endif
static std::array<std::string, EXTENSION_SIZE> construct_vfio_extension_str() {
static
std::array<std::string, EXTENSION_SIZE> construct_vfio_extension_str() {
std::array<std::string, EXTENSION_SIZE> ret;
ret[VFIO_TYPE1_IOMMU] = "Type 1";
ret[VFIO_SPAPR_TCE_IOMMU] = "SPAPR TCE";
@ -62,8 +62,8 @@ static std::array<std::string, EXTENSION_SIZE> construct_vfio_extension_str() {
return ret;
}
static std::array<std::string, EXTENSION_SIZE> VFIO_EXTENSION_STR = construct_vfio_extension_str();
static
std::array<std::string, EXTENSION_SIZE> VFIO_EXTENSION_STR = construct_vfio_extension_str();
Container::Container() :
fd(-1),
@ -74,7 +74,8 @@ Container::Container() :
groups(),
log(logging.get("kernel:vfio::Container"))
{
static constexpr const char* requiredKernelModules[] = {
static constexpr
const char* requiredKernelModules[] = {
"vfio", "vfio_pci", "vfio_iommu_type1"
};
@ -196,7 +197,8 @@ std::shared_ptr<Device> Container::attachDevice(pci::Device &pdev)
{
int ret;
char name[32], iommu_state[4];
static constexpr const char* kernelDriver = "vfio-pci";
static constexpr
const char* kernelDriver = "vfio-pci";
// Load PCI bus driver for VFIO
if (kernel::loadModule("vfio_pci"))

View file

@ -1,4 +1,4 @@
/** Virtual Function IO wrapper around kernel API
/* Virtual Function IO wrapper around kernel API
*
* @author Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
* @author Steffen Vogel <post@steffenvogel.de>
@ -7,7 +7,7 @@
* @copyright 2014-2021, Steffen Vogel
* @copyright 2018, Daniel Krebs
* @license Apache License 2.0
*********************************************************************************/
*/
#define _DEFAULT_SOURCE
@ -32,7 +32,8 @@
using namespace villas::kernel::vfio;
static const char *vfio_pci_region_names[] = {
static
const char *vfio_pci_region_names[] = {
"PCI_BAR0", // VFIO_PCI_BAR0_REGION_INDEX
"PCI_BAR1", // VFIO_PCI_BAR1_REGION_INDEX
"PCI_BAR2", // VFIO_PCI_BAR2_REGION_INDEX
@ -44,7 +45,8 @@ static const char *vfio_pci_region_names[] = {
"PCI_VGA" // VFIO_PCI_INTX_IRQ_INDEX
};
static const char *vfio_pci_irq_names[] = {
static
const char *vfio_pci_irq_names[] = {
"PCI_INTX", // VFIO_PCI_INTX_IRQ_INDEX
"PCI_MSI", // VFIO_PCI_MSI_IRQ_INDEX
"PCI_MSIX", // VFIO_PCI_MSIX_IRQ_INDEX
@ -122,11 +124,9 @@ Device::Device(const std::string &name, int groupFileDescriptor, const kernel::p
if (ret < 0)
throw RuntimeError("Failed to get IRQ {} of VFIO device: {}", i, name);
log->debug("irq {} info: flags: 0x{:x}, count: {}",
irq.index, irq.flags, irq.count);
irqs[i] = irq;
}
@ -384,7 +384,6 @@ bool Device::pciMsiFind(int nos[])
last = col;
} while ((col = strtok(nullptr, " ")));
ret = sscanf(last, "vfio-msi[%d](%12[0-9:])", &idx, name);
if (ret == 2) {
if (strstr(this->name.c_str(), name) == this->name.c_str())

View file

@ -1,11 +1,11 @@
/** Virtual Function IO wrapper around kernel API
/* Virtual Function IO wrapper around kernel API
*
* @author Steffen Vogel <post@steffenvogel.de>
* @author Daniel Krebs <github@daniel-krebs.net>
* @copyright 2014-2021, Steffen Vogel
* @copyright 2018, Daniel Krebs
* @license Apache License 2.0
*********************************************************************************/
*/
#define _DEFAULT_SOURCE

View file

@ -1,11 +1,11 @@
/** A generic linked list
/* A generic linked list
*
* Linked lists a used for several data structures in the code.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <array>
#include <algorithm>

View file

@ -1,9 +1,9 @@
/** Logging and debugging routines
/* Logging and debugging routines
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <list>
#include <algorithm>
@ -23,7 +23,8 @@ using namespace villas;
// The global log instance
Log villas::logging;
static std::map<spdlog::level::level_enum, std::string> levelNames = {
static
std::map<spdlog::level::level_enum, std::string> levelNames = {
{ spdlog::level::trace, "trc" },
{ spdlog::level::debug, "dbg" },
{ spdlog::level::info, "info" },

View file

@ -1,9 +1,9 @@
/** Memory managment.
/* Memory managment.
*
* @author Daniel Krebs <github@daniel-krebs.net>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <sys/mman.h>
@ -92,7 +92,6 @@ LinearAllocator::LinearAllocator(MemoryManager::AddressSpaceId memoryAddrSpaceId
};
}
std::string
LinearAllocator::getName() const
{
@ -105,7 +104,6 @@ LinearAllocator::getName() const
return name.str();
}
std::unique_ptr<MemoryBlock, MemoryBlock::deallocator_fn>
LinearAllocator::allocateBlock(size_t size)
{
@ -127,7 +125,6 @@ LinearAllocator::allocateBlock(size_t size)
nextFreeAddress = std::min(nextFreeAddress, memorySize);
}
auto &mm = MemoryManager::get();
// Assemble name for this block
@ -153,7 +150,6 @@ LinearAllocator::allocateBlock(size_t size)
return mem;
}
HostRam::HostRamAllocator
HostRam::allocator;
@ -170,7 +166,6 @@ HostRam::HostRamAllocator::HostRamAllocator() :
};
}
std::map<int, std::unique_ptr<HostDmaRam::HostDmaRamAllocator>>
HostDmaRam::allocators;

View file

@ -1,9 +1,9 @@
/** Memory managment.
/* Memory managment.
*
* @author Daniel Krebs <github@daniel-krebs.net>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <memory>
#include <limits>

View file

@ -1,9 +1,9 @@
/** Loadable / plugin support.
/* Loadable / plugin support.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <iostream>
#include <string>

View file

@ -1,9 +1,9 @@
/** Bi-directional popen
/* Bi-directional popen
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <sys/types.h>
#include <sys/stat.h>
@ -165,7 +165,6 @@ int Popen::close()
return pid == -1 ? -1 : pstat;
}
PopenStream::PopenStream(const std::string &cmd,
const arg_list &args,
const env_map &env,

View file

@ -1,9 +1,9 @@
/** Print fancy tables.
/* Print fancy tables.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <cstdlib>
#include <cstring>

View file

@ -1,9 +1,9 @@
/** Run tasks periodically.
/* Run tasks periodically.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <unistd.h>
#include <ctime>
@ -153,7 +153,6 @@ uint64_t Task::wait()
now = tsc_now(&tsc);
} while (now < next);
for (runs = 0; next < now; runs++)
next += period;
#else

View file

@ -1,9 +1,9 @@
/** Terminal handling.
/* Terminal handling.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <unistd.h>

View file

@ -1,9 +1,9 @@
/** Time related functions.
/* Time related functions.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <unistd.h>

View file

@ -1,9 +1,9 @@
/** Common entry point for all villas command line tools.
/* Common entry point for all villas command line tools.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <iostream>

View file

@ -1,10 +1,10 @@
/** Measure time and sleep with IA-32 time-stamp counter.
/* Measure time and sleep with IA-32 time-stamp counter.
*
* @file
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <villas/tsc.hpp>

View file

@ -1,10 +1,10 @@
/** Utilities.
/* Utilities.
*
* @author Daniel Krebs <github@daniel-krebs.net>
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <vector>
#include <string>
@ -32,7 +32,8 @@
#include <villas/exceptions.hpp>
#include <villas/log.hpp>
static pthread_t main_thread;
static
pthread_t main_thread;
namespace villas {
namespace utils {
@ -170,8 +171,10 @@ void killme(int sig)
double boxMuller(float m, float s)
{
double x1, x2, y1;
static double y2;
static int use_last = 0;
static
double y2;
static
int use_last = 0;
if (use_last) { // Use value from previous call
y1 = y2;

View file

@ -1,9 +1,9 @@
/** UUID helpers.
/* UUID helpers.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <openssl/evp.h>

View file

@ -1,9 +1,9 @@
/** Version.
/* Version.
*
* @author Steffen Vogel <github@daniel-krebs.net>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <stdexcept>
#include <string>

View file

@ -1,9 +1,9 @@
/** Unit tests for base64 encoding/decoding
/* Unit tests for base64 encoding/decoding
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <criterion/criterion.h>
@ -16,7 +16,8 @@ using namespace villas::utils::base64;
// cppcheck-suppress unknownMacro
TestSuite(base64, .description = "Base64 En/decoder");
static std::vector<byte> vec(const char *str)
static
std::vector<byte> vec(const char *str)
{
return std::vector<byte>((byte *) str, (byte *) str + strlen(str));
}

View file

@ -1,9 +1,9 @@
/** Unit tests for buffer
/* Unit tests for buffer
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <cstdlib>
#include <ctime>

View file

@ -1,9 +1,9 @@
/** Graph unit test.
/* Graph unit test.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2021, Steffen Vogel
* @license Apache License 2.0
*********************************************************************************/
*/
#include <memory>
@ -95,13 +95,11 @@ Test(graph, path, .description = "Find path")
cr_assert(not g.getPath(v1id, v4id, path2));
logger->info(" no path found -> ok");
logger->info("Find non-existing path in circular sub-graph");
std::list<Graph::EdgeIdentifier> path3;
cr_assert(not g.getPath(v4id, v2id, path3));
logger->info(" no path found -> ok");
logger->info("Find path in circular graph");
std::list<Graph::EdgeIdentifier> path4;
cr_assert(g.getPath(v4id, v6id, path4));

View file

@ -1,9 +1,9 @@
/** Unit tests for histogram
/* Unit tests for histogram
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <array>

View file

@ -1,9 +1,9 @@
/** Unit tests for kernel functions.
/* Unit tests for kernel functions.
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <criterion/criterion.h>

View file

@ -1,9 +1,9 @@
/** Unit tests for array-based list
/* Unit tests for array-based list
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <cstdint>
#include <cstring>
@ -15,7 +15,8 @@
using namespace villas;
static const char *nouns[] = { "time", "person", "year", "way", "day", "thing", "man", "world", "life", "hand", "part", "child", "eye", "woman", "place", "work", "week", "case", "point", "government", "company", "number", "group", "problem", "fact" };
static
const char *nouns[] = { "time", "person", "year", "way", "day", "thing", "man", "world", "life", "hand", "part", "child", "eye", "woman", "place", "work", "week", "case", "point", "government", "company", "number", "group", "problem", "fact" };
struct data {
const char *name;

View file

@ -1,9 +1,9 @@
/** Unit tests for bi-directional popen
/* Unit tests for bi-directional popen
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <iostream>
#include <criterion/criterion.h>

View file

@ -1,9 +1,9 @@
/** Unit tests for periodic tasks
/* Unit tests for periodic tasks
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <criterion/criterion.h>

View file

@ -1,9 +1,9 @@
/** Unit tests for time related utlities
/* Unit tests for time related utlities
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <unistd.h>
#include <math.h>

View file

@ -1,9 +1,9 @@
/** Unit tests for rdtsc
/* Unit tests for rdtsc
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <criterion/criterion.h>

View file

@ -1,9 +1,9 @@
/** Unit tests for utilities
/* Unit tests for utilities
*
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
* @license Apache License 2.0
*********************************************************************************/
*/
#include <criterion/criterion.h>