Resolve "Support . and .. on directories"

Closes #355 (closed)

Merge request reports

Loading
+1 −2
Changes for include/client/gkfs_functions.hpp: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -42,11 +42,10 @@

#include <client/open_file_map.hpp>
#include <common/metadata.hpp>
#include <client/intercept.hpp>

struct statfs;
struct statvfs;
struct linux_dirent;
struct linux_dirent64;

namespace gkfs::syscall {

+1 −2
Changes for include/client/hooks.hpp: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ extern "C" {
#include <client/void_syscall_intercept.hpp>
#endif

#include <client/intercept.hpp>

/*
 * For PowerPC, syscall_no_intercept_wrapper() is defined in the
@@ -75,8 +76,6 @@ syscall_no_intercept_wrapper(long syscall_number, Args... args) {
#endif

struct statfs;
struct linux_dirent;
struct linux_dirent64;

namespace gkfs::hook {

+31 −0
Changes for include/client/intercept.hpp: 31 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -40,6 +40,37 @@
#ifndef GEKKOFS_INTERCEPT_HPP
#define GEKKOFS_INTERCEPT_HPP

#include <stdint.h>
/*
 * linux_dirent is used in getdents() but is privately defined in the linux
 * kernel: fs/readdir.c.
 */
struct linux_dirent {
#ifndef __USE_FILE_OFFSET64
    unsigned long d_ino;
    unsigned long d_off;
#else
    uint64_t d_ino;
    int64_t d_off;
#endif
    unsigned short d_reclen;
    unsigned char d_type; // Does it break dirents?
    char d_name[1];
};
/*
 * linux_dirent64 is used in getdents64() and defined in the linux kernel:
 * include/linux/dirent.h. However, it is not part of the kernel-headers and
 * cannot be imported.
 */
struct linux_dirent64 {
    uint64_t d_ino;
    int64_t d_off;
    unsigned short d_reclen;
    unsigned char d_type;
    char d_name[1]; // originally `char d_name[0]` in kernel, but ISO C++
                    // forbids zero-size array 'd_name'
};

namespace gkfs::preload {

int
+13 −0
Changes for include/client/user_functions.hpp: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@
extern "C" {
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/uio.h>
}

struct linux_dirent;
@@ -83,6 +84,18 @@ gkfs_pwrite(int fd, const void* buf, size_t count, off64_t offset);
ssize_t
gkfs_pread(int fd, void* buf, size_t count, off64_t offset);

ssize_t
gkfs_readv(int fd, const struct iovec* iov, int iovcnt);

ssize_t
gkfs_writev(int fd, const struct iovec* iov, int iovcnt);

ssize_t
gkfs_preadv(int fd, const struct iovec* iov, int iovcnt, off_t offset);

ssize_t
gkfs_pwritev(int fd, const struct iovec* iov, int iovcnt, off_t offset);

int
gkfs_stat(const std::string& path, struct stat* buf, bool follow_links = true,
          bool bypass_rename = false);
+0 −2
Changes for include/daemon/handler/rpc_defs.hpp: 0 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -72,12 +72,10 @@ DECLARE_MARGO_RPC_HANDLER(rpc_srv_get_dirents_extended)
DECLARE_MARGO_RPC_HANDLER(rpc_srv_mk_symlink)

#endif

#ifdef HAS_RENAME
DECLARE_MARGO_RPC_HANDLER(rpc_srv_rename)
#endif


// data
DECLARE_MARGO_RPC_HANDLER(rpc_srv_remove_data)

Loading
Loading