Commit b2f86352 authored by Julius Athenstaedt's avatar Julius Athenstaedt Committed by Ramon Nou
Browse files

root inode in separate variable

parent 6a74f9fd
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@

static struct fuse_lowlevel_ops ll_ops;
static std::mutex ino_mutex;
static Inode root_inode;
static std::unordered_map<fuse_ino_t, Inode> ino_map;
static std::unordered_map<std::string, fuse_ino_t> path_map;
static std::unordered_map<std::string, struct stat> local_fifos;
@@ -76,10 +77,10 @@ alloc_inode(const std::string& path) {
static Inode*
get_inode(fuse_ino_t ino) {
    std::lock_guard<std::mutex> lk(ino_mutex);
    if(gkfs::config::fuse::pointertrick) {
    if(ino == FUSE_ROOT_ID) {
            return &ino_map[FUSE_ROOT_ID];
        return &root_inode;
    }
    if(gkfs::config::fuse::pointertrick) {
        return (Inode*) ino;
    } else {
        auto it = ino_map.find(ino);
@@ -933,7 +934,8 @@ init_gekkofs() {
        fuse_log(FUSE_LOG_ERR, "failed to open root\n");
        exit(1);
    }
    ino_map[FUSE_ROOT_ID] = {root_path, 1};
    root_inode = {root_path, 1};
    ino_map[FUSE_ROOT_ID] = root_inode;
    path_map[root_path] = FUSE_ROOT_ID;
    std::cout << "root node allocated" << std::endl;
}