Commit d9043328 authored by Ramon Nou's avatar Ramon Nou
Browse files

added readdir

add rmdir
parent 5ae7595b
Loading
Loading
Loading
Loading
+63 −13
Original line number Diff line number Diff line
@@ -40,6 +40,28 @@ extern "C" {
#include <dirent.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/statvfs.h>

#include <sys/types.h>
#include <dirent.h>


#ifndef _STAT_VER
#define _STAT_VER 0
#endif

struct __dirstream {
    int fd; // File descriptor.
    //__libc_lock_define (, lock) // Mutex lock for this structure. //TODO
    size_t allocation; // Space allocated for the block.
    size_t size;       // Total valid data in the block.
    size_t offset;     // Current offset into the block.
    off_t filepos;     // Position of next entry to read.
    // Directory block.
    char data[0] __attribute__((aligned(__alignof__(void*))));

    char* path;
};


// File API
@@ -84,22 +106,25 @@ off64_t
dlsym_lseek64(int fd, off64_t offset, int whence);

int
dlsym_fstat(int fd, struct stat* buf);
dlsym_fstat(int ver, int fd, struct stat* buf);
int
dlsym_fxstat64(int fd, struct stat64* buf);
dlsym_fxstat64(int ver, int fd, struct stat64* buf);
int
dlsym_stat(const char* path, struct stat* buf);
dlsym_stat(int ver, const char* path, struct stat* buf);
int
dlsym_lstat(const char* path, struct stat* buf);
dlsym_lstat(int ver, const char* path, struct stat* buf);
int
dlsym_lxstat64(const char* path, struct stat64* buf);
dlsym_lxstat64(int ver, const char* path, struct stat64* buf);
int
dlsym_xstat64(const char* path, struct stat64* buf);
dlsym_xstat64(int ver, const char* path, struct stat64* buf);
int
dlsym_fstatat(int dfd, const char* path, struct stat* buf, int flags);
int
dlsym_fstatat64(int dfd, const char* path, struct stat64* buf, int flags);

int
dlsym_statx(int dirfd, const char* path, int flags, unsigned int mask,
            struct statx* buf);
int
dlsym_rename(const char* old_path, const char* new_path);
int
@@ -205,7 +230,12 @@ open64(const char* path, int flags, ...);
int
open(const char* path, int flags, ...);
// openat
int openat (int __fd, const char *__file, int __oflag, ...);
int
openat(int __fd, const char* __file, int __oflag, ...);


int
openat64(int dirfd, const char* path, int flags, ...);


int
@@ -246,6 +276,12 @@ off_t
lseek(int fd, off_t offset, int whence) __THROW;
off64_t
lseek64(int fd, off64_t offset, int whence) __THROW;
// statvfs

int
statvfs(const char* path, struct statvfs* buf);
int
fstatvfs(int fd, struct statvfs* buf);

int
fstat(int fd, struct stat* buf);
@@ -253,17 +289,28 @@ int
fstat64(int fd, struct stat64* buf);
int
stat(const char* path, struct stat* buf);


int
lstat(const char* path, struct stat* buf);
__xstat(int ver, const char* path, struct stat* buf);
int
stat64(const char* path, struct stat64* buf);
__xstat64(int ver, const char* path, struct stat64* buf);
int
lstat64(const char* path, struct stat64* buf);
__fxstat64(int ver, int fd, struct stat64* buf);
int
fstatat(int dfd, const char* path, struct stat* buf, int flags);
__lxstat(int ver, const char* path, struct stat* buf);
int
fstatat64(int dfd, const char* path, struct stat64* buf, int flags);
__lxstat64(int ver, const char* path, struct stat64* buf);
int
__fxstat(int ver, int fd, struct stat* buf);
int
__fxstatat(int ver, int dfd, const char* path, struct stat* buf, int flags);
int
__fxstatat64(int ver, int dfd, const char* path, struct stat64* buf, int flags);

int
statx(int dirfd, const char* pathname, int flags, unsigned int mask,
      struct statx* statxbuf);
int
rename(const char* old_path, const char* new_path);
int
@@ -288,6 +335,9 @@ readdir(DIR* dirp);
struct dirent64*
readdir64(DIR* dirp);

int
clone(int (*fn)(void*), void* stack, int flags, void* arg, ...);
/* pid_t *parent_tid, void *tls, pid_t *child_tid */

/* ................................................................... */

+2 −0
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@
#define CTX gkfs::preload::PreloadContext::getInstance()
namespace gkfs::preload {
void
init_environment();
void
init_ld_env_if_needed();
} // namespace gkfs::preload

+906 −147

File changed.

Preview size limit exceeded, changes collapsed.