Commit 484a8dfa authored by Marc Vef's avatar Marc Vef
Browse files

Merge branch 'relative_path' into 'master'



Use relative paths

See merge request zdvresearch_bsc/adafs!58

Signed-off-by: default avatarMarc Vef <vef@uni-mainz.de>
parents 00b7d31c 8a5d3de0
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
#ifndef IFS_PATH_UTIL_HPP
#define IFS_PATH_UTIL_HPP

#include <string>

bool is_relative_path(const std::string& path);
bool is_absolute_path(const std::string& path);
bool has_trailing_slash(const std::string& path);

std::string path_to_relative(const std::string& root_path, const std::string& complete_path);

#endif //IFS_PATH_UTIL_HPP
+3 −0
Original line number Diff line number Diff line
@@ -23,9 +23,12 @@ extern "C" {
}

#include <preload/preload_util.hpp>
#include <preload/preload_context.hpp>

#define EUNKNOWN (-1)

#define CTX PreloadContext::getInstance()

bool ld_is_aux_loaded();

void init_ld_env_if_needed();
+36 −0
Original line number Diff line number Diff line
#ifndef IFS_PRELOAD_CTX_HPP
#define IFS_PRELOAD_CTX_HPP

#include <extern/spdlog/spdlog.h>
#include <memory>
#include <string>


class PreloadContext {
    private:
    PreloadContext() = default;

    std::shared_ptr<spdlog::logger> log_;
    std::string mountdir_;

    public:
    static PreloadContext* getInstance() {
        static PreloadContext instance;
        return &instance;
    }

    PreloadContext(PreloadContext const&) = delete;
    void operator=(PreloadContext const&) = delete;

    void log(std::shared_ptr<spdlog::logger> logger);
    std::shared_ptr<spdlog::logger> log() const;

    void mountdir(const std::string& path);
    std::string mountdir() const;

    bool relativize_path(std::string& path) const;
};


#endif //IFS_PRELOAD_CTX_HPP
+0 −4
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@
#include <preload/preload.hpp>
#include <preload/open_file_map.hpp>
// third party libs
#include <extern/spdlog/spdlog.h>
#include <string>

// TODO singleton this stuff away
@@ -24,7 +23,6 @@ struct FsConfig {
    uid_t uid;
    gid_t gid;

    std::string mountdir;
    std::string rootdir;

    // rpc infos
@@ -95,8 +93,6 @@ extern hg_id_t rpc_write_data_id;
extern hg_id_t rpc_read_data_id;
// fs_config is set ONCE in the beginning. It shall not be modified afterwards
extern std::shared_ptr<struct FsConfig> fs_config;
// global logger instance
extern std::shared_ptr<spdlog::logger> ld_logger;
// rpc addresses. Populated when environment is initialized. After that it is read-only accessed
extern std::map<uint64_t, hg_addr_t> rpc_addresses;
// file descriptor index validation flag
+2 −0
Original line number Diff line number Diff line
set(DAEMON_SRC
    ../global/rpc/rpc_utils.cpp
    ../global/global_func.cpp
    ../global/path_util.cpp
    adafs_daemon.cpp
    adafs_ops/data.cpp
    adafs_ops/metadentry.cpp
@@ -22,6 +23,7 @@ set(DAEMON_HEADERS
    ../../include/global/rpc/ipc_types.hpp
    ../../include/global/rpc/rpc_types.hpp
    ../../include/global/rpc/rpc_utils.hpp
    ../../include/global/path_util.hpp
    ../../include/daemon/adafs_daemon.hpp
    ../../include/daemon/adafs_ops/data.hpp
    ../../include/daemon/adafs_ops/metadentry.hpp
Loading