Commit 7f9f234b authored by Marc Vef's avatar Marc Vef Committed by Marc Vef
Browse files

lseek() finalized, added get_metadentry rpc, stat error handling

parent 1945731b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -9,13 +9,13 @@
// To enabled logging for daemon
#define LOG_INFO
//#define LOG_DEBUG
//#define LOG_TRACE
#define LOG_TRACE
#define LOG_DAEMON_PATH "/tmp/adafs_daemon.log"

// Enable logging for preload
#define LOG_PRELOAD_INFO
//#define LOG_PRELOAD_DEBUG
//#define LOG_PRELOAD_TRACE
#define LOG_PRELOAD_TRACE
#define LOG_PRELOAD_PATH "/tmp/adafs_preload.log"

// Set a hostname suffix when a connection is built. E.g., "-ib" to use Infiniband
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@ int remove_metadentry(const std::string& path);

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

int get_metadentry_size(const std::string& path, size_t& ret_size);

int update_metadentry_size(const std::string& path, size_t io_size, off_t offset, bool append, size_t& read_size);

int update_metadentry(const std::string& path, Metadata& md);
+1 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ namespace hg_tag {
    constexpr auto stat = "rpc_srv_stat";
    constexpr auto remove = "rpc_srv_rm_node";
    constexpr auto update_metadentry = "rpc_srv_update_metadentry";
    constexpr auto get_metadentry_size = "rpc_srv_get_metadentry_size";
    constexpr auto update_metadentry_size = "rpc_srv_update_metadentry_size";
    constexpr auto write_data = "rpc_srv_write_data";
    constexpr auto read_data = "rpc_srv_read_data";
+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@ int adafs_stat(const std::string& path, struct stat* buf);

int adafs_stat64(const std::string& path, struct stat64* buf);

off_t adafs_lseek(int fd, off_t offset, int whence);

ssize_t adafs_pread_ws(int fd, void* buf, size_t count, off_t offset);

ssize_t adafs_pwrite_ws(int fd, const void* buf, size_t count, off_t offset);
+22 −0
Original line number Diff line number Diff line
@@ -12,8 +12,30 @@ private:
    bool append_flag_;

    int fd_;
    // XXX add mutex for pos. If dup is used excessively pos_ may be updated concurrently. The mutex is implemented in pos setter
    off_t pos_;
    FILE* tmp_file_;
    /*
XXX
shared:
- path
- flags
- pos

unique:
- sys fd (throw out. is already part as the key in the filemap)
- tmp_file


- int fd points to same shared ptr in file map
- fd attribute is not used -> throw out
- put tmp_file into another map<int(fd), FILE*>
- Add mutex for pos_
- Let's also properly add all flags from open in there into an enum or similar



     */

public:
    OpenFile(const std::string& path, bool append_flag);
Loading