Commit 5f14e881 authored by Marc Vef's avatar Marc Vef
Browse files

Code analysis fixes. Merged from fs

parent 86bed235
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
# required packages
find_package(FUSE3 REQUIRED)
# boost dependencies, system is required for filesystem #TODO VERSION UNTESTED. I USE 1.62
find_package(Boost 1.56.0 COMPONENTS system filesystem serialization)
find_package(Boost 1.62.0 REQUIRED COMPONENTS system filesystem serialization)

include_directories(${FUSE3_INCLUDE_DIR} include/)
set(SOURCE_FILES src/main.cpp src/main.h src/fuse_ops.h src/configure.h
+3 −3
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ int chk_access(const fuse_req_t& req, const Metadata& md, int mask) {
    //check user leftmost 3 bits for rwx in md->mode
    if (md.uid() == fuse_req_ctx(req)->uid) {
        // Because mode comes only with the first 3 bits used, the user bits have to be shifted to the right to compare
        if ((mask & md.mode() >> 6) == (unsigned int) mask)
        if ((mask & md.mode() >> 6) == static_cast<unsigned int>(mask))
            return 0;
        else
            return EACCES;
@@ -32,7 +32,7 @@ int chk_access(const fuse_req_t& req, const Metadata& md, int mask) {

    //check group middle 3 bits for rwx in md->mode
    if (md.gid() == fuse_req_ctx(req)->gid) {
        if ((mask & md.mode() >> 3) == (unsigned int) mask)
        if ((mask & md.mode() >> 3) == static_cast<unsigned int>(mask))
            return 0;
        else
            return EACCES;
@@ -40,7 +40,7 @@ int chk_access(const fuse_req_t& req, const Metadata& md, int mask) {

    //check other rightmost 3 bits for rwx in md->mode.
    // Because they are the rightmost bits they don't need to be shifted
    if ((mask & md.mode()) == (unsigned int) mask) {
    if ((mask & md.mode()) == static_cast<unsigned int>(mask)) {
        return 0;
    }

+2 −2
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ int init_chunk_space(const unsigned long hash) {
    chnk_path /= "data"s;
    bfs::ofstream ofs{chnk_path};

    return bfs::exists(chnk_path);
    return static_cast<int>(bfs::exists(chnk_path));
}
/**
 * Remove the directory in the chunk dir of a file.
@@ -39,5 +39,5 @@ int destroy_chunk_space(const unsigned long hash) {
    // create chunk dir
    bfs::remove_all(chnk_path);

    return !bfs::exists(chnk_path);
    return static_cast<int>(!bfs::exists(chnk_path));
}
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ void adafs_ll_getattr(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi)
    auto attr = make_unique<struct stat>();
    auto md = make_shared<Metadata>();
    auto err = get_metadata(*md, ino);
    if (!err) {
    if (err == 0) {
        attr->st_ino = md->inode_no();
        attr->st_mode = md->mode();
        attr->st_nlink = md->link_count();
+3 −2
Original line number Diff line number Diff line
@@ -148,9 +148,10 @@ int main(int argc, char* argv[]) {
    spdlog::set_level(spdlog::level::off);
#endif
    //extract the rootdir from argv and put it into rootdir of adafs_data
    ADAFS_DATA->rootdir(string(realpath(argv[argc - 2], NULL)));
    // TODO pointer modification = dangerous. need another solution
    ADAFS_DATA->rootdir(string(realpath(argv[argc - 2], nullptr)));
    argv[argc - 2] = argv[argc - 1];
    argv[argc - 1] = NULL;
    argv[argc - 1] = nullptr;
    argc--;
    //set all paths
    ADAFS_DATA->inode_path(ADAFS_DATA->rootdir() + "/meta/inodes"s);
Loading