Loading include/client/user_functions.hpp +4 −1 Original line number Diff line number Diff line Loading @@ -139,7 +139,10 @@ gkfs_mk_symlink(const std::string& path, const std::string& target); int gkfs_readlink(const std::string& path, char* buf, int bufsize); #endif #ifdef HAS_RENAME int gkfs_rename(const std::string& old_path, const std::string& new_path); #endif } // namespace syscall namespace malleable { Loading src/client/gkfs_libc.cpp +55 −5 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ std::atomic<bool> initializing{false}; // Define a debug macro, can be easily disabled #define GKFS_TRACE //#define PATH_SHORTCUT #define PATH_SHORTCUT #ifdef GKFS_DEBUG_BUILD #ifdef GKFS_TRACE Loading Loading @@ -295,6 +295,15 @@ DLSYM_WRAPPER(int, statx, (dirfd, path, flags, mask, buf), "statx") DLSYM_WRAPPER(int, rename, (const char* oldpath, const char* newpath), (oldpath, newpath), "rename") DLSYM_WRAPPER(int, renameat, (int olddirfd, const char* oldpath, int newdirfd, const char* newpath), (olddirfd, oldpath, newdirfd, newpath), "renameat") DLSYM_WRAPPER(int, renameat2, (int olddirfd, const char* oldpath, int newdirfd, const char* newpath, unsigned int flags), (olddirfd, oldpath, newdirfd, newpath, flags), "renameat2") DLSYM_WRAPPER(int, remove, (char* path), (path), "remove") DLSYM_WRAPPER(int, unlink, (const char* path), (path), "unlink") DLSYM_WRAPPER(DIR*, opendir, (const char* dirname), (dirname), "opendir") Loading Loading @@ -1124,6 +1133,7 @@ int rename(const char* oldpath, const char* newpath) { initializeGekko(); // Is path from GekkoFS? DEBUG_INFO("rename {} --> {}", oldpath, newpath); if(CTX->interception_enabled()) { std::string resolved_old; std::string resolved_new; Loading @@ -1137,10 +1147,9 @@ rename(const char* oldpath, const char* newpath) { case PathStatus::Internal: DEBUG_INFO("[GKFS] {} {}{}", "NOT IMPLEMENTED", resolved_old, resolved_new); return -ENOTDIR; // return // gkfs::syscall::gkfs_rename(resolved_old, // resolved_new); return gkfs::syscall::gkfs_rename(resolved_old, resolved_new); default: // Try normal open. Loading Loading @@ -2434,3 +2443,44 @@ rewinddir(DIR* dirstream) { } GKFS_FALLBACK(rewinddir, dirstream) } int renameat(int olddirfd, const char* oldpath, int newdirfd, const char* newpath) { initializeGekko(); if(CTX->interception_enabled()) { std::string resolved; if(resolve_gkfs_path(olddirfd, oldpath, resolved) == PathStatus::Internal) { DEBUG_INFO("[GKFS] {}", resolved); std::string resolved2; if(resolve_gkfs_path(newdirfd, newpath, resolved2) == PathStatus::Internal) { DEBUG_INFO("[GKFS] {}", resolved2); return gkfs::syscall::gkfs_rename(resolved, resolved2); } } } GKFS_FALLBACK(renameat, olddirfd, oldpath, newdirfd, newpath); } int renameat2(int olddirfd, const char* oldpath, int newdirfd, const char* newpath, unsigned int flags) { initializeGekko(); if(CTX->interception_enabled()) { std::string resolved; if(resolve_gkfs_path(olddirfd, oldpath, resolved) == PathStatus::Internal) { DEBUG_INFO("[GKFS] {}", resolved); std::string resolved2; if(resolve_gkfs_path(newdirfd, newpath, resolved2) == PathStatus::Internal) { DEBUG_INFO("[GKFS] {}", resolved2); return gkfs::syscall::gkfs_rename(resolved, resolved2); } } } GKFS_FALLBACK(renameat2, olddirfd, oldpath, newdirfd, newpath, flags); } No newline at end of file src/client/hooks.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -789,6 +789,10 @@ hook_getcwd(char* buf, unsigned long size) { LOG(DEBUG, "{}() called with buf: {}, size: {}", __func__, fmt::ptr(buf), size); if(CTX->cwd().size() == 0) { CTX->cwd(gkfs::path::get_sys_cwd()); } if(CTX->cwd().size() + 1 > size) { LOG(ERROR, "{}() buffer too small to host current working dir", __func__); Loading src/client/preload_context.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -85,7 +85,6 @@ PreloadContext::PreloadContext() char host[255]; gethostname(host, 255); hostname = host; cwd_ = gkfs::path::get_sys_cwd(); PreloadContext::set_replicas( std::stoi(gkfs::env::get_var(gkfs::env::NUM_REPL, "0"))); } Loading Loading
include/client/user_functions.hpp +4 −1 Original line number Diff line number Diff line Loading @@ -139,7 +139,10 @@ gkfs_mk_symlink(const std::string& path, const std::string& target); int gkfs_readlink(const std::string& path, char* buf, int bufsize); #endif #ifdef HAS_RENAME int gkfs_rename(const std::string& old_path, const std::string& new_path); #endif } // namespace syscall namespace malleable { Loading
src/client/gkfs_libc.cpp +55 −5 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ std::atomic<bool> initializing{false}; // Define a debug macro, can be easily disabled #define GKFS_TRACE //#define PATH_SHORTCUT #define PATH_SHORTCUT #ifdef GKFS_DEBUG_BUILD #ifdef GKFS_TRACE Loading Loading @@ -295,6 +295,15 @@ DLSYM_WRAPPER(int, statx, (dirfd, path, flags, mask, buf), "statx") DLSYM_WRAPPER(int, rename, (const char* oldpath, const char* newpath), (oldpath, newpath), "rename") DLSYM_WRAPPER(int, renameat, (int olddirfd, const char* oldpath, int newdirfd, const char* newpath), (olddirfd, oldpath, newdirfd, newpath), "renameat") DLSYM_WRAPPER(int, renameat2, (int olddirfd, const char* oldpath, int newdirfd, const char* newpath, unsigned int flags), (olddirfd, oldpath, newdirfd, newpath, flags), "renameat2") DLSYM_WRAPPER(int, remove, (char* path), (path), "remove") DLSYM_WRAPPER(int, unlink, (const char* path), (path), "unlink") DLSYM_WRAPPER(DIR*, opendir, (const char* dirname), (dirname), "opendir") Loading Loading @@ -1124,6 +1133,7 @@ int rename(const char* oldpath, const char* newpath) { initializeGekko(); // Is path from GekkoFS? DEBUG_INFO("rename {} --> {}", oldpath, newpath); if(CTX->interception_enabled()) { std::string resolved_old; std::string resolved_new; Loading @@ -1137,10 +1147,9 @@ rename(const char* oldpath, const char* newpath) { case PathStatus::Internal: DEBUG_INFO("[GKFS] {} {}{}", "NOT IMPLEMENTED", resolved_old, resolved_new); return -ENOTDIR; // return // gkfs::syscall::gkfs_rename(resolved_old, // resolved_new); return gkfs::syscall::gkfs_rename(resolved_old, resolved_new); default: // Try normal open. Loading Loading @@ -2434,3 +2443,44 @@ rewinddir(DIR* dirstream) { } GKFS_FALLBACK(rewinddir, dirstream) } int renameat(int olddirfd, const char* oldpath, int newdirfd, const char* newpath) { initializeGekko(); if(CTX->interception_enabled()) { std::string resolved; if(resolve_gkfs_path(olddirfd, oldpath, resolved) == PathStatus::Internal) { DEBUG_INFO("[GKFS] {}", resolved); std::string resolved2; if(resolve_gkfs_path(newdirfd, newpath, resolved2) == PathStatus::Internal) { DEBUG_INFO("[GKFS] {}", resolved2); return gkfs::syscall::gkfs_rename(resolved, resolved2); } } } GKFS_FALLBACK(renameat, olddirfd, oldpath, newdirfd, newpath); } int renameat2(int olddirfd, const char* oldpath, int newdirfd, const char* newpath, unsigned int flags) { initializeGekko(); if(CTX->interception_enabled()) { std::string resolved; if(resolve_gkfs_path(olddirfd, oldpath, resolved) == PathStatus::Internal) { DEBUG_INFO("[GKFS] {}", resolved); std::string resolved2; if(resolve_gkfs_path(newdirfd, newpath, resolved2) == PathStatus::Internal) { DEBUG_INFO("[GKFS] {}", resolved2); return gkfs::syscall::gkfs_rename(resolved, resolved2); } } } GKFS_FALLBACK(renameat2, olddirfd, oldpath, newdirfd, newpath, flags); } No newline at end of file
src/client/hooks.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -789,6 +789,10 @@ hook_getcwd(char* buf, unsigned long size) { LOG(DEBUG, "{}() called with buf: {}, size: {}", __func__, fmt::ptr(buf), size); if(CTX->cwd().size() == 0) { CTX->cwd(gkfs::path::get_sys_cwd()); } if(CTX->cwd().size() + 1 > size) { LOG(ERROR, "{}() buffer too small to host current working dir", __func__); Loading
src/client/preload_context.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -85,7 +85,6 @@ PreloadContext::PreloadContext() char host[255]; gethostname(host, 255); hostname = host; cwd_ = gkfs::path::get_sys_cwd(); PreloadContext::set_replicas( std::stoi(gkfs::env::get_var(gkfs::env::NUM_REPL, "0"))); } Loading