Commit d0c031f3 authored by sevenuz's avatar sevenuz Committed by Julius Athenstaedt
Browse files

compilation fix for older fuse versions, remove gkfs_libc header by including __dirstream struct

parent 91f7740e
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -45,6 +45,20 @@
extern "C" {
#define FUSE_USE_VERSION FUSE_MAKE_VERSION(3, 12)
#include <fuse3/fuse_lowlevel.h>

// TODO do we really need this? Now its to replace the libc.hpp def for the
// sizeof(DIR) statement
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* path;
    char data[1] __attribute__((aligned(__alignof__(void*))));
}; // Originally its 0, but C++ does not permit it
}

#include <unistd.h>
@@ -102,7 +116,6 @@ struct _uintptr_to_must_hold_fuse_ino_t_dummy_struct {
#include <client/preload.hpp>
#include <client/preload_context.hpp>
#include <client/user_functions.hpp>
#include <client/gkfs_libc.hpp>

static inline int
do_fallocate(int fd, int mode, off_t offset, off_t length) {
+15 −1
Original line number Diff line number Diff line
@@ -334,10 +334,17 @@ create_handler(fuse_req_t req, fuse_ino_t parent, const char* name, mode_t mode,
    std::string path = parent_inode->path + name;
    int rc = gkfs::syscall::gkfs_create(path, mode);
    if(rc == -1) {
        fuse_log(FUSE_LOG_DEBUG, "here here mode %i flags %i \n", mode, fi->flags);
        fuse_log(FUSE_LOG_DEBUG, "here here mode %i flags %i \n", mode,
                 fi->flags);
        fuse_reply_err(req, 1);
        return;
    }
    int fd = gkfs::syscall::gkfs_open(path, mode, fi->flags);
    if(fd < 0) {
        fuse_reply_err(req, ENOENT);
        return;
    }
    fi->fh = fd;
    struct stat st;
    int sc = gkfs::syscall::gkfs_stat(path, &st);
    if(sc == -1) {
@@ -651,12 +658,19 @@ main(int argc, char* argv[]) {
    if(opts.singlethread)
        ret = fuse_session_loop(se);
    else {
#if FUSE_MAJOR_VERSION > 3 ||                                                  \
        (FUSE_MAJOR_VERSION == 3 && FUSE_MINOR_VERSION >= 12)
        config = fuse_loop_cfg_create();
        fuse_loop_cfg_set_clone_fd(config, opts.clone_fd);
        fuse_loop_cfg_set_max_threads(config, opts.max_threads);
        ret = fuse_session_loop_mt(se, config);
        fuse_loop_cfg_destroy(config);
        config = NULL;
#else
        // for older fuse versions like on the ubuntu22
        ret = fuse_session_loop_mt(
                se, NULL); // second argument should be checked!!!
#endif
    }

    fuse_session_unmount(se);