Commit 583cd920 authored by Marc Vef's avatar Marc Vef
Browse files

ifs: added daemon fs operation skeleton, check if fs is used + misc

parent a64a02c3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ set(SOURCE_FILES main.cpp main.hpp configure.hpp
        src/daemon/adafs_daemon.cpp include/daemon/adafs_daemon.hpp


        )
        src/daemon/fs_operations.cpp src/daemon/fs_operations.cpp include/daemon/fs_operations.hpp)
add_executable(adafs_daemon ${SOURCE_FILES})
target_link_libraries(adafs_daemon ${ROCKSDB_LIBRARIES}
        # rocksdb libs
+27 −0
Original line number Diff line number Diff line
//
// Created by evie on 9/4/17.
//

#ifndef IFS_FS_OPERATIONS_HPP
#define IFS_FS_OPERATIONS_HPP

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

int adafs_open(char* path, int flags, mode_t mode);

FILE* adafs_fopen(char* path, const char* mode);

int adafs_close(char* path);

int adafs_stat(char* path, struct stat* buf);

int adafs_fstat(char* path, struct stat* buf);

ssize_t adafs_write(char* path, void* buf, size_t count);

ssize_t adafs_read(char* path, void* buf, size_t count);

ssize_t adafs_pread(char* path, void* buf, size_t count, off_t offset);


#endif //IFS_FS_OPERATIONS_HPP
+9 −2
Original line number Diff line number Diff line
@@ -12,9 +12,14 @@ class OpenFile {
private:
    const char* path_;
    int fd_;
    FILE* tmp_file_;

public:
    OpenFile(const char* path, const int fd);
    OpenFile(const char* path);

    ~OpenFile();

    void annul_fd();

    // getter/setter
    const char* path() const;
@@ -24,6 +29,7 @@ public:
    int fd() const;

    void fd(int fd_);

};


@@ -40,7 +46,8 @@ public:

    OpenFile* get(int fd);
    bool exist(const int fd);
    bool add(const char* path, const int fd);

    int add(const char* path);
    bool remove(const int fd);

};
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include <fcntl.h>

#include "preload/open_file_map.hpp"
#include "preload/preload_util.hpp"

//
void* libc;
+14 −0
Original line number Diff line number Diff line
//
// Created by evie on 9/4/17.
//

#ifndef IFS_PRELOAD_UTIL_HPP
#define IFS_PRELOAD_UTIL_HPP

#include <string>

static const std::string root_path = "/home/evie/ownCloud/Promotion/gogs_git/ada-fs/ifs/.hidden_playground/rootdir";

bool is_fs_path(const char* path);

#endif //IFS_PRELOAD_UTIL_HPP
Loading