diff --git a/src/cryfs_lib/CMakeLists.txt b/src/cryfs_lib/CMakeLists.txt index cd55e92c..f2c30191 100644 --- a/src/cryfs_lib/CMakeLists.txt +++ b/src/cryfs_lib/CMakeLists.txt @@ -1,5 +1,5 @@ add_subdirectory(fusepp) -add_library(cryfs_lib CryDevice.cpp) +add_library(cryfs_lib CryDevice.cpp CryFuse.cpp) target_link_libraries(cryfs_lib fusepp) diff --git a/src/cryfs_lib/CryFuse.cpp b/src/cryfs_lib/CryFuse.cpp index 0177b271..f6ba1dad 100644 --- a/src/cryfs_lib/CryFuse.cpp +++ b/src/cryfs_lib/CryFuse.cpp @@ -1,5 +1,181 @@ #include "CryFuse.h" +#define UNUSED(expr) (void)(expr) + namespace cryfs { +int CryFuse::getattr(const char *path, struct stat *stbuf) { + UNUSED(stbuf); + printf("Called non-implemented getattr(%s, _)\n", path); + return 0; +} + +int CryFuse::fgetattr(const char *path, struct stat *stbuf, fuse_file_info *fileinfo) { + UNUSED(stbuf); + UNUSED(fileinfo); + printf("Called non-implemented fgetattr(%s, _, _)\n", path); + return 0; +} + +int CryFuse::readlink(const char *path, char *buf, size_t size) { + UNUSED(buf); + printf("Called non-implemented readlink(%s, _, %zu)\n", path, size); + return 0; +} + +int CryFuse::mknod(const char *path, mode_t mode, dev_t rdev) { + UNUSED(rdev); + printf("Called non-implemented mknod(%s, %d, _)\n", path, mode); + return 0; +} + +int CryFuse::mkdir(const char *path, mode_t mode) { + printf("Called non-implemented mkdir(%s, %d)\n", path, mode); + return 0; +} + +int CryFuse::unlink(const char *path) { + printf("Called non-implemented unlink(%s)\n", path); + return 0; +} + +int CryFuse::rmdir(const char *path) { + printf("Called non-implemented rmdir(%s)\n", path); + return 0; +} + +int CryFuse::symlink(const char *from, const char *to) { + printf("Called non-implemented symlink(%s, %s)\n", from, to); + return 0; +} + +int CryFuse::rename(const char *from, const char *to) { + printf("Called non-implemented rename(%s, %s)\n", from, to); + return 0; +} + +int CryFuse::link(const char *from, const char *to) { + printf("Called non-implemented link(%s, %s)\n", from, to); + return 0; +} + +int CryFuse::chmod(const char *path, mode_t mode) { + printf("Called non-implemented chmod(%s, %d)\n", path, mode); + return 0; +} + +int CryFuse::chown(const char *path, uid_t uid, gid_t gid) { + printf("Called non-implemented chown(%s, %d, %d)\n", path, uid, gid); + return 0; +} + +int CryFuse::truncate(const char *path, off_t size) { + printf("Called non-implemented truncate(%s, %zu)\n", path, size); + return 0; +} + +int CryFuse::ftruncate(const char *path, off_t size, fuse_file_info *fileinfo) { + UNUSED(fileinfo); + printf("Called non-implemented ftruncate(%s, %zu, _)\n", path, size); + return 0; +} + +int CryFuse::utimens(const char *path, const timespec times[2]) { + UNUSED(times); + printf("Called non-implemented utimens(%s, _)\n", path); + return 0; +} + +int CryFuse::open(const char *path, fuse_file_info *fileinfo) { + UNUSED(fileinfo); + printf("Called non-implemented open(%s, _)\n", path); + return 0; +} + +int CryFuse::release(const char *path, fuse_file_info *fileinfo) { + UNUSED(fileinfo); + printf("Called non-implemented release(%s, _)\n", path); + return 0; +} + +int CryFuse::read(const char *path, char *buf, size_t size, off_t offset, fuse_file_info *fileinfo) { + UNUSED(buf); + UNUSED(fileinfo); + printf("Called non-implemented read(%s, _, %zu, %zu, _)\n", path, size, offset); + return 0; +} + +int CryFuse::write(const char *path, const char *buf, size_t size, off_t offset, fuse_file_info *fileinfo) { + UNUSED(buf); + UNUSED(fileinfo); + printf("Called non-implemented write(%s, _, %zu, %zu, _)\n", path, size, offset); + return 0; +} + +int CryFuse::statfs(const char *path, struct statvfs *fsstat) { + UNUSED(fsstat); + printf("Called non-implemented statfs(%s, _)\n", path); + return 0; +} + +int CryFuse::flush(const char *path, fuse_file_info *fileinfo) { + UNUSED(fileinfo); + printf("Called non-implemented flush(%s, _)\n", path); + return 0; +} + +int CryFuse::fsync(const char *path, int flags, fuse_file_info *fileinfo) { + UNUSED(fileinfo); + printf("Called non-implemented fsync(%s, %d, _)\n", path, flags); + return 0; +} + +int CryFuse::opendir(const char *path, fuse_file_info *fileinfo) { + UNUSED(fileinfo); + printf("Called non-implemented opendir(%s, _)\n", path); + return 0; +} + +int CryFuse::readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, fuse_file_info *fileinfo) { + UNUSED(buf); + UNUSED(filler); + UNUSED(fileinfo); + printf("Called non-implemented readdir(%s, _, _, %zu, _)\n", path, offset); + return 0; +} + +int CryFuse::releasedir(const char *path, fuse_file_info *fileinfo) { + UNUSED(fileinfo); + printf("Called non-implemented releasedir(%s, _)\n", path); + return 0; +} + +int CryFuse::fsyncdir(const char *path, int datasync, fuse_file_info *fileinfo) { + UNUSED(fileinfo); + printf("Called non-implemented fsyncdir(%s, %d, _)\n", path, datasync); + return 0; +} + +void* CryFuse::init(fuse_conn_info *conn) { + UNUSED(conn); + printf("Called non-implemented init()\n"); + return this; +} + +void CryFuse::destroy(void *userdata) { + UNUSED(userdata); + printf("Called non-implemented destroy()\n"); +} + +int CryFuse::access(const char *path, int mask) { + printf("Called non-implemented access(%s, %d)\n", path, mask); + return 0; +} + +int CryFuse::create(const char *path, mode_t mode, fuse_file_info *fileinfo) { + UNUSED(fileinfo); + printf("Called non-implemented create(%s, %d, _)\n", path, mode); + return 0; +} + } /* namespace cryfs */ diff --git a/src/cryfs_lib/CryFuse.h b/src/cryfs_lib/CryFuse.h index b54baecb..2196ad1f 100644 --- a/src/cryfs_lib/CryFuse.h +++ b/src/cryfs_lib/CryFuse.h @@ -8,154 +8,36 @@ namespace cryfs { class CryFuse: public fusepp::Fuse { public: - int getattr(const char *path, struct stat *stbuf) override { - printf("Called non-implemented getattr(%s, _)\n", path); - return 0; - } - - int fgetattr(const char *path, struct stat *stbuf, fuse_file_info *fileinfo) override { - printf("Called non-implemented fgetattr(%s, _, _)\n", path); - return 0; - } - - int readlink(const char *path, char *buf, size_t size) override { - printf("Called non-implemented readlink(%s, _, %d)\n", path, size); - return 0; - } - - int mknod(const char *path, mode_t mode, dev_t rdev) override { - printf("Called non-implemented mknod(%s, %d, _)\n", path, mode); - return 0; - } - - int mkdir(const char *path, mode_t mode) override { - printf("Called non-implemented mkdir(%s, %d)\n", path, mode); - return 0; - } - - int unlink(const char *path) override { - printf("Called non-implemented unlink(%s)\n", path); - return 0; - } - - int rmdir(const char *path) override { - printf("Called non-implemented rmdir(%s)\n", path); - return 0; - } - - int symlink(const char *from, const char *to) override { - printf("Called non-implemented symlink(%s, %s)\n", from, to); - return 0; - } - - int rename(const char *from, const char *to) override { - printf("Called non-implemented rename(%s, %s)\n", from, to); - return 0; - } - - int link(const char *from, const char *to) override { - printf("Called non-implemented link(%s, %s)\n", from, to); - return 0; - } - - int chmod(const char *path, mode_t mode) override { - printf("Called non-implemented chmod(%s, %d)\n", path, mode); - return 0; - } - - int chown(const char *path, uid_t uid, gid_t gid) override { - printf("Called non-implemented chown(%s, %d, %d)\n", path, uid, gid); - return 0; - } - - int truncate(const char *path, off_t size) override { - printf("Called non-implemented truncate(%s, %d)\n", path, size); - return 0; - } - - int ftruncate(const char *path, off_t size, fuse_file_info *fileinfo) override { - printf("Called non-implemented ftruncate(%s, %d)\n", path, size); - return 0; - } - - int utimens(const char *path, const timespec times[2]) override { - printf("Called non-implemented utimens(%s, _)\n", path); - return 0; - } - - int open(const char *path, fuse_file_info *fileinfo) override { - printf("Called non-implemented open(%s)\n", path); - return 0; - } - - int release(const char *path, fuse_file_info *fileinfo) override { - printf("Called non-implemented release(%s)\n", path); - return 0; - } - - int read(const char *path, char *buf, size_t size, off_t offset, fuse_file_info *fileinfo) override { - printf("Called non-implemented read(%s, _, %d, %d, _)\n", path, size, offset); - return 0; - } - - int write(const char *path, const char *buf, size_t size, off_t offset, fuse_file_info *fileinfo) override { - printf("Called non-implemented write(%s, _, %d, %d, _)\n", path, size, offset); - return 0; - } - - int statfs(const char *path, struct statvfs *fsstat) override { - printf("Called non-implemented statfs(%s)\n", path); - return 0; - } - - int flush(const char *path, fuse_file_info *fileinfo) override { - printf("Called non-implemented flush(%s)\n", path); - return 0; - } - - int fsync(const char *path, int flags, fuse_file_info *fileinfo) override { - printf("Called non-implemented fsync(%s, %d, _)\n", path, flags); - return 0; - } - - int opendir(const char *path, fuse_file_info *fileinfo) override { - printf("Called non-implemented opendir(%s, _)\n", path); - return 0; - } - - int readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, fuse_file_info *fileinfo) override { - printf("Called non-implemented readdir(%s, _, _, %d, _)\n", path, offset); - return 0; - } - - int releasedir(const char *path, fuse_file_info *fileinfo) override { - printf("Called non-implemented releasedir(%s, _)\n", path); - return 0; - } - - int fsyncdir(const char *path, int datasync, fuse_file_info *fileinfo) override { - printf("Called non-implemented fsyncdir(%s, %d, _)\n", path, datasync); - return 0; - } - - void* init(fuse_conn_info *conn) override { - printf("Called non-implemented init()\n"); - return this; - } - - void destroy(void *userdata) override { - printf("Called non-implemented destroy()\n"); - } - - int access(const char *path, int mask) override { - printf("Called non-implemented access(%s, %d)\n", path, mask); - return 0; - } - - int create(const char *path, mode_t mode, fuse_file_info *fileinfo) override { - printf("Called non-implemented create(%s, %d, _)\n", path, mode); - return 0; - } + int getattr(const char *path, struct stat *stbuf) override; + int fgetattr(const char *path, struct stat *stbuf, fuse_file_info *fileinfo) override; + int readlink(const char *path, char *buf, size_t size) override; + int mknod(const char *path, mode_t mode, dev_t rdev) override; + int mkdir(const char *path, mode_t mode) override; + int unlink(const char *path) override; + int rmdir(const char *path) override; + int symlink(const char *from, const char *to) override; + int rename(const char *from, const char *to) override; + int link(const char *from, const char *to) override; + int chmod(const char *path, mode_t mode) override; + int chown(const char *path, uid_t uid, gid_t gid) override; + int truncate(const char *path, off_t size) override; + int ftruncate(const char *path, off_t size, fuse_file_info *fileinfo) override; + int utimens(const char *path, const timespec times[2]) override; + int open(const char *path, fuse_file_info *fileinfo) override; + int release(const char *path, fuse_file_info *fileinfo) override; + int read(const char *path, char *buf, size_t size, off_t offset, fuse_file_info *fileinfo) override; + int write(const char *path, const char *buf, size_t size, off_t offset, fuse_file_info *fileinfo) override; + int statfs(const char *path, struct statvfs *fsstat) override; + int flush(const char *path, fuse_file_info *fileinfo) override; + int fsync(const char *path, int flags, fuse_file_info *fileinfo) override; + int opendir(const char *path, fuse_file_info *fileinfo) override; + int readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, fuse_file_info *fileinfo) override; + int releasedir(const char *path, fuse_file_info *fileinfo) override; + int fsyncdir(const char *path, int datasync, fuse_file_info *fileinfo) override; + void* init(fuse_conn_info *conn) override; + void destroy(void *userdata) override; + int access(const char *path, int mask) override; + int create(const char *path, mode_t mode, fuse_file_info *fileinfo) override; }; } /* namespace cryfs */