Commit befb9a82 authored by Marc Vef's avatar Marc Vef
Browse files

ifs: first cut on fuse module

parent 4b6cd70a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS 0)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

# required packages
# Rocksdb dependencies
find_package(LZ4 REQUIRED)
find_package(ZLIB REQUIRED)
@@ -38,6 +39,8 @@ include_directories(include ${ROCKSDB_INCLUDE_DIR}
        )

include_directories(include)
add_subdirectory(src/preload)
#add_subdirectory(src/fuse3)

set(SOURCE_FILES main.cpp main.hpp configure.hpp util.cpp
        src/db/db_util.cpp src/classes/fs_data.cpp src/classes/rpc_data.cpp
@@ -48,7 +51,6 @@ set(SOURCE_FILES main.cpp main.hpp configure.hpp util.cpp

        include/rpc/rpc_defs.hpp include/rpc/rpc_types.hpp


        src/daemon/fs_operations.cpp src/daemon/fs_operations.cpp include/daemon/fs_operations.hpp src/adafs_ops/metadentry.cpp
        include/adafs_ops/metadentry.hpp src/db/db_ops.cpp src/db/db_ops.cpp include/db/db_ops.hpp
        src/rpc/handler/h_metadentry.cpp src/rpc/sender/c_metadentry.cpp include/rpc/sender/c_metadentry.hpp
@@ -61,5 +63,3 @@ target_link_libraries(adafs_daemon ${ROCKSDB_LIBRARIES}
        # margo libs
        ${BMI_LIBRARIES} ${MERCURY_LIBRARIES} ${MERCURY_UTIL_LIBRARIES} ${ABT_LIBRARIES} ${ABT_SNOOZER_LIBRARIES} ${MARGO_LIBRARIES}
        -lpthread -lboost_system -lboost_filesystem -lboost_serialization -lboost_program_options -pg)
 No newline at end of file

add_subdirectory(src/preload)
 No newline at end of file
+22 −0
Original line number Diff line number Diff line
//
// Created by evie on 9/19/17.
//

#ifndef IFS_FUSE_UTIL_HPP
#define IFS_FUSE_UTIL_HPP

#include <fuse3/fuse_main.hpp>

namespace Util {
    int init_inode_no();

    fuse_ino_t generate_inode_no();

    int read_inode_cnt();

    int write_inode_cnt();

    std::string get_my_hostname();
}

#endif //IFS_FUSE_UTIL_HPP
+11 −1
Original line number Diff line number Diff line
@@ -14,6 +14,16 @@ void shutdown_handler(int dummy) {
    shutdown_please = true;
}

/**
 * Returns the machine's hostname
 * @return
 */
string get_my_hostname() {
    char hostname[1024];
    auto ret = gethostname(hostname, 1024);
    return ret == 0 ? string(hostname) : ""s;
}

int main(int argc, const char* argv[]) {


@@ -64,7 +74,7 @@ int main(int argc, const char* argv[]) {
        std::map<uint64_t, std::string> hostmap;
        uint64_t i = 0;
        auto found_hostname = false;
        auto hostname = Util::get_my_hostname();
        auto hostname = get_my_hostname();
        if (hostname.size() == 0) {
            cerr << "Unable to read the machine's hostname" << endl;
            assert(hostname.size() != 0);
+0 −14
Original line number Diff line number Diff line
@@ -32,8 +32,6 @@
extern "C" {
#include <abt.h>
#include <abt-snoozer.h>
//#include <abt-io.h>
//#include <mercury.h>
#include <mercury_types.h>
#include <mercury_proc_string.h>
#include <margo.h>
@@ -49,16 +47,4 @@ namespace bfs = boost::filesystem;
#define ADAFS_DATA (static_cast<FsData*>(FsData::getInstance()))
#define RPC_DATA (static_cast<RPCData*>(RPCData::getInstance()))

namespace Util {
    int init_inode_no();

    uint64_t generate_inode_no();

    int read_inode_cnt();

    int write_inode_cnt();

    std::string get_my_hostname();
}

#endif //IFS_MAIN_HPP
+7 −1
Original line number Diff line number Diff line
@@ -10,6 +10,12 @@ using namespace std;

static const std::string dentry_val_delim = ","s;

ino_t generate_inode_no() {
    std::lock_guard<std::mutex> inode_lock(ADAFS_DATA->inode_mutex);
    // TODO check that our inode counter is within boundaries of inode numbers in the given node
    return ADAFS_DATA->raise_inode_count(1);
}

/**
 * Creates a file system node of any type (such as file or directory)
 * @param path
@@ -58,7 +64,7 @@ int create_metadentry(const std::string& path, mode_t mode) {
        val += dentry_val_delim + fmt::FormatInt(getgid()).str();
    }
    if (ADAFS_DATA->inode_no_state()) {
        val += dentry_val_delim + fmt::FormatInt(Util::generate_inode_no()).str();
        val += dentry_val_delim + fmt::FormatInt(generate_inode_no()).str();
    }
    if (ADAFS_DATA->link_cnt_state()) {
        val += dentry_val_delim + "1"s;
Loading