Verified Commit 43fefe3f authored by Tommaso Tocci's avatar Tommaso Tocci
Browse files

Merge branch 'lib_initialization' into dev

parents 4b2d88a1 cfda3081
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
#ifndef IFS_ADAFS_FUNCTIONS_HPP
#define IFS_ADAFS_FUNCTIONS_HPP

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

/*
+0 −3
Original line number Diff line number Diff line
@@ -5,9 +5,6 @@
#ifndef IFS_PASSTHROUGH_HPP
#define IFS_PASSTHROUGH_HPP

#include <preload/preload.hpp>
#include <iostream>

// function pointer for preloading
extern void* libc;

+0 −2
Original line number Diff line number Diff line
@@ -8,8 +8,6 @@

#define CTX PreloadContext::getInstance()

bool ld_is_aux_loaded();

void init_ld_env_if_needed();

void init_preload() __attribute__((constructor));
+32 −0
Original line number Diff line number Diff line
@@ -10,6 +10,31 @@ class OpenFileMap;
class Distributor;


struct FsConfig {
    // configurable metadata
    bool atime_state;
    bool mtime_state;
    bool ctime_state;
    bool uid_state;
    bool gid_state;
    bool inode_no_state;
    bool link_cnt_state;
    bool blocks_state;

    uid_t uid;
    gid_t gid;

    std::string rootdir;

    // rpc infos
    std::map<uint64_t, std::string> hosts;
    std::map<std::string, std::string> sys_hostfile;
    uint64_t host_id; // my host number
    size_t host_size;
    std::string rpc_port;
};


class PreloadContext {
    private:
    PreloadContext();
@@ -17,7 +42,10 @@ class PreloadContext {
    std::shared_ptr<spdlog::logger> log_;
    std::shared_ptr<OpenFileMap> ofm_;
    std::shared_ptr<Distributor> distributor_;
    std::shared_ptr<FsConfig> fs_conf_;

    std::string mountdir_;
    bool initialized_;

    public:
    static PreloadContext* getInstance() {
@@ -40,6 +68,10 @@ class PreloadContext {

    void distributor(std::shared_ptr<Distributor> distributor);
    std::shared_ptr<Distributor> distributor() const;
    const std::shared_ptr<FsConfig>& fs_conf() const;

    void initialized(const bool& flag);
    bool initialized() const;
};


+0 −27
Original line number Diff line number Diff line
@@ -11,31 +11,6 @@ extern "C" {
#include <margo.h>
}

// TODO singleton this stuff away
// The contents of FsConfig or only set once when set up
struct FsConfig {
    // configurable metadata
    bool atime_state;
    bool mtime_state;
    bool ctime_state;
    bool uid_state;
    bool gid_state;
    bool inode_no_state;
    bool link_cnt_state;
    bool blocks_state;

    uid_t uid;
    gid_t gid;

    std::string rootdir;

    // rpc infos
    std::map<uint64_t, std::string> hosts;
    std::map<std::string, std::string> sys_hostfile;
    uint64_t host_id; // my host number
    size_t host_size;
    std::string rpc_port;
};
// Used to bundle metadata into one place
struct Metadentry {
    time_t atime;
@@ -95,8 +70,6 @@ extern hg_id_t rpc_update_metadentry_size_id;
extern hg_id_t rpc_write_data_id;
extern hg_id_t rpc_read_data_id;
extern hg_id_t rpc_get_dirents_id;
// fs_config is set ONCE in the beginning. It shall not be modified afterwards
extern std::shared_ptr<struct FsConfig> fs_config;
// 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
Loading