Verified Commit 33fe1e88 authored by Tommaso Tocci's avatar Tommaso Tocci
Browse files

preload library use global Metadata class

parent 66b685e0
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -10,8 +10,6 @@ int create_node(const std::string& path, const uid_t uid, const gid_t gid, mode_

void create_metadentry(const std::string& path, mode_t mode);

int db_val_to_stat(const std::string& path, std::string db_val, struct stat& attr);

std::string get_metadentry_str(const std::string& path);

Metadata get_metadentry(const std::string& path);
+2 −16
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
#define IFS_PRELOAD_UTIL_HPP

#include <preload/preload.hpp>
#include <global/metadata.hpp>
// third party libs
#include <string>
#include <iostream>
@@ -11,21 +12,6 @@ extern "C" {
#include <margo.h>
}

// Used to bundle metadata into one place
struct Metadentry {
    time_t atime;
    time_t mtime;
    time_t ctime;
    uid_t uid;
    gid_t gid;
    mode_t mode;
    uint64_t inode_no;
    nlink_t link_count;
    off_t size;
    blkcnt_t blocks;

    std::string path;
};
struct MetadentryUpdateFlags {
    bool atime = false;
    bool mtime = false;
@@ -62,7 +48,7 @@ extern hg_id_t rpc_get_dirents_id;

bool is_fs_path(const char* path);

int db_val_to_stat(const std::string& path, std::string db_val, struct stat& attr);
int metadata_to_stat(const std::string& path, const Metadata& md, struct stat& attr);

int get_daemon_pid();

+2 −1
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include <preload/preload_util.hpp>
#include <global/rpc/rpc_types.hpp>
#include <preload/open_dir.hpp>
#include <global/metadata.hpp>
#include <iostream>

inline hg_return_t margo_forward_timed_wrap_timer(hg_handle_t& handle, void* in_struct, const char* func);
@@ -24,7 +25,7 @@ int rpc_send_rm_node(const std::string& path, const bool remove_metadentry_only)

int rpc_send_decr_size(const std::string& path, size_t length);

int rpc_send_update_metadentry(const std::string& path, const Metadentry& md, const MetadentryUpdateFlags& md_flags);
int rpc_send_update_metadentry(const std::string& path, const Metadata& md, const MetadentryUpdateFlags& md_flags);

int rpc_send_update_metadentry_size(const std::string& path, size_t size, off64_t offset, bool append_flag,
                                    off64_t& ret_size);
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ add_library(adafs_preload_client SHARED ${PRELOAD_SRC} ${PRELOAD_HEADERS})

target_link_libraries(adafs_preload_client
    # internal
    metadata
    distributor
    log_util
    # external
+6 −3
Original line number Diff line number Diff line
@@ -148,10 +148,13 @@ int adafs_access(const std::string& path, const int mask) {

int adafs_stat(const string& path, struct stat* buf) {
    init_ld_env_if_needed();
    string attr = ""s;
    std::string attr;
    auto err = rpc_send_stat(path, attr);
    if (err == 0)
        db_val_to_stat(path, attr, *buf);
    if (err) {
        return err;
    }
    Metadata md(attr);
    metadata_to_stat(path, md, *buf);
    return err;
}

Loading