Loading src/client/fuse/fuse_client.cpp +15 −12 Original line number Diff line number Diff line Loading @@ -333,7 +333,6 @@ write_handler(fuse_req_t req, fuse_ino_t ino, const char* buf, size_t size, static void create_handler(fuse_req_t req, fuse_ino_t parent, const char* name, mode_t mode, struct fuse_file_info* fi) { fuse_log(FUSE_LOG_DEBUG, "create handler \n"); auto* ud = udata(req); auto* parent_inode = get_inode(parent); if(!parent_inode) { Loading @@ -341,17 +340,11 @@ create_handler(fuse_req_t req, fuse_ino_t parent, const char* name, mode_t mode, return; } std::string path = get_path(parent_inode, name); int rc = gkfs::syscall::gkfs_create(path, mode); int errno_bu = errno; if(rc == -1) { fuse_log(FUSE_LOG_DEBUG, "create failed, here here mode %i flags %i errno %i\n", mode, fi->flags, errno); } int fd = gkfs::syscall::gkfs_open(path, mode, fi->flags); fuse_log(FUSE_LOG_DEBUG, "create handler %s\n", path.c_str()); int fd = gkfs::syscall::gkfs_open(path, mode, fi->flags | O_CREAT); if(fd < 0) { fuse_log(FUSE_LOG_DEBUG, "create -> open failed errno\n", errno); fuse_reply_err(req, rc < 0 ? errno_bu : ENOENT); fuse_log(FUSE_LOG_DEBUG, "create -> open failed errno %i\n", errno); fuse_reply_err(req, errno); return; } fi->fh = fd; Loading @@ -359,7 +352,6 @@ create_handler(fuse_req_t req, fuse_ino_t parent, const char* name, mode_t mode, struct stat st; int sc = gkfs::syscall::gkfs_stat(path, &st); if(sc == -1) { fuse_log(FUSE_LOG_DEBUG, "thats why its not allowed \n"); fuse_reply_err(req, ENOENT); return; } Loading Loading @@ -399,6 +391,11 @@ unlink_handler(fuse_req_t req, fuse_ino_t parent, const char* name) { } int rc = gkfs::syscall::gkfs_remove(path); auto it_src = path_map.find(path); if(it_src != path_map.end()) { path_map.erase(it_src); ino_map.erase(it_src->second); } if(rc == -1) { fuse_reply_err(req, 1); return; Loading Loading @@ -690,11 +687,17 @@ rmdir_handler(fuse_req_t req, fuse_ino_t parent, const char* name) { return; } std::string path = get_path(parent_inode, name); fuse_log(FUSE_LOG_DEBUG, "rmdir %s\n", path.c_str()); int rc = gkfs::syscall::gkfs_rmdir(path); if(rc == -1) { fuse_reply_err(req, errno); return; } auto it_src = path_map.find(path); if(it_src != path_map.end()) { path_map.erase(it_src); ino_map.erase(it_src->second); } fuse_reply_err(req, 0); } Loading Loading
src/client/fuse/fuse_client.cpp +15 −12 Original line number Diff line number Diff line Loading @@ -333,7 +333,6 @@ write_handler(fuse_req_t req, fuse_ino_t ino, const char* buf, size_t size, static void create_handler(fuse_req_t req, fuse_ino_t parent, const char* name, mode_t mode, struct fuse_file_info* fi) { fuse_log(FUSE_LOG_DEBUG, "create handler \n"); auto* ud = udata(req); auto* parent_inode = get_inode(parent); if(!parent_inode) { Loading @@ -341,17 +340,11 @@ create_handler(fuse_req_t req, fuse_ino_t parent, const char* name, mode_t mode, return; } std::string path = get_path(parent_inode, name); int rc = gkfs::syscall::gkfs_create(path, mode); int errno_bu = errno; if(rc == -1) { fuse_log(FUSE_LOG_DEBUG, "create failed, here here mode %i flags %i errno %i\n", mode, fi->flags, errno); } int fd = gkfs::syscall::gkfs_open(path, mode, fi->flags); fuse_log(FUSE_LOG_DEBUG, "create handler %s\n", path.c_str()); int fd = gkfs::syscall::gkfs_open(path, mode, fi->flags | O_CREAT); if(fd < 0) { fuse_log(FUSE_LOG_DEBUG, "create -> open failed errno\n", errno); fuse_reply_err(req, rc < 0 ? errno_bu : ENOENT); fuse_log(FUSE_LOG_DEBUG, "create -> open failed errno %i\n", errno); fuse_reply_err(req, errno); return; } fi->fh = fd; Loading @@ -359,7 +352,6 @@ create_handler(fuse_req_t req, fuse_ino_t parent, const char* name, mode_t mode, struct stat st; int sc = gkfs::syscall::gkfs_stat(path, &st); if(sc == -1) { fuse_log(FUSE_LOG_DEBUG, "thats why its not allowed \n"); fuse_reply_err(req, ENOENT); return; } Loading Loading @@ -399,6 +391,11 @@ unlink_handler(fuse_req_t req, fuse_ino_t parent, const char* name) { } int rc = gkfs::syscall::gkfs_remove(path); auto it_src = path_map.find(path); if(it_src != path_map.end()) { path_map.erase(it_src); ino_map.erase(it_src->second); } if(rc == -1) { fuse_reply_err(req, 1); return; Loading Loading @@ -690,11 +687,17 @@ rmdir_handler(fuse_req_t req, fuse_ino_t parent, const char* name) { return; } std::string path = get_path(parent_inode, name); fuse_log(FUSE_LOG_DEBUG, "rmdir %s\n", path.c_str()); int rc = gkfs::syscall::gkfs_rmdir(path); if(rc == -1) { fuse_reply_err(req, errno); return; } auto it_src = path_map.find(path); if(it_src != path_map.end()) { path_map.erase(it_src); ino_map.erase(it_src->second); } fuse_reply_err(req, 0); } Loading