Commit 927bbd1f authored by Marc Vef's avatar Marc Vef
Browse files

ifs: Adding metadentry update functionality (WIP) + minors

parent c29c7df6
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -20,6 +20,17 @@
#define ACMtime //unused
#define BLOCKSIZE 4 // in kilobytes

// What metadata is used TODO this has to be parametrized or put into a configuration file
#define MDATA_USE_ATIME false
#define MDATA_USE_MTIME false
#define MDATA_USE_CTIME false
#define MDATA_USE_UID false
#define MDATA_USE_GID false
#define MDATA_USE_INODE_NO false
#define MDATA_USE_LINK_CNT false
#define MDATA_USE_BLOCKS false
#define MDATA_USE_SIZE true // XXX to be added in ADAFS_DATA. currently on by default

// If access permissions should be checked while opening a file
//#define CHECK_ACCESS //unused

+2 −0
Original line number Diff line number Diff line
@@ -19,4 +19,6 @@ int remove_metadentry(const std::string& path);

int remove_node(const std::string& path);

int update_metadentry_size(const std::string& path, size_t size);

#endif //IFS_METADENTRY_HPP
+9 −3
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@

#include "../../main.hpp"


class Metadata {

private:
@@ -19,18 +18,21 @@ private:
    off_t size_;               // size_ in bytes, might be computed instead of stored
    blkcnt_t blocks_;          // allocated file system blocks_

    std::string path_;

public:
    Metadata();

    Metadata(mode_t mode, uint32_t uid, uint32_t gid);
    Metadata(const std::string& path, const mode_t mode);

    Metadata(mode_t mode, uid_t uid, gid_t gid, uint64_t inode);
    Metadata(const std::string& path, std::string db_val);

    void init_ACM_time();

    void update_ACM_time(bool a, bool c, bool m);

    std::string to_KVentry();

    //Getter and Setter
    time_t atime() const;

@@ -72,6 +74,10 @@ public:

    void blocks(blkcnt_t blocks_);

    const std::string& path() const;

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

};


+2 −0
Original line number Diff line number Diff line
@@ -17,4 +17,6 @@ bool db_metadentry_exists(const std::string& key);

bool db_is_dir_entry(const std::string& dir_path);

bool db_update_metadentry(const std::string& old_key, const std::string& new_key, const std::string& val);

#endif //IFS_DB_OPS_HPP
+14 −2
Original line number Diff line number Diff line
@@ -39,11 +39,23 @@ MERCURY_GEN_PROC(ipc_stat_out_t, ((hg_int32_t) (err))

MERCURY_GEN_PROC(ipc_unlink_in_t, ((hg_const_string_t) (path)))

MERCURY_GEN_PROC(ipc_update_metadentry_in_t,
                 ((hg_const_string_t) (path))\
((uint64_t) (nlink))\
((hg_uint32_t) (mode))\
((hg_uint32_t) (uid))\
((hg_uint32_t) (gid))\
((hg_int64_t) (size))\
((hg_int64_t) (blocks))\
((hg_int64_t) (atime))\
((hg_int64_t) (mtime))\
((hg_int64_t) (ctime)))

// data
MERCURY_GEN_PROC(ipc_read_data_in_t,
                 ((hg_const_string_t) (path))\
((hg_size_t) (size))\
((int64_t) (offset))\
((hg_int64_t) (offset))\
((hg_bulk_t) (bulk_handle)))

MERCURY_GEN_PROC(ipc_data_out_t,
@@ -53,7 +65,7 @@ MERCURY_GEN_PROC(ipc_data_out_t,
MERCURY_GEN_PROC(ipc_write_data_in_t,
                 ((hg_const_string_t) (path))\
((hg_size_t) (size))\
((int64_t) (offset))\
((hg_int64_t) (offset))\
((hg_bool_t) (append))\
((hg_bulk_t) (bulk_handle)))

Loading