Commit a1a3a04d authored by Jean Bez's avatar Jean Bez
Browse files

Create a target for GekkoFWD and merge the fix of statx to test

parent ecdfa12a
Loading
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -142,17 +142,9 @@ if(ENABLE_CLIENT_LOG)
    add_definitions(-DGKFS_ENABLE_LOGGING)
endif()
message(STATUS "[gekkofs] Client logging output: ${ENABLE_CLIENT_LOG}")
option(GKFS_ENABLE_FORWARDING "Enable forwarding mode" OFF)
if(GKFS_ENABLE_FORWARDING)
    add_definitions(-DGKFS_ENABLE_FORWARDING)
endif()
message(STATUS "[gekkofs] Forwarding mode: ${GKFS_ENABLE_FORWARDING}")

option(GKFS_ENABLE_FORWARDING "Enable forwarding mode" OFF)
option(GKFS_ENABLE_AGIOS "Enable AGIOS scheduling library" OFF)
if(GKFS_ENABLE_AGIOS)
    add_definitions(-DGKFS_ENABLE_AGIOS)
endif()
message(STATUS "[gekkofs] AGIOS scheduling: ${GKFS_ENABLE_AGIOS}")

set(CLIENT_LOG_MESSAGE_SIZE 1024 CACHE STRING "Maximum size of a log message in the client library")
add_definitions(-DLIBGKFS_LOG_MESSAGE_SIZE=${CLIENT_LOG_MESSAGE_SIZE})
@@ -215,6 +207,18 @@ include_directories(
)

include(GNUInstallDirs)
include(CheckSymbolExists)

check_cxx_source_compiles("
    #include <fcntl.h>
    #include <sys/stat.h>

    int main() {
        struct statx buf;
        statx(AT_FDCWD, \"/foo\", AT_EMPTY_PATH, STATX_BASIC_STATS, &buf);
        return 0;
    }
" GLIBC_HAS_STATX)

# Global components
add_subdirectory(src/global)
+2 −0
Original line number Diff line number Diff line
@@ -41,7 +41,9 @@ int gkfs_stat(const std::string& path, struct stat* buf, bool follow_links = tru

// Implementation of statx, it uses the normal stat and maps the information to the statx structure
// Follow links is true by default 
#ifdef STATX_TYPE
int gkfs_statx(int dirfd, const std::string& path, int flags, unsigned int mask,struct statx* buf, bool follow_links = true );
#endif

int gkfs_statfs(struct statfs* buf);

+2 −0
Original line number Diff line number Diff line
@@ -30,7 +30,9 @@ int hook_close(int fd);

int hook_stat(const char* path, struct stat* buf);

#ifdef STATX_TYPE
int hook_statx(int dirfd, const char* path, int flags, unsigned int mask,struct statx* buf);
#endif

int hook_lstat(const char* path, struct stat* buf);

+2 −2
Original line number Diff line number Diff line
@@ -77,9 +77,9 @@ private:
public:
    ForwarderDistributor(host_t fwhost, unsigned int hosts_size);

    host_t localhost() const override;
    host_t localhost() const override final;

    host_t locate_data(const std::string& path, const chunkid_t& chnk_id) const override;
    host_t locate_data(const std::string& path, const chunkid_t& chnk_id) const override final;

    host_t locate_file_metadata(const std::string& path) const override;

+96 −0
Original line number Diff line number Diff line
@@ -79,3 +79,99 @@ install(TARGETS gkfs_intercept
    PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gkfs
)

if(GKFS_ENABLE_FORWARDING)
    set(FWD_PRELOAD_SRC
        gkfs_functions.cpp
        hooks.cpp
        intercept.cpp
        logging.cpp
        open_file_map.cpp
        open_dir.cpp
        path.cpp
        preload.cpp
        preload_context.cpp
        preload_util.cpp
        ../global/path_util.cpp
        ../global/rpc/rpc_util.cpp
        rpc/rpc_types.cpp
        rpc/forward_data.cpp
        rpc/forward_management.cpp
        rpc/forward_metadata.cpp
        syscalls/detail/syscall_info.c
        )
    set(FWD_PRELOAD_HEADERS
        ../../include/client/gkfs_functions.hpp
        ../../include/config.hpp
        ../../include/client/env.hpp
        ../../include/client/hooks.hpp
        ../../include/client/intercept.hpp
        ../../include/client/logging.hpp
        ../../include/client/make_array.hpp
        ../../include/client/open_file_map.hpp
        ../../include/client/open_dir.hpp
        ../../include/client/path.hpp
        ../../include/client/preload.hpp
        ../../include/client/preload_context.hpp
        ../../include/client/preload_util.hpp
        ../../include/client/rpc/rpc_types.hpp
        ../../include/client/rpc/forward_management.hpp
        ../../include/client/rpc/forward_metadata.hpp
        ../../include/client/rpc/forward_data.hpp
        ../../include/client/syscalls/args.hpp
        ../../include/client/syscalls/decoder.hpp
        ../../include/client/syscalls/errno.hpp
        ../../include/client/syscalls/rets.hpp
        ../../include/client/syscalls/syscall.hpp
        ../../include/client/syscalls/detail/syscall_info.h
        ../../include/global/cmake_configure.hpp
        ../../include/global/chunk_calc_util.hpp
        ../../include/global/global_defs.hpp
        ../../include/global/path_util.hpp
        ../../include/global/rpc/rpc_types.hpp
        ../../include/global/rpc/rpc_util.hpp
        )

    add_library(gkfwd_intercept SHARED ${FWD_PRELOAD_SRC} ${FWD_PRELOAD_HEADERS})

    if(GKFS_ENABLE_FORWARDING)
        set_target_properties(gkfwd_intercept
            PROPERTIES COMPILE_FLAGS -DGKFS_ENABLE_FORWARDING
        )
    endif()
    message(STATUS "[gekkofs] Forwarding mode: ${GKFS_ENABLE_FORWARDING}")

    if(GKFS_ENABLE_AGIOS)
        set_target_properties(gkfwd_intercept
            PROPERTIES COMPILE_FLAGS -DGKFS_ENABLE_AGIOS
        )
    endif()
    message(STATUS "[gekkofs] AGIOS scheduling: ${GKFS_ENABLE_AGIOS}")

    target_link_libraries(gkfwd_intercept
        # internal
        metadata
        distributor
        env_util
        # external
        Syscall_intercept::Syscall_intercept
        dl
        mercury
        hermes
        fmt::fmt
        Boost::boost # needed for tokenizer header
        Threads::Threads
        Date::TZ
    )

    target_include_directories(gkfwd_intercept
        PRIVATE
        ${ABT_INCLUDE_DIRS}
        ${MARGO_INCLUDE_DIRS}
        )

    install(TARGETS gkfwd_intercept
        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
        PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gkfs
    )
endif()
 No newline at end of file
Loading