Renamed Linux to GNU/Linux and other tidying

This commit is contained in:
Nav
2022-06-01 21:48:27 +01:00
parent ec9068ba42
commit dd204742d3
10 changed files with 28 additions and 26 deletions

View File

@@ -2,7 +2,7 @@
Bloom can be downloaded at https://bloom.oscillate.io/download. Bloom can be downloaded at https://bloom.oscillate.io/download.
Bloom is a debug interface for embedded systems development on Linux. This is the official repository for Bloom's Bloom is a debug interface for embedded systems development on GNU/Linux. This is the official repository for Bloom's
source code. For information on how to use Bloom, please visit https://bloom.oscillate.io. source code. For information on how to use Bloom, please visit https://bloom.oscillate.io.
Bloom implements a number of user-space device drivers, enabling support for many debug tools (such as the Atmel-ICE, Bloom implements a number of user-space device drivers, enabling support for many debug tools (such as the Atmel-ICE,

View File

@@ -1,4 +1,4 @@
A debug interface for embedded systems development on Linux. A debug interface for embedded systems development on GNU/Linux.
Usage: Usage:
bloom [ENVIRONMENT_NAME/COMMAND] bloom [ENVIRONMENT_NAME/COMMAND]

View File

@@ -71,7 +71,7 @@ namespace Bloom::Usb
return output; return output;
} }
void HidInterface::write(std::vector<unsigned char> buffer) { void HidInterface::write(std::vector<unsigned char>&& buffer) {
if (buffer.size() > this->getInputReportSize()) { if (buffer.size() > this->getInputReportSize()) {
throw DeviceCommunicationFailure( throw DeviceCommunicationFailure(
"Cannot send data via HID interface - data exceeds maximum packet size." "Cannot send data via HID interface - data exceeds maximum packet size."
@@ -87,7 +87,7 @@ namespace Bloom::Usb
} }
int transferred = 0; int transferred = 0;
auto length = buffer.size(); const auto length = buffer.size();
if ((transferred = hid_write(this->getHidDevice(), buffer.data(), length)) != length) { if ((transferred = hid_write(this->getHidDevice(), buffer.data(), length)) != length) {
Logger::debug("Attempted to write " + std::to_string(length) Logger::debug("Attempted to write " + std::to_string(length)

View File

@@ -50,7 +50,7 @@ namespace Bloom::Usb
* *
* @param buffer * @param buffer
*/ */
void write(std::vector<unsigned char> buffer); void write(std::vector<unsigned char>&& buffer);
/** /**
* Resolves a device path from a USB interface number. * Resolves a device path from a USB interface number.

View File

@@ -23,7 +23,7 @@ namespace Bloom
} }
void EpollInstance::addEntry(int fileDescriptor, std::uint16_t eventMask) { void EpollInstance::addEntry(int fileDescriptor, std::uint16_t eventMask) {
struct epoll_event event = { struct ::epoll_event event = {
.events = eventMask, .events = eventMask,
.data = { .data = {
.fd = fileDescriptor .fd = fileDescriptor

View File

@@ -12,7 +12,7 @@ namespace Bloom
using Exceptions::Exception; using Exceptions::Exception;
EventFdNotifier::EventFdNotifier() { EventFdNotifier::EventFdNotifier() {
this->fileDescriptor = ::eventfd(0, EFD_NONBLOCK); this->fileDescriptor = ::eventfd(0, ::EFD_NONBLOCK);
if (this->fileDescriptor < 0) { if (this->fileDescriptor < 0) {
throw Exception( throw Exception(
@@ -40,7 +40,7 @@ namespace Bloom
} }
void EventFdNotifier::clear() { void EventFdNotifier::clear() {
eventfd_t counter = {}; ::eventfd_t counter = {};
if (::eventfd_read(this->fileDescriptor.value(), &counter) < 0 && errno != EAGAIN) { if (::eventfd_read(this->fileDescriptor.value(), &counter) < 0 && errno != EAGAIN) {
throw Exceptions::Exception("Failed to clear EventFdNotifier object - eventfd_read failed - " throw Exceptions::Exception("Failed to clear EventFdNotifier object - eventfd_read failed - "
"error number: " + std::to_string(errno)); "error number: " + std::to_string(errno));

View File

@@ -11,16 +11,17 @@ namespace Bloom
void SignalHandler::run() { void SignalHandler::run() {
try { try {
this->startup(); this->startup();
auto signalSet = this->getRegisteredSignalSet(); const auto signalSet = this->getRegisteredSignalSet();
int signalNumber = 0; int signalNumber = 0;
Logger::debug("SignalHandler ready"); Logger::debug("SignalHandler ready");
while(Thread::getThreadState() == ThreadState::READY) { while(Thread::getThreadState() == ThreadState::READY) {
if (sigwait(&signalSet, &signalNumber) == 0) { if (::sigwait(&signalSet, &signalNumber) == 0) {
Logger::debug("SIGNAL " + std::to_string(signalNumber) + " received"); Logger::debug("SIGNAL " + std::to_string(signalNumber) + " received");
if (this->handlersMappedBySignalNum.contains(signalNumber)) {
if (this->handlersBySignalNum.contains(signalNumber)) {
// We have a registered handler for this signal. // We have a registered handler for this signal.
this->handlersMappedBySignalNum.at(signalNumber)(); this->handlersBySignalNum.at(signalNumber)();
} }
} }
} }
@@ -39,15 +40,15 @@ namespace Bloom
Logger::debug("Starting SignalHandler"); Logger::debug("Starting SignalHandler");
// Block all signal interrupts // Block all signal interrupts
auto signalSet = this->getRegisteredSignalSet(); auto signalSet = this->getRegisteredSignalSet();
sigprocmask(SIG_SETMASK, &signalSet, NULL); ::sigprocmask(SIG_SETMASK, &signalSet, NULL);
// Register handlers // Register handlers
this->handlersMappedBySignalNum.insert(std::pair( this->handlersBySignalNum.insert(std::pair(
SIGINT, SIGINT,
std::bind(&SignalHandler::triggerApplicationShutdown, this) std::bind(&SignalHandler::triggerApplicationShutdown, this)
)); ));
this->handlersMappedBySignalNum.insert(std::pair( this->handlersBySignalNum.insert(std::pair(
SIGTERM, SIGTERM,
std::bind(&SignalHandler::triggerApplicationShutdown, this) std::bind(&SignalHandler::triggerApplicationShutdown, this)
)); ));
@@ -58,10 +59,10 @@ namespace Bloom
} }
} }
sigset_t SignalHandler::getRegisteredSignalSet() const { ::sigset_t SignalHandler::getRegisteredSignalSet() const {
sigset_t set = {}; ::sigset_t set = {};
if (sigfillset(&set) == -1) { if (::sigfillset(&set) == -1) {
throw Exceptions::Exception("sigfillset() failed - error number: " + std::to_string(errno)); throw Exceptions::Exception("::sigfillset() failed - error number: " + std::to_string(errno));
} }
return set; return set;

View File

@@ -27,9 +27,9 @@ namespace Bloom
private: private:
/** /**
* Mapping of signal numbers to functions. * Mapping of signal numbers to handler functions.
*/ */
std::map<int, std::function<void()>> handlersMappedBySignalNum; std::map<int, std::function<void()>> handlersBySignalNum;
/** /**
* We keep record of the number of shutdown signals received. See definition of triggerApplicationShutdown() * We keep record of the number of shutdown signals received. See definition of triggerApplicationShutdown()
@@ -49,7 +49,7 @@ namespace Bloom
* *
* @return * @return
*/ */
[[nodiscard]] sigset_t getRegisteredSignalSet() const; [[nodiscard]] ::sigset_t getRegisteredSignalSet() const;
/** /**
* Handler for SIGINT, SIGTERM, etc signals. * Handler for SIGINT, SIGTERM, etc signals.

View File

@@ -1,11 +1,9 @@
#include "Avr8.hpp" #include "Avr8.hpp"
#include <cstdint>
#include <QtCore>
#include <QJsonDocument>
#include <cassert> #include <cassert>
#include <bitset> #include <bitset>
#include <limits> #include <limits>
#include <thread>
#include "src/Logger/Logger.hpp" #include "src/Logger/Logger.hpp"
#include "src/Helpers/Paths.hpp" #include "src/Helpers/Paths.hpp"

View File

@@ -6,7 +6,10 @@
namespace Bloom namespace Bloom
{ {
VersionNumber::VersionNumber(std::uint16_t major, std::uint16_t minor, std::uint16_t patch) VersionNumber::VersionNumber(std::uint16_t major, std::uint16_t minor, std::uint16_t patch)
: major{major}, minor{minor}, patch{patch} { : major{major}
, minor{minor}
, patch{patch}
{
this->combined = static_cast<std::uint32_t>( this->combined = static_cast<std::uint32_t>(
std::stoul(std::to_string(this->major) + std::to_string(this->minor) + std::to_string(this->patch)) std::stoul(std::to_string(this->major) + std::to_string(this->minor) + std::to_string(this->patch))
); );