Commit 646579e8 authored by Marc Vef's avatar Marc Vef
Browse files

Moar preload intercept functions

parent 725f3fe2
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -40,10 +40,13 @@ include_directories(include ${ROCKSDB_INCLUDE_DIR}
include_directories(include)

set(SOURCE_FILES main.cpp main.hpp configure.hpp
        src/db/db_util.cpp src/classes/fs_data.cpp
        src/db/db_util.cpp src/classes/fs_data.cpp src/classes/rpc_data.cpp

        include/db/db_util.hpp include/classes/fs_data.hpp
        src/daemon/adafs_daemon.cpp include/daemon/adafs_daemon.hpp)
        include/db/db_util.hpp include/classes/fs_data.hpp include/classes/rpc_data.hpp
        src/daemon/adafs_daemon.cpp include/daemon/adafs_daemon.hpp


        )
add_executable(adafs_daemon ${SOURCE_FILES})
target_link_libraries(adafs_daemon ${ROCKSDB_LIBRARIES}
        # rocksdb libs
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ public:

    size_t get_rpc_node(std::string to_hash);

    std::string get_dentry_hashable(const fuse_ino_t parent, const char* name);
//    std::string get_dentry_hashable(const fuse_ino_t parent, const char* name);

    // Getter/Setter

+49 −8
Original line number Diff line number Diff line
@@ -14,27 +14,68 @@

//
void* libc;

void* libc_open;
//void* libc_open64; //unused
void* libc_fopen;

//void* libc_creat; //unused

void* libc_close;
void* libc___close;
//void* libc___close; //unused

void* libc_stat;
void* libc_fstat;

void* libc_puts;

void* libc_write;
void* libc_read;
void* libc_open;
void* libc_fopen;
//void* libc_fclose;
void* libc_pread;
void* libc_pread64;

void* libc_lseek;
//void* libc_lseek64; //unused

void* libc_truncate;
void* libc_ftruncate;

void* libc_dup;
void* libc_dup2;


static OpenFileMap file_map{};

#define ld_puts puts
#define ld_write write
#define ld_read read
#define ld_open open
#define ld_open64 open64
#define ld_fopen fopen
//#define ld_fclose fclose

#define ld_creat creat

#define ld_close close
#define ld___close __close

#define ld_stat stat
#define ld_fstat fstat

#define ld_puts puts

#define ld_write write
#define ld_read read
#define ld_pread pread
#define ld_pread64 pread64

#define ld_lseek lseek
#define ld_lseek64 lseek64

#define ld_truncate truncate
#define ld_ftruncate ftruncate

#define ld_dup dup
#define ld_dup2 dup2



void init_preload(void) __attribute__((constructor));

void destroy_preload(void) __attribute__((destructor));
+1 −0
Original line number Diff line number Diff line
@@ -44,5 +44,6 @@ extern "C" {
namespace bfs = boost::filesystem;

#define ADAFS_DATA (static_cast<FsData*>(FsData::getInstance()))
#define RPC_DATA (static_cast<RPCData*>(RPCData::getInstance()))

#endif //IFS_MAIN_HPP
+3 −3
Original line number Diff line number Diff line
@@ -38,9 +38,9 @@ size_t RPCData::get_rpc_node(std::string to_hash) {
    return ADAFS_DATA->hashf()(to_hash) % ADAFS_DATA->host_size();
}

std::string RPCData::get_dentry_hashable(const fuse_ino_t parent, const char* name) {
    return fmt::FormatInt(parent).str() + "_" + name;
}
//std::string RPCData::get_dentry_hashable(const fuse_ino_t parent, const char* name) {
//    return fmt::FormatInt(parent).str() + "_" + name;
//}

// Getter/Setter

Loading