Commit 15e6df40 authored by Marc Vef's avatar Marc Vef
Browse files

Adding unlink, access infrastructure. lookup fix...

do_lookup return values and error code need to change.
parent ee066bb0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ set(SOURCE_FILES src/main.cpp src/main.h src/fuse_ops.h src/configure.h
        src/adafs_ops/metadata_ops.h src/adafs_ops/dentry_ops.h src/adafs_ops/access.h

        src/util.cpp
        src/fuse_ops/file.cpp src/fuse_ops/directory.cpp src/fuse_ops/sync.cpp
        src/fuse_ops/file.cpp src/fuse_ops/directory.cpp src/fuse_ops/sync.cpp src/fuse_ops/access.cpp
        src/adafs_ops/metadata_ops.cpp src/adafs_ops/dentry_ops.cpp src/adafs_ops/access.cpp

        )
+0 −1
Original line number Diff line number Diff line
@@ -135,7 +135,6 @@ uint64_t do_lookup(fuse_req_t& req, const uint64_t p_inode, const string& name)
    d_path /= to_string(p_inode);
    // XXX check if this is needed later
    d_path /= name;

    if (!bfs::exists(d_path))
        return static_cast<uint64_t>(-ENOENT);

+3 −5
Original line number Diff line number Diff line
@@ -12,16 +12,15 @@ void adafs_ll_getattr(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi)
void adafs_ll_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr, int to_set, struct fuse_file_info *fi);
void adafs_ll_create(fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, struct fuse_file_info *fi);
void adafs_ll_mknod(fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, dev_t rdev);

void adafs_ll_unlink(fuse_req_t req, fuse_ino_t parent, const char* name);
void adafs_ll_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);
void adafs_ll_release(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);

// directory
void adafs_ll_lookup(fuse_req_t req, fuse_ino_t parent, const char* name);

void adafs_ll_opendir(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi);

void adafs_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info* fi);

void adafs_ll_releasedir(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi);
// I/O

@@ -32,14 +31,13 @@ void adafs_ll_flush(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);


// access

void adafs_ll_access(fuse_req_t req, fuse_ino_t ino, int mask);


// file system miscellaneous


void adafs_ll_init(void* adafs_data, struct fuse_conn_info* conn);

void adafs_ll_destroy(void* adafs_data);

#endif //FS_FUSE_OPS_H
+32 −0
Original line number Diff line number Diff line
//
// Created by evie on 5/12/17.
//

#include "../main.h"
#include "../fuse_ops.h"

/**
 * Check file access permissions
 *
 * This will be called for the access() system call.  If the
 * 'default_permissions' mount option is given, this method is not
 * called.
 *
 * This method is not called under Linux kernel versions 2.4.x
 *
 * If this request is answered with an error code of ENOSYS, this is
 * treated as a permanent success, i.e. this and all future access()
 * requests will succeed without being send to the filesystem process.
 *
 * Valid replies:
 *   fuse_reply_err
 *
 * @param req request handle
 * @param ino the inode number
 * @param mask requested access mode
 */
void adafs_ll_access(fuse_req_t req, fuse_ino_t ino, int mask) {
    ADAFS_DATA->spdlogger()->debug("adafs_ll_access() enter: ino {} mask {}", ino, mask);

    fuse_reply_err(req, 0);
}
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
@@ -29,8 +29,9 @@ void adafs_ll_lookup(fuse_req_t req, fuse_ino_t parent, const char* name) {

    //get inode no first (either from cache or disk) with parent inode and name
    auto inode = do_lookup(req, parent, string(name));
    if (inode < 1) {
        fuse_reply_err(req, static_cast<int>(inode));
    // XXX I DON'T like how this is handled with static_cast. like double negation and large int usage for int ERRcodes
    if (static_cast<int>(inode) < 1) {
        fuse_reply_err(req, static_cast<int>(-inode));
        return;
    }

Loading