From 109ba3878a7b9d22ec3a9f70062de1a8d0031e3f Mon Sep 17 00:00:00 2001 From: Ramon Nou Date: Wed, 17 Dec 2025 20:25:05 +0100 Subject: [PATCH 1/2] fix initial issues in Mogon (pthread) --- CMake/FindPrometheuscpp.cmake | 65 +++++++++++++++++++++++++++++++++++ CMakeLists.txt | 2 +- examples/gfind/CMakeLists.txt | 2 +- 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 CMake/FindPrometheuscpp.cmake diff --git a/CMake/FindPrometheuscpp.cmake b/CMake/FindPrometheuscpp.cmake new file mode 100644 index 00000000..48264a06 --- /dev/null +++ b/CMake/FindPrometheuscpp.cmake @@ -0,0 +1,65 @@ +# FindPrometheuscpp.cmake +# +# Finds the prometheus-cpp library +# +# This will define the following variables: +# +# Prometheuscpp_FOUND +# Prometheuscpp_INCLUDE_DIRS +# Prometheuscpp_LIBRARIES +# +# And the following imported targets: +# +# prometheus-cpp::core +# prometheus-cpp::pull +# prometheus-cpp::push +# + +find_package(PkgConfig) +pkg_check_modules(PC_Prometheuscpp QUIET prometheus-cpp-core prometheus-cpp-pull prometheus-cpp-push) + +find_path(Prometheuscpp_INCLUDE_DIR + NAMES prometheus/registry.h + HINTS ${PC_Prometheuscpp_INCLUDE_DIRS} +) + +foreach(COMPONENT core pull push) + string(TOUPPER ${COMPONENT} COMPONENT_UPPER) + find_library(Prometheuscpp_${COMPONENT_UPPER}_LIBRARY + NAMES prometheus-cpp-${COMPONENT} + HINTS ${PC_Prometheuscpp_LIBRARY_DIRS} + ) +endforeach() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Prometheuscpp + REQUIRED_VARS Prometheuscpp_CORE_LIBRARY Prometheuscpp_PULL_LIBRARY Prometheuscpp_PUSH_LIBRARY Prometheuscpp_INCLUDE_DIR + VERSION_VAR PC_Prometheuscpp_VERSION +) + +if(Prometheuscpp_FOUND) + set(Prometheuscpp_LIBRARIES ${Prometheuscpp_CORE_LIBRARY} ${Prometheuscpp_PULL_LIBRARY} ${Prometheuscpp_PUSH_LIBRARY}) + set(Prometheuscpp_INCLUDE_DIRS ${Prometheuscpp_INCLUDE_DIR}) + + if(NOT TARGET prometheus-cpp::core) + add_library(prometheus-cpp::core UNKNOWN IMPORTED) + set_target_properties(prometheus-cpp::core PROPERTIES + IMPORTED_LOCATION "${Prometheuscpp_CORE_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${Prometheuscpp_INCLUDE_DIR}" + ) + endif() + + foreach(COMPONENT pull push) + string(TOUPPER ${COMPONENT} COMPONENT_UPPER) + if(NOT TARGET prometheus-cpp::${COMPONENT}) + add_library(prometheus-cpp::${COMPONENT} UNKNOWN IMPORTED) + set_target_properties(prometheus-cpp::${COMPONENT} PROPERTIES + IMPORTED_LOCATION "${Prometheuscpp_${COMPONENT_UPPER}_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${Prometheuscpp_INCLUDE_DIR}" + ) + target_link_libraries(prometheus-cpp::${COMPONENT} INTERFACE prometheus-cpp::core) + endif() + endforeach() +endif() + +mark_as_advanced(Prometheuscpp_INCLUDE_DIR Prometheuscpp_CORE_LIBRARY Prometheuscpp_PULL_LIBRARY Prometheuscpp_PUSH_LIBRARY) diff --git a/CMakeLists.txt b/CMakeLists.txt index fbbe3828..0417a271 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -206,7 +206,7 @@ endif () ### prometheus-cpp::core, and curl imported targets if (GKFS_ENABLE_PROMETHEUS) find_package(CURL 7.68.0 REQUIRED) - find_package(prometheus-cpp REQUIRED) # >= 1.0.0 + find_package(Prometheuscpp REQUIRED) endif () ### Other stuff that can be found out using find_package: diff --git a/examples/gfind/CMakeLists.txt b/examples/gfind/CMakeLists.txt index 38156271..ae6e202c 100644 --- a/examples/gfind/CMakeLists.txt +++ b/examples/gfind/CMakeLists.txt @@ -29,7 +29,7 @@ set (CMAKE_CXX_STANDARD 17) add_executable(sfind sfind.cpp) -target_link_libraries(sfind PRIVATE ZStd::ZStd) +target_link_libraries(sfind PRIVATE ZStd::ZStd Threads::Threads) set_property(TARGET sfind PROPERTY POSITION_INDEPENDENT_CODE ON) if(GKFS_INSTALL_TESTS) install(TARGETS sfind -- GitLab From 72bbed3ae458843ba0ce6a0a5fb2250ba57e1773 Mon Sep 17 00:00:00 2001 From: Ramon Nou Date: Wed, 17 Dec 2025 21:40:59 +0100 Subject: [PATCH 2/2] fix ls in mogon without compression --- src/daemon/handler/srv_metadata.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/daemon/handler/srv_metadata.cpp b/src/daemon/handler/srv_metadata.cpp index 42b66114..9c408116 100644 --- a/src/daemon/handler/srv_metadata.cpp +++ b/src/daemon/handler/srv_metadata.cpp @@ -702,7 +702,11 @@ rpc_srv_get_dirents(hg_handle_t handle) { } // Respond - out.dirents_size = transfer_size; + if(gkfs::config::rpc::use_dirents_compression) { + out.dirents_size = transfer_size; + } else { + out.dirents_size = entries.size(); + } out.err = 0; GKFS_DATA->spdlogger()->debug( -- GitLab