Loading fs/CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,6 @@ find_package(FUSE3 REQUIRED) find_package(Boost 1.56.0 COMPONENTS system filesystem serialization) include_directories(${FUSE3_INCLUDE_DIR} include/) set(SOURCE_FILES src/main.cpp src/main.h src/fuse_ops.h src/util.cpp src/metadata.h src/metadata.cpp src/metadata_ops.h src/metadata_ops.cpp src/dentry_ops.cpp src/dentry_ops.h src/configure.h src/fuse_ops/file.cpp src/fuse_ops/directory.cpp src/fuse_ops/permission.cpp src/fuse_utils.h) set(SOURCE_FILES src/main.cpp src/main.h src/fuse_ops.h src/util.cpp src/metadata.h src/metadata.cpp src/metadata_ops.h src/metadata_ops.cpp src/dentry_ops.cpp src/dentry_ops.h src/configure.h src/fuse_ops/file.cpp src/fuse_ops/directory.cpp src/fuse_ops/permission.cpp src/fuse_utils.h src/fuse_ops/sync.cpp) add_executable(adafs ${SOURCE_FILES} src/main.cpp) target_link_libraries(adafs ${FUSE3_LIBRARIES} -lpthread -lboost_system -lboost_filesystem -lboost_serialization) No newline at end of file fs/src/fuse_ops.h +12 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,12 @@ // file int adafs_getattr(const char*, struct stat*, struct fuse_file_info*); int adafs_mknod(const char*, mode_t, dev_t); int adafs_open(const char*, struct fuse_file_info*); int adafs_utimens(const char*, const struct timespec tv[2], struct fuse_file_info* fi); // directory int adafs_opendir(const char*, struct fuse_file_info*); Loading @@ -18,6 +24,12 @@ int adafs_readdir(const char*, void*, fuse_fill_dir_t, off_t, struct fuse_file_i int adafs_releasedir(const char*, struct fuse_file_info*); // int adafs_flush(const char*, struct fuse_file_info*); // void* adafs_init(struct fuse_conn_info*, struct fuse_config*); void adafs_destroy(void *); Loading fs/src/fuse_ops/directory.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ int adafs_readdir(const char* p, void* buf, fuse_fill_dir_t filler, off_t offset /** Release directory */ int adafs_releasedir(const char*, struct fuse_file_info*) { int adafs_releasedir(const char* p, struct fuse_file_info* ffi) { // XXX Dunno what to do with that function yet. Maybe flush dirty dentries that are in cache? // At the time of this writing I don't have any cache running. So all dirty stuff is immediately written to disk. return 0; Loading fs/src/fuse_ops/file.cpp +48 −1 Original line number Diff line number Diff line Loading @@ -47,3 +47,50 @@ int adafs_getattr(const char* p, struct stat* attr, struct fuse_file_info* fi) { // } return -ENOENT; } /** Create a file node * * This is called for creation of all non-directory, non-symlink * nodes. If the filesystem defines a create() method, then for * regular files that will be called instead. */ int adafs_mknod(const char* p, mode_t mode, dev_t dev) { return 0; } /** File open operation * * No creation (O_CREAT, O_EXCL) and by default also no * truncation (O_TRUNC) flags will be passed to open(). If an * application specifies O_TRUNC, fuse first calls truncate() * and then open(). Only if 'atomic_o_trunc' has been * specified and kernel version is 2.6.24 or later, O_TRUNC is * passed on to open. * * Unless the 'default_permissions' mount option is given, * open should check if the operation is permitted for the * given flags. Optionally open may also return an arbitrary * filehandle in the fuse_file_info structure, which will be * passed to all file operations. */ int adafs_open(const char* p, struct fuse_file_info* ffi) { return 0; } /** * Change the access and modification times of a file with * nanosecond resolution * * This supersedes the old utime() interface. New applications * should use this. * * `fi` will always be NULL if the file is not currenly open, but * may also be NULL if the file is open. * * See the utimensat(2) man page for details. */ int adafs_utimens(const char* p, const struct timespec tv[2], struct fuse_file_info* fi) { return 0; } fs/src/fuse_ops/sync.cpp 0 → 100644 +10 −0 Original line number Diff line number Diff line // // Created by draze on 3/23/17. // #include "../main.h" #include "../fuse_ops.h" int adafs_flush(const char*, struct fuse_file_info*) { return 0; } Loading
fs/CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,6 @@ find_package(FUSE3 REQUIRED) find_package(Boost 1.56.0 COMPONENTS system filesystem serialization) include_directories(${FUSE3_INCLUDE_DIR} include/) set(SOURCE_FILES src/main.cpp src/main.h src/fuse_ops.h src/util.cpp src/metadata.h src/metadata.cpp src/metadata_ops.h src/metadata_ops.cpp src/dentry_ops.cpp src/dentry_ops.h src/configure.h src/fuse_ops/file.cpp src/fuse_ops/directory.cpp src/fuse_ops/permission.cpp src/fuse_utils.h) set(SOURCE_FILES src/main.cpp src/main.h src/fuse_ops.h src/util.cpp src/metadata.h src/metadata.cpp src/metadata_ops.h src/metadata_ops.cpp src/dentry_ops.cpp src/dentry_ops.h src/configure.h src/fuse_ops/file.cpp src/fuse_ops/directory.cpp src/fuse_ops/permission.cpp src/fuse_utils.h src/fuse_ops/sync.cpp) add_executable(adafs ${SOURCE_FILES} src/main.cpp) target_link_libraries(adafs ${FUSE3_LIBRARIES} -lpthread -lboost_system -lboost_filesystem -lboost_serialization) No newline at end of file
fs/src/fuse_ops.h +12 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,12 @@ // file int adafs_getattr(const char*, struct stat*, struct fuse_file_info*); int adafs_mknod(const char*, mode_t, dev_t); int adafs_open(const char*, struct fuse_file_info*); int adafs_utimens(const char*, const struct timespec tv[2], struct fuse_file_info* fi); // directory int adafs_opendir(const char*, struct fuse_file_info*); Loading @@ -18,6 +24,12 @@ int adafs_readdir(const char*, void*, fuse_fill_dir_t, off_t, struct fuse_file_i int adafs_releasedir(const char*, struct fuse_file_info*); // int adafs_flush(const char*, struct fuse_file_info*); // void* adafs_init(struct fuse_conn_info*, struct fuse_config*); void adafs_destroy(void *); Loading
fs/src/fuse_ops/directory.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ int adafs_readdir(const char* p, void* buf, fuse_fill_dir_t filler, off_t offset /** Release directory */ int adafs_releasedir(const char*, struct fuse_file_info*) { int adafs_releasedir(const char* p, struct fuse_file_info* ffi) { // XXX Dunno what to do with that function yet. Maybe flush dirty dentries that are in cache? // At the time of this writing I don't have any cache running. So all dirty stuff is immediately written to disk. return 0; Loading
fs/src/fuse_ops/file.cpp +48 −1 Original line number Diff line number Diff line Loading @@ -47,3 +47,50 @@ int adafs_getattr(const char* p, struct stat* attr, struct fuse_file_info* fi) { // } return -ENOENT; } /** Create a file node * * This is called for creation of all non-directory, non-symlink * nodes. If the filesystem defines a create() method, then for * regular files that will be called instead. */ int adafs_mknod(const char* p, mode_t mode, dev_t dev) { return 0; } /** File open operation * * No creation (O_CREAT, O_EXCL) and by default also no * truncation (O_TRUNC) flags will be passed to open(). If an * application specifies O_TRUNC, fuse first calls truncate() * and then open(). Only if 'atomic_o_trunc' has been * specified and kernel version is 2.6.24 or later, O_TRUNC is * passed on to open. * * Unless the 'default_permissions' mount option is given, * open should check if the operation is permitted for the * given flags. Optionally open may also return an arbitrary * filehandle in the fuse_file_info structure, which will be * passed to all file operations. */ int adafs_open(const char* p, struct fuse_file_info* ffi) { return 0; } /** * Change the access and modification times of a file with * nanosecond resolution * * This supersedes the old utime() interface. New applications * should use this. * * `fi` will always be NULL if the file is not currenly open, but * may also be NULL if the file is open. * * See the utimensat(2) man page for details. */ int adafs_utimens(const char* p, const struct timespec tv[2], struct fuse_file_info* fi) { return 0; }
fs/src/fuse_ops/sync.cpp 0 → 100644 +10 −0 Original line number Diff line number Diff line // // Created by draze on 3/23/17. // #include "../main.h" #include "../fuse_ops.h" int adafs_flush(const char*, struct fuse_file_info*) { return 0; }