Loading ifs/include/preload/adafs_functions.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -57,4 +57,6 @@ int adafs_opendir(const std::string& path); struct dirent * adafs_readdir(int fd); int adafs_rmdir(const std::string& path); #endif //IFS_ADAFS_FUNCTIONS_HPP ifs/include/preload/open_dir.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ class OpenDir: public OpenFile { OpenDir(const std::string& path); void add(const std::string& name, const FileType& type); struct dirent * readdir(); size_t size(); }; Loading ifs/src/preload/adafs_functions.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -230,6 +230,23 @@ int adafs_opendir(const std::string& path) { return CTX->file_map()->add(open_dir); } int adafs_rmdir(const std::string& path) { init_ld_env_if_needed(); #if defined(DO_LOOKUP) auto err = rpc_send_access(path, F_OK); if(err != 0){ return err; } #endif auto open_dir = std::make_shared<OpenDir>(path); rpc_send_get_dirents(*open_dir); if(open_dir->size() != 0){ errno = ENOTEMPTY; return -1; } return rpc_send_rm_node(path, true); } struct dirent * adafs_readdir(int fd){ init_ld_env_if_needed(); CTX->log()->trace("{}() called on fd: {}", __func__, fd); Loading ifs/src/preload/intcp_functions.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -119,8 +119,7 @@ int rmdir(const char* path) __THROW { CTX->log()->trace("{}() called with path {}", __func__, path); std::string rel_path(path); if (CTX->relativize_path(rel_path)) { // XXX Possible need another call to specifically handle remove dirs. For now handle them the same as files return adafs_rm_node(rel_path); return adafs_rmdir(rel_path); } return (reinterpret_cast<decltype(&rmdir)>(libc_rmdir))(path); } Loading ifs/src/preload/open_dir.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -50,3 +50,7 @@ struct dirent * OpenDir::readdir(){ is_dirent_valid = true; return &dirent_; } size_t OpenDir::size(){ return entries.size(); } Loading
ifs/include/preload/adafs_functions.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -57,4 +57,6 @@ int adafs_opendir(const std::string& path); struct dirent * adafs_readdir(int fd); int adafs_rmdir(const std::string& path); #endif //IFS_ADAFS_FUNCTIONS_HPP
ifs/include/preload/open_dir.hpp +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ class OpenDir: public OpenFile { OpenDir(const std::string& path); void add(const std::string& name, const FileType& type); struct dirent * readdir(); size_t size(); }; Loading
ifs/src/preload/adafs_functions.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -230,6 +230,23 @@ int adafs_opendir(const std::string& path) { return CTX->file_map()->add(open_dir); } int adafs_rmdir(const std::string& path) { init_ld_env_if_needed(); #if defined(DO_LOOKUP) auto err = rpc_send_access(path, F_OK); if(err != 0){ return err; } #endif auto open_dir = std::make_shared<OpenDir>(path); rpc_send_get_dirents(*open_dir); if(open_dir->size() != 0){ errno = ENOTEMPTY; return -1; } return rpc_send_rm_node(path, true); } struct dirent * adafs_readdir(int fd){ init_ld_env_if_needed(); CTX->log()->trace("{}() called on fd: {}", __func__, fd); Loading
ifs/src/preload/intcp_functions.cpp +1 −2 Original line number Diff line number Diff line Loading @@ -119,8 +119,7 @@ int rmdir(const char* path) __THROW { CTX->log()->trace("{}() called with path {}", __func__, path); std::string rel_path(path); if (CTX->relativize_path(rel_path)) { // XXX Possible need another call to specifically handle remove dirs. For now handle them the same as files return adafs_rm_node(rel_path); return adafs_rmdir(rel_path); } return (reinterpret_cast<decltype(&rmdir)>(libc_rmdir))(path); } Loading
ifs/src/preload/open_dir.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -50,3 +50,7 @@ struct dirent * OpenDir::readdir(){ is_dirent_valid = true; return &dirent_; } size_t OpenDir::size(){ return entries.size(); }