From 5199918d35f118a6beff3cb66e70ff3dd36cc7e1 Mon Sep 17 00:00:00 2001 From: Ramon Nou Date: Thu, 4 Jul 2024 16:28:46 +0200 Subject: [PATCH 1/3] adding fmt10 support --- CMakeLists.txt | 6 ++++-- lib/fmt_formatters.hpp | 8 +++++++- src/logger/logger.hpp | 5 ++++- src/net/server.cpp | 2 +- src/net/utilities.hpp | 20 ++++++++++++-------- src/parallel_request.hpp | 2 +- 6 files changed, 29 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dd8c7b..fd15795 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,8 @@ project( VERSION 0.3.6 LANGUAGES C CXX ) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) # Set default build type and also populate a list of available options get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) @@ -214,7 +216,7 @@ message(STATUS "[${PROJECT_NAME}] Downloading and building {fmt}") FetchContent_Declare( fmt GIT_REPOSITORY https://github.com/fmtlib/fmt - GIT_TAG d141cdbeb0fb422a3fb7173b285fd38e0d1772dc # v8.0.1 + GIT_TAG 10.2.1 GIT_SHALLOW ON GIT_PROGRESS ON ) @@ -227,7 +229,7 @@ message(STATUS "[${PROJECT_NAME}] Downloading and building spdlog") FetchContent_Declare( spdlog GIT_REPOSITORY https://github.com/gabime/spdlog - GIT_TAG eb3220622e73a4889eee355ffa37972b3cac3df5 # v1.9.2 + GIT_TAG v1.14.0 GIT_SHALLOW ON GIT_PROGRESS ON ) diff --git a/lib/fmt_formatters.hpp b/lib/fmt_formatters.hpp index b57d5b1..7ab61be 100644 --- a/lib/fmt_formatters.hpp +++ b/lib/fmt_formatters.hpp @@ -29,9 +29,15 @@ #include #include #include +#include #include +#include +#include +#include #include "cargo/error.hpp" + + namespace cargo { class dataset; @@ -44,7 +50,7 @@ struct fmt::formatter : formatter { template auto format(const cargo::dataset& d, FormatContext& ctx) const { - const auto str = fmt::format("{{path: {}}}", std::quoted(d.path())); + const auto str = fmt::format("{{path: {:?}}}", d.path()); return formatter::format(str, ctx); } }; diff --git a/src/logger/logger.hpp b/src/logger/logger.hpp index 891be9c..8f8bb35 100644 --- a/src/logger/logger.hpp +++ b/src/logger/logger.hpp @@ -25,9 +25,12 @@ #ifndef LOGGER_HPP #define LOGGER_HPP +#include #include +#include +#include #include -#include + #include #include diff --git a/src/net/server.cpp b/src/net/server.cpp index 2bcade2..263cfd9 100644 --- a/src/net/server.cpp +++ b/src/net/server.cpp @@ -31,7 +31,7 @@ #include #include #include -#include + #include #include "signal_listener.hpp" diff --git a/src/net/utilities.hpp b/src/net/utilities.hpp index 4e01d71..f29e2ce 100644 --- a/src/net/utilities.hpp +++ b/src/net/utilities.hpp @@ -33,6 +33,10 @@ #include #include #include +#include +#include +#include +#include namespace network { @@ -114,22 +118,22 @@ struct fmt::formatter { } if(it != end && *it != '}') { - ctx.on_error("invalid format"); + format_error("invalid format"); } return it; } template - constexpr auto + auto format(const network::rpc_info& rpc, FormatContext& ctx) const { - format_to(ctx.out(), "{}{} id: {} name: {} ", m_outbound ? "<=" : "=>", + format_to(ctx.out(), "{}{} id: {} name: {:?} ", m_outbound ? "<=" : "=>", rpc.pid() ? fmt::format(" pid: {}", *rpc.pid()) : "", - rpc.id(), std::quoted(rpc.name())); - return m_outbound ? format_to(ctx.out(), "to: {}", - std::quoted(rpc.address())) - : format_to(ctx.out(), "from: {}", - std::quoted(rpc.address())); + rpc.id(), (rpc.name())); + return m_outbound ? format_to(ctx.out(), "to: {:?}", + (rpc.address())) + : format_to(ctx.out(), "from: {:?}", + (rpc.address())); } }; diff --git a/src/parallel_request.hpp b/src/parallel_request.hpp index 41f271f..4413894 100644 --- a/src/parallel_request.hpp +++ b/src/parallel_request.hpp @@ -141,7 +141,7 @@ struct fmt::formatter : formatter { }; const auto str = fmt::format("{{state: {}, bw: {}, error_code: {}}}", - state_name(s), s.bw(), s.error()); + state_name(s), s.bw(), *s.error()); return formatter::format(str, ctx); } }; -- GitLab From 0137cd2788f192bee18489d7c41ca04202643c6c Mon Sep 17 00:00:00 2001 From: Marc Vef Date: Thu, 4 Jul 2024 16:59:28 +0200 Subject: [PATCH 2/3] format_to fix for fmt10 --- CMakeLists.txt | 5 +---- src/net/utilities.hpp | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd15795..5ea946c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ project( VERSION 0.3.6 LANGUAGES C CXX ) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) # Set default build type and also populate a list of available options @@ -85,9 +85,6 @@ set(CMAKE_SHARED_LINKER_FLAGS_ASAN set_property(GLOBAL APPEND PROPERTY DEBUG_CONFIGURATIONS Debug) set_property(GLOBAL APPEND PROPERTY DEBUG_CONFIGURATIONS ASan) -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - message(STATUS "[${PROJECT_NAME}] Project version: ${PROJECT_VERSION}") configure_file(src/version.hpp.in src/version.hpp) diff --git a/src/net/utilities.hpp b/src/net/utilities.hpp index f29e2ce..42d505b 100644 --- a/src/net/utilities.hpp +++ b/src/net/utilities.hpp @@ -127,12 +127,12 @@ struct fmt::formatter { template auto format(const network::rpc_info& rpc, FormatContext& ctx) const { - format_to(ctx.out(), "{}{} id: {} name: {:?} ", m_outbound ? "<=" : "=>", + fmt::format_to(ctx.out(), "{}{} id: {} name: {:?} ", m_outbound ? "<=" : "=>", rpc.pid() ? fmt::format(" pid: {}", *rpc.pid()) : "", rpc.id(), (rpc.name())); - return m_outbound ? format_to(ctx.out(), "to: {:?}", + return m_outbound ? fmt::format_to(ctx.out(), "to: {:?}", (rpc.address())) - : format_to(ctx.out(), "from: {:?}", + : fmt::format_to(ctx.out(), "from: {:?}", (rpc.address())); } }; -- GitLab From e80d403e62312873f5d4d0c6fa5471f894ae81e8 Mon Sep 17 00:00:00 2001 From: Marc Vef Date: Thu, 4 Jul 2024 17:09:16 +0200 Subject: [PATCH 3/3] Fix GekkoFS API call for read/write --- src/posix_file/posix_file/fs_plugin/gekko_plugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/posix_file/posix_file/fs_plugin/gekko_plugin.cpp b/src/posix_file/posix_file/fs_plugin/gekko_plugin.cpp index 87b7e9a..aff3eac 100644 --- a/src/posix_file/posix_file/fs_plugin/gekko_plugin.cpp +++ b/src/posix_file/posix_file/fs_plugin/gekko_plugin.cpp @@ -28,13 +28,13 @@ gekko_plugin::open(const std::string& path, int flags, unsigned int mode) { // Override the pread function ssize_t gekko_plugin::pread(int fd, void* buf, size_t count, off_t offset) { - return gkfs::syscall::gkfs_pread_ws(fd, buf, count, offset); + return gkfs::syscall::gkfs_pread(fd, buf, count, offset); } // Override the pwrite function ssize_t gekko_plugin::pwrite(int fd, const void* buf, size_t count, off_t offset) { - return gkfs::syscall::gkfs_pwrite_ws(fd, buf, count, offset); + return gkfs::syscall::gkfs_pwrite(fd, buf, count, offset); } -- GitLab