Commit 59b5ea2a authored by Marc Vef's avatar Marc Vef
Browse files

Code maintenance: Reformatting code, removed dead code, rearranged imports

Reformatted code w.r.t. unifying code styles as of the official
CPPCoreGuidelines by Stroustrup and Sutter
parent 053cd9a5
Loading
Loading
Loading
Loading
Loading
+30
Changes for include/client/hooks.hpp: 30 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@


int hook_openat(int dirfd, const char* cpath, int flags, mode_t mode);

int hook_close(int fd);

int hook_stat(const char* path, struct stat* buf);
@@ -28,36 +29,65 @@ int hook_lstat(const char* path, struct stat* buf);
int hook_fstat(unsigned int fd, struct stat* buf);

int hook_fstatat(int dirfd, const char* cpath, struct stat* buf, int flags);

int hook_read(unsigned int fd, void* buf, size_t count);

int hook_pread(unsigned int fd, char* buf, size_t count, loff_t pos);

int hook_write(unsigned int fd, const char* buf, size_t count);

int hook_pwrite(unsigned int fd, const char* buf, size_t count, loff_t pos);

int hook_writev(unsigned long fd, const struct iovec* iov, unsigned long iovcnt);

int hook_pwritev(unsigned long fd, const struct iovec* iov, unsigned long iovcnt,
                 unsigned long pos_l, unsigned long pos_h);

int hook_unlinkat(int dirfd, const char* cpath, int flags);

int hook_symlinkat(const char* oldname, int newdfd, const char* newname);

int hook_access(const char* path, int mask);

int hook_faccessat(int dirfd, const char* cpath, int mode);

off_t hook_lseek(unsigned int fd, off_t offset, unsigned int whence);

int hook_truncate(const char* path, long length);

int hook_ftruncate(unsigned int fd, unsigned long length);

int hook_dup(unsigned int fd);

int hook_dup2(unsigned int oldfd, unsigned int newfd);

int hook_dup3(unsigned int oldfd, unsigned int newfd, int flags);

int hook_getdents(unsigned int fd, struct linux_dirent* dirp, unsigned int count);

int hook_getdents64(unsigned int fd, struct linux_dirent64* dirp, unsigned int count);

int hook_mkdirat(int dirfd, const char* cpath, mode_t mode);

int hook_fchmodat(int dirfd, const char* path, mode_t mode);

int hook_fchmod(unsigned int dirfd, mode_t mode);

int hook_chdir(const char* path);

int hook_fchdir(unsigned int fd);

int hook_getcwd(char* buf, unsigned long size);

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);


−80

File deleted.

+2
Changes for include/client/intercept.hpp: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -27,7 +27,9 @@ hook_guard_wrapper(long syscall_number,
                   long* syscall_return_value);

void start_self_interception();

void start_interception();

void stop_interception();

#endif
+7 −2
Changes for include/client/open_dir.hpp: 7 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -28,8 +28,10 @@ class DirEntry {
    std::string name_;
    FileType type_;
public:
        DirEntry(const std::string& name, const FileType type);
    DirEntry(const std::string& name, FileType type);

    const std::string& name();

    FileType type();
};

@@ -39,9 +41,12 @@ class OpenDir: public OpenFile {


public:
        OpenDir(const std::string& path);
    explicit OpenDir(const std::string& path);

    void add(const std::string& name, const FileType& type);

    const DirEntry& getdent(unsigned int pos);

    size_t size();
};

+2 −1
Changes for include/client/open_file_map.hpp: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ public:

    OpenFile(const std::string& path, int flags, FileType type = FileType::regular);

    ~OpenFile();
    ~OpenFile() = default;

    // getter/setter
    std::string path() const;
@@ -111,6 +111,7 @@ public:
    int dup2(int oldfd, int newfd);

    int generate_fd_idx();

    int get_fd_idx();
};

Loading