Loading src/client/fuse/fuse_client.cpp +17 −5 Original line number Diff line number Diff line Loading @@ -66,6 +66,15 @@ udata(fuse_req_t req) { return (struct u_data*) fuse_req_userdata(req); } static std::string get_path(const Inode* inode, const char* name) { if(inode->path == "/") { return inode->path + name; } else { return inode->path + "/" + name; } } static const struct fuse_opt lo_opts[] = { {"writeback", offsetof(struct u_data, writeback), 1}, {"no_writeback", offsetof(struct u_data, writeback), 0}, Loading Loading @@ -135,7 +144,9 @@ lookup_handler(fuse_req_t req, fuse_ino_t parent, const char* name) { fuse_reply_err(req, ENOENT); return; } std::string child = parent_inode->path + name; std::string child = get_path(parent_inode, name); fuse_log(FUSE_LOG_DEBUG, "lookup parent %s name %s\n", parent_inode->path.c_str(), name); fuse_log(FUSE_LOG_DEBUG, "lookup %s\n", child.c_str()); Loading Loading @@ -299,7 +310,7 @@ create_handler(fuse_req_t req, fuse_ino_t parent, const char* name, mode_t mode, fuse_reply_err(req, ENOENT); return; } std::string path = parent_inode->path + name; std::string path = get_path(parent_inode, name); int rc = gkfs::syscall::gkfs_create(path, mode); if(rc == -1) { fuse_log(FUSE_LOG_DEBUG, "here here mode %i flags %i \n", mode, Loading Loading @@ -507,7 +518,9 @@ mkdir_handler(fuse_req_t req, fuse_ino_t parent, const char* name, fuse_reply_err(req, ENOENT); return; } std::string path = parent_inode->path + name; std::string path = get_path(parent_inode, name); fuse_log(FUSE_LOG_DEBUG, "mkdir parent %s name %s\n", parent_inode->path.c_str(), name); int rc = gkfs::syscall::gkfs_create(path, mode | S_IFDIR); if(rc == -1) { fuse_reply_err(req, 1); Loading @@ -529,8 +542,6 @@ mkdir_handler(fuse_req_t req, fuse_ino_t parent, const char* name, e.attr_timeout = ud->timeout; e.entry_timeout = ud->timeout; fuse_reply_entry(req, &e); fuse_log(FUSE_LOG_DEBUG, "flush success \n"); fuse_reply_err(req, 0); } static void Loading @@ -557,6 +568,7 @@ init_gekkofs() { } ino_map[FUSE_ROOT_ID] = {root_path, {}, 1}; ino_map[FUSE_ROOT_ID].st = st; path_map[root_path] = FUSE_ROOT_ID; std::cout << "root node allocated" << std::endl; } Loading tests/integration/fuse/test_basic_operations.py +6 −0 Original line number Diff line number Diff line Loading @@ -55,3 +55,9 @@ def test_read(gkfs_daemon, fuse_client): sh.truncate("-s", "20", str(file2)) assert sh.wc("-c", str(file2)) == "20 " + str(file2) + "\n" sh.mkdir(str(dir)) assert sh.ls(fuse_client.mountdir) == "dir file file2\n" sh.cd(str(dir)) assert sh.pwd() == str(dir) + "\n" sh.mkdir("-p", "fu/bar") assert sh.ls() == "fu\n" sh.cd("fu") Loading
src/client/fuse/fuse_client.cpp +17 −5 Original line number Diff line number Diff line Loading @@ -66,6 +66,15 @@ udata(fuse_req_t req) { return (struct u_data*) fuse_req_userdata(req); } static std::string get_path(const Inode* inode, const char* name) { if(inode->path == "/") { return inode->path + name; } else { return inode->path + "/" + name; } } static const struct fuse_opt lo_opts[] = { {"writeback", offsetof(struct u_data, writeback), 1}, {"no_writeback", offsetof(struct u_data, writeback), 0}, Loading Loading @@ -135,7 +144,9 @@ lookup_handler(fuse_req_t req, fuse_ino_t parent, const char* name) { fuse_reply_err(req, ENOENT); return; } std::string child = parent_inode->path + name; std::string child = get_path(parent_inode, name); fuse_log(FUSE_LOG_DEBUG, "lookup parent %s name %s\n", parent_inode->path.c_str(), name); fuse_log(FUSE_LOG_DEBUG, "lookup %s\n", child.c_str()); Loading Loading @@ -299,7 +310,7 @@ create_handler(fuse_req_t req, fuse_ino_t parent, const char* name, mode_t mode, fuse_reply_err(req, ENOENT); return; } std::string path = parent_inode->path + name; std::string path = get_path(parent_inode, name); int rc = gkfs::syscall::gkfs_create(path, mode); if(rc == -1) { fuse_log(FUSE_LOG_DEBUG, "here here mode %i flags %i \n", mode, Loading Loading @@ -507,7 +518,9 @@ mkdir_handler(fuse_req_t req, fuse_ino_t parent, const char* name, fuse_reply_err(req, ENOENT); return; } std::string path = parent_inode->path + name; std::string path = get_path(parent_inode, name); fuse_log(FUSE_LOG_DEBUG, "mkdir parent %s name %s\n", parent_inode->path.c_str(), name); int rc = gkfs::syscall::gkfs_create(path, mode | S_IFDIR); if(rc == -1) { fuse_reply_err(req, 1); Loading @@ -529,8 +542,6 @@ mkdir_handler(fuse_req_t req, fuse_ino_t parent, const char* name, e.attr_timeout = ud->timeout; e.entry_timeout = ud->timeout; fuse_reply_entry(req, &e); fuse_log(FUSE_LOG_DEBUG, "flush success \n"); fuse_reply_err(req, 0); } static void Loading @@ -557,6 +568,7 @@ init_gekkofs() { } ino_map[FUSE_ROOT_ID] = {root_path, {}, 1}; ino_map[FUSE_ROOT_ID].st = st; path_map[root_path] = FUSE_ROOT_ID; std::cout << "root node allocated" << std::endl; } Loading
tests/integration/fuse/test_basic_operations.py +6 −0 Original line number Diff line number Diff line Loading @@ -55,3 +55,9 @@ def test_read(gkfs_daemon, fuse_client): sh.truncate("-s", "20", str(file2)) assert sh.wc("-c", str(file2)) == "20 " + str(file2) + "\n" sh.mkdir(str(dir)) assert sh.ls(fuse_client.mountdir) == "dir file file2\n" sh.cd(str(dir)) assert sh.pwd() == str(dir) + "\n" sh.mkdir("-p", "fu/bar") assert sh.ls() == "fu\n" sh.cd("fu")