Loading fs/src/fuse_ops.h +21 −0 Original line number Diff line number Diff line Loading @@ -9,38 +9,59 @@ // file int adafs_getattr(const char* p, struct stat* attr, struct fuse_file_info* fi); int adafs_mknod(const char* p, mode_t, dev_t); int adafs_create(const char* p, mode_t mode, struct fuse_file_info* fi); int adafs_open(const char*, struct fuse_file_info* fi); int adafs_unlink(const char* p); int adafs_utimens(const char* p, const struct timespec tv[2], struct fuse_file_info* fi); int adafs_release(const char* p, struct fuse_file_info* fi); // directory int adafs_opendir(const char* p, struct fuse_file_info* fi); int adafs_readdir(const char* p, void* buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info* fi, enum fuse_readdir_flags flags); int adafs_releasedir(const char* p, struct fuse_file_info* fi); int adafs_mkdir(const char* p, mode_t mode); int adafs_rmdir(const char* p); // I/O int adafs_read(const char* p, char* buf, size_t size, off_t offset, struct fuse_file_info* fi); int adafs_write(const char* p, const char* buf, size_t size, off_t offset, struct fuse_file_info* fi); int adafs_truncate(const char* p, off_t offset, struct fuse_file_info* fi); // int adafs_flush(const char* p, struct fuse_file_info* fi); // access int adafs_access(const char* p, int mask); int adafs_chmod(const char* p, mode_t mode, struct fuse_file_info* fi); int adafs_chown(const char* p, uid_t uid, gid_t gid, struct fuse_file_info* fi); // file system miscellaneous int adafs_statfs(const char* p, struct statvfs* statvfs); void* adafs_init(struct fuse_conn_info* conn, struct fuse_config* cfg); void adafs_destroy(void* adafs_data); #endif //FS_FUSE_OPS_H fs/src/fuse_ops/file.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,27 @@ int adafs_mknod(const char* p, mode_t mode, dev_t dev) { return 0; } /** * Create and open a file * * If the file does not exist, first create it with the specified * mode, and then open it. * * If this method is not implemented or under Linux kernel * versions earlier than 2.6.15, the mknod() and open() methods * will be called instead. */ int adafs_create(const char* p, mode_t mode, struct fuse_file_info* fi) { ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_create() enter: name '{}' mode {}", p, mode); auto err = static_cast<int>(adafs_mknod(p, mode, 0)); if (err) return err; #ifdef CHECK_ACCESS err = adafs_open(p, fi); #endif return err; } /** File open operation * * No creation (O_CREAT, O_EXCL) and by default also no Loading fs/src/main.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ static void init_adafs_ops(fuse_operations* ops) { // file ops->getattr = adafs_getattr; ops->mknod = adafs_mknod; ops->create = adafs_create; ops->open = adafs_open; ops->unlink = adafs_unlink; ops->utimens = adafs_utimens; Loading Loading
fs/src/fuse_ops.h +21 −0 Original line number Diff line number Diff line Loading @@ -9,38 +9,59 @@ // file int adafs_getattr(const char* p, struct stat* attr, struct fuse_file_info* fi); int adafs_mknod(const char* p, mode_t, dev_t); int adafs_create(const char* p, mode_t mode, struct fuse_file_info* fi); int adafs_open(const char*, struct fuse_file_info* fi); int adafs_unlink(const char* p); int adafs_utimens(const char* p, const struct timespec tv[2], struct fuse_file_info* fi); int adafs_release(const char* p, struct fuse_file_info* fi); // directory int adafs_opendir(const char* p, struct fuse_file_info* fi); int adafs_readdir(const char* p, void* buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info* fi, enum fuse_readdir_flags flags); int adafs_releasedir(const char* p, struct fuse_file_info* fi); int adafs_mkdir(const char* p, mode_t mode); int adafs_rmdir(const char* p); // I/O int adafs_read(const char* p, char* buf, size_t size, off_t offset, struct fuse_file_info* fi); int adafs_write(const char* p, const char* buf, size_t size, off_t offset, struct fuse_file_info* fi); int adafs_truncate(const char* p, off_t offset, struct fuse_file_info* fi); // int adafs_flush(const char* p, struct fuse_file_info* fi); // access int adafs_access(const char* p, int mask); int adafs_chmod(const char* p, mode_t mode, struct fuse_file_info* fi); int adafs_chown(const char* p, uid_t uid, gid_t gid, struct fuse_file_info* fi); // file system miscellaneous int adafs_statfs(const char* p, struct statvfs* statvfs); void* adafs_init(struct fuse_conn_info* conn, struct fuse_config* cfg); void adafs_destroy(void* adafs_data); #endif //FS_FUSE_OPS_H
fs/src/fuse_ops/file.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,27 @@ int adafs_mknod(const char* p, mode_t mode, dev_t dev) { return 0; } /** * Create and open a file * * If the file does not exist, first create it with the specified * mode, and then open it. * * If this method is not implemented or under Linux kernel * versions earlier than 2.6.15, the mknod() and open() methods * will be called instead. */ int adafs_create(const char* p, mode_t mode, struct fuse_file_info* fi) { ADAFS_DATA->logger->debug("##### FUSE FUNC ###### adafs_create() enter: name '{}' mode {}", p, mode); auto err = static_cast<int>(adafs_mknod(p, mode, 0)); if (err) return err; #ifdef CHECK_ACCESS err = adafs_open(p, fi); #endif return err; } /** File open operation * * No creation (O_CREAT, O_EXCL) and by default also no Loading
fs/src/main.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,7 @@ static void init_adafs_ops(fuse_operations* ops) { // file ops->getattr = adafs_getattr; ops->mknod = adafs_mknod; ops->create = adafs_create; ops->open = adafs_open; ops->unlink = adafs_unlink; ops->utimens = adafs_utimens; Loading