Loading include/client/hooks.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,8 @@ int hook_readlinkat(int dirfd, const char * cpath, char * buf, int bufsiz); int hook_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg); int hook_renameat(int olddfd, const char * oldname, int newdfd, const char * newname, unsigned int flags); int hook_statfs(const char * path, struct statfs * buf); int hook_fstatfs(unsigned int fd, struct statfs * buf); #endif src/client/hooks.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -626,3 +626,20 @@ int hook_renameat(int olddfd, const char * oldname, return syscall_no_intercept(SYS_renameat2, olddfd, oldpath_pass, newdfd, newpath_pass, flags); } int hook_statfs(const char * path, struct statfs * buf) { CTX->log()->trace("{}() called with path: {}", __func__, path); std::string rel_path; if (CTX->relativize_path(path, rel_path)) { return with_errno(adafs_statfs(buf)); } return syscall_no_intercept(SYS_statfs, rel_path.c_str(), buf); } int hook_fstatfs(unsigned int fd, struct statfs * buf) { CTX->log()->trace("{}() called with fs: {}", __func__, fd); if (CTX->file_map()->exist(fd)) { return with_errno(adafs_statfs(buf)); } return syscall_no_intercept(SYS_fstatfs, fd, buf); } src/client/intercept.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -286,6 +286,16 @@ static inline int hook(long syscall_number, static_cast<unsigned int>(arg4)); break; case SYS_fstatfs: *result = hook_fstatfs(static_cast<unsigned int>(arg0), reinterpret_cast<struct statfs *>(arg1)); break; case SYS_statfs: *result = hook_statfs(reinterpret_cast<const char *>(arg0), reinterpret_cast<struct statfs *>(arg1)); break; default: /* * Ignore any other syscalls Loading Loading
include/client/hooks.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,8 @@ int hook_readlinkat(int dirfd, const char * cpath, char * buf, int bufsiz); int hook_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg); int hook_renameat(int olddfd, const char * oldname, int newdfd, const char * newname, unsigned int flags); int hook_statfs(const char * path, struct statfs * buf); int hook_fstatfs(unsigned int fd, struct statfs * buf); #endif
src/client/hooks.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -626,3 +626,20 @@ int hook_renameat(int olddfd, const char * oldname, return syscall_no_intercept(SYS_renameat2, olddfd, oldpath_pass, newdfd, newpath_pass, flags); } int hook_statfs(const char * path, struct statfs * buf) { CTX->log()->trace("{}() called with path: {}", __func__, path); std::string rel_path; if (CTX->relativize_path(path, rel_path)) { return with_errno(adafs_statfs(buf)); } return syscall_no_intercept(SYS_statfs, rel_path.c_str(), buf); } int hook_fstatfs(unsigned int fd, struct statfs * buf) { CTX->log()->trace("{}() called with fs: {}", __func__, fd); if (CTX->file_map()->exist(fd)) { return with_errno(adafs_statfs(buf)); } return syscall_no_intercept(SYS_fstatfs, fd, buf); }
src/client/intercept.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -286,6 +286,16 @@ static inline int hook(long syscall_number, static_cast<unsigned int>(arg4)); break; case SYS_fstatfs: *result = hook_fstatfs(static_cast<unsigned int>(arg0), reinterpret_cast<struct statfs *>(arg1)); break; case SYS_statfs: *result = hook_statfs(reinterpret_cast<const char *>(arg0), reinterpret_cast<struct statfs *>(arg1)); break; default: /* * Ignore any other syscalls Loading