Use boost::filesystem::path
This commit is contained in:
parent
24b81dab7b
commit
d38480b234
@ -2,4 +2,4 @@ add_subdirectory(fusepp)
|
||||
|
||||
add_library(cryfs_lib CryDevice.cpp CryFuse.cpp)
|
||||
|
||||
target_link_libraries(cryfs_lib fusepp)
|
||||
target_link_libraries(cryfs_lib fusepp boost_filesystem boost_system)
|
||||
|
@ -1,178 +1,192 @@
|
||||
#include "CryFuse.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <cassert>
|
||||
|
||||
#define UNUSED(expr) (void)(expr)
|
||||
|
||||
using fusepp::path;
|
||||
|
||||
namespace cryfs {
|
||||
|
||||
int CryFuse::getattr(const char *path, struct stat *stbuf) {
|
||||
int CryFuse::getattr(const path &path, struct stat *stbuf) {
|
||||
UNUSED(stbuf);
|
||||
printf("Called non-implemented getattr(%s, _)\n", path);
|
||||
return 0;
|
||||
int retstat = lstat(path.c_str(), stbuf);
|
||||
if (retstat != 0) {
|
||||
retstat = -errno;
|
||||
}
|
||||
return retstat;
|
||||
}
|
||||
|
||||
int CryFuse::fgetattr(const char *path, struct stat *stbuf, fuse_file_info *fileinfo) {
|
||||
int CryFuse::fgetattr(const path &path, struct stat *stbuf, fuse_file_info *fileinfo) {
|
||||
UNUSED(stbuf);
|
||||
UNUSED(fileinfo);
|
||||
printf("Called non-implemented fgetattr(%s, _, _)\n", path);
|
||||
printf("Called non-implemented fgetattr(%s, _, _)\n", path.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::readlink(const char *path, char *buf, size_t size) {
|
||||
int CryFuse::readlink(const path &path, char *buf, size_t size) {
|
||||
UNUSED(buf);
|
||||
printf("Called non-implemented readlink(%s, _, %zu)\n", path, size);
|
||||
printf("Called non-implemented readlink(%s, _, %zu)\n", path.c_str(), size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::mknod(const char *path, mode_t mode, dev_t rdev) {
|
||||
int CryFuse::mknod(const path &path, mode_t mode, dev_t rdev) {
|
||||
UNUSED(rdev);
|
||||
printf("Called non-implemented mknod(%s, %d, _)\n", path, mode);
|
||||
printf("Called non-implemented mknod(%s, %d, _)\n", path.c_str(), mode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::mkdir(const char *path, mode_t mode) {
|
||||
printf("Called non-implemented mkdir(%s, %d)\n", path, mode);
|
||||
int CryFuse::mkdir(const path &path, mode_t mode) {
|
||||
printf("Called non-implemented mkdir(%s, %d)\n", path.c_str(), mode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::unlink(const char *path) {
|
||||
printf("Called non-implemented unlink(%s)\n", path);
|
||||
int CryFuse::unlink(const path &path) {
|
||||
printf("Called non-implemented unlink(%s)\n", path.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::rmdir(const char *path) {
|
||||
printf("Called non-implemented rmdir(%s)\n", path);
|
||||
int CryFuse::rmdir(const path &path) {
|
||||
printf("Called non-implemented rmdir(%s)\n", path.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::symlink(const char *from, const char *to) {
|
||||
printf("Called non-implemented symlink(%s, %s)\n", from, to);
|
||||
int CryFuse::symlink(const path &from, const path &to) {
|
||||
printf("Called non-implemented symlink(%s, %s)\n", from.c_str(), to.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::rename(const char *from, const char *to) {
|
||||
printf("Called non-implemented rename(%s, %s)\n", from, to);
|
||||
int CryFuse::rename(const path &from, const path &to) {
|
||||
printf("Called non-implemented rename(%s, %s)\n", from.c_str(), to.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::link(const char *from, const char *to) {
|
||||
printf("Called non-implemented link(%s, %s)\n", from, to);
|
||||
int CryFuse::link(const path &from, const path &to) {
|
||||
printf("Called non-implemented link(%s, %s)\n", from.c_str(), to.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::chmod(const char *path, mode_t mode) {
|
||||
printf("Called non-implemented chmod(%s, %d)\n", path, mode);
|
||||
int CryFuse::chmod(const path &path, mode_t mode) {
|
||||
printf("Called non-implemented chmod(%s, %d)\n", path.c_str(), 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);
|
||||
int CryFuse::chown(const path &path, uid_t uid, gid_t gid) {
|
||||
printf("Called non-implemented chown(%s, %d, %d)\n", path.c_str(), uid, gid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::truncate(const char *path, off_t size) {
|
||||
printf("Called non-implemented truncate(%s, %zu)\n", path, size);
|
||||
int CryFuse::truncate(const path &path, off_t size) {
|
||||
printf("Called non-implemented truncate(%s, %zu)\n", path.c_str(), size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::ftruncate(const char *path, off_t size, fuse_file_info *fileinfo) {
|
||||
int CryFuse::ftruncate(const path &path, off_t size, fuse_file_info *fileinfo) {
|
||||
UNUSED(fileinfo);
|
||||
printf("Called non-implemented ftruncate(%s, %zu, _)\n", path, size);
|
||||
printf("Called non-implemented ftruncate(%s, %zu, _)\n", path.c_str(), size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::utimens(const char *path, const timespec times[2]) {
|
||||
int CryFuse::utimens(const path &path, const timespec times[2]) {
|
||||
UNUSED(times);
|
||||
printf("Called non-implemented utimens(%s, _)\n", path);
|
||||
printf("Called non-implemented utimens(%s, _)\n", path.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::open(const char *path, fuse_file_info *fileinfo) {
|
||||
int CryFuse::open(const path &path, fuse_file_info *fileinfo) {
|
||||
UNUSED(fileinfo);
|
||||
printf("Called non-implemented open(%s, _)\n", path);
|
||||
printf("Called non-implemented open(%s, _)\n", path.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::release(const char *path, fuse_file_info *fileinfo) {
|
||||
int CryFuse::release(const path &path, fuse_file_info *fileinfo) {
|
||||
UNUSED(fileinfo);
|
||||
printf("Called non-implemented release(%s, _)\n", path);
|
||||
printf("Called non-implemented release(%s, _)\n", path.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::read(const char *path, char *buf, size_t size, off_t offset, fuse_file_info *fileinfo) {
|
||||
int CryFuse::read(const path &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);
|
||||
printf("Called non-implemented read(%s, _, %zu, %zu, _)\n", path.c_str(), size, offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::write(const char *path, const char *buf, size_t size, off_t offset, fuse_file_info *fileinfo) {
|
||||
int CryFuse::write(const path &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);
|
||||
printf("Called non-implemented write(%s, _, %zu, %zu, _)\n", path.c_str(), size, offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::statfs(const char *path, struct statvfs *fsstat) {
|
||||
int CryFuse::statfs(const path &path, struct statvfs *fsstat) {
|
||||
UNUSED(fsstat);
|
||||
printf("Called non-implemented statfs(%s, _)\n", path);
|
||||
printf("Called non-implemented statfs(%s, _)\n", path.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::flush(const char *path, fuse_file_info *fileinfo) {
|
||||
int CryFuse::flush(const path &path, fuse_file_info *fileinfo) {
|
||||
UNUSED(fileinfo);
|
||||
printf("Called non-implemented flush(%s, _)\n", path);
|
||||
printf("Called non-implemented flush(%s, _)\n", path.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::fsync(const char *path, int flags, fuse_file_info *fileinfo) {
|
||||
int CryFuse::fsync(const path &path, int flags, fuse_file_info *fileinfo) {
|
||||
UNUSED(fileinfo);
|
||||
printf("Called non-implemented fsync(%s, %d, _)\n", path, flags);
|
||||
printf("Called non-implemented fsync(%s, %d, _)\n", path.c_str(), 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::opendir(const path &path, fuse_file_info *fileinfo) {
|
||||
DIR *dp = ::opendir(path.c_str());
|
||||
int retstat = 0;
|
||||
if (dp == nullptr) {
|
||||
retstat = -errno;
|
||||
}
|
||||
fileinfo->fh = (intptr_t)dp;
|
||||
printf("opendir(%s, _)\n", path.c_str());
|
||||
return retstat;
|
||||
}
|
||||
|
||||
int CryFuse::readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, fuse_file_info *fileinfo) {
|
||||
int CryFuse::readdir(const path &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);
|
||||
printf("Called non-implemented readdir(%s, _, _, %zu, _)\n", path.c_str(), offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::releasedir(const char *path, fuse_file_info *fileinfo) {
|
||||
int CryFuse::releasedir(const path &path, fuse_file_info *fileinfo) {
|
||||
UNUSED(fileinfo);
|
||||
printf("Called non-implemented releasedir(%s, _)\n", path);
|
||||
printf("Called non-implemented releasedir(%s, _)\n", path.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::fsyncdir(const char *path, int datasync, fuse_file_info *fileinfo) {
|
||||
int CryFuse::fsyncdir(const path &path, int datasync, fuse_file_info *fileinfo) {
|
||||
UNUSED(fileinfo);
|
||||
printf("Called non-implemented fsyncdir(%s, %d, _)\n", path, datasync);
|
||||
printf("Called non-implemented fsyncdir(%s, %d, _)\n", path.c_str(), datasync);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CryFuse::init(fuse_conn_info *conn) {
|
||||
UNUSED(conn);
|
||||
printf("Called non-implemented init()\n");
|
||||
printf("init()\n");
|
||||
}
|
||||
|
||||
void CryFuse::destroy() {
|
||||
printf("Called non-implemented destroy()\n");
|
||||
printf("destroy()\n");
|
||||
}
|
||||
|
||||
int CryFuse::access(const char *path, int mask) {
|
||||
printf("Called non-implemented access(%s, %d)\n", path, mask);
|
||||
int CryFuse::access(const path &path, int mask) {
|
||||
printf("Called non-implemented access(%s, %d)\n", path.c_str(), mask);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CryFuse::create(const char *path, mode_t mode, fuse_file_info *fileinfo) {
|
||||
int CryFuse::create(const path &path, mode_t mode, fuse_file_info *fileinfo) {
|
||||
UNUSED(fileinfo);
|
||||
printf("Called non-implemented create(%s, %d, _)\n", path, mode);
|
||||
printf("Called non-implemented create(%s, %d, _)\n", path.c_str(), mode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -8,36 +8,36 @@ namespace cryfs {
|
||||
|
||||
class CryFuse: public fusepp::Fuse {
|
||||
public:
|
||||
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;
|
||||
int getattr(const fusepp::path &path, struct stat *stbuf) override;
|
||||
int fgetattr(const fusepp::path &path, struct stat *stbuf, fuse_file_info *fileinfo) override;
|
||||
int readlink(const fusepp::path &path, char *buf, size_t size) override;
|
||||
int mknod(const fusepp::path &path, mode_t mode, dev_t rdev) override;
|
||||
int mkdir(const fusepp::path &path, mode_t mode) override;
|
||||
int unlink(const fusepp::path &path) override;
|
||||
int rmdir(const fusepp::path &path) override;
|
||||
int symlink(const fusepp::path &from, const fusepp::path &to) override;
|
||||
int rename(const fusepp::path &from, const fusepp::path &to) override;
|
||||
int link(const fusepp::path &from, const fusepp::path &to) override;
|
||||
int chmod(const fusepp::path &path, mode_t mode) override;
|
||||
int chown(const fusepp::path &path, uid_t uid, gid_t gid) override;
|
||||
int truncate(const fusepp::path &path, off_t size) override;
|
||||
int ftruncate(const fusepp::path &path, off_t size, fuse_file_info *fileinfo) override;
|
||||
int utimens(const fusepp::path &path, const timespec times[2]) override;
|
||||
int open(const fusepp::path &path, fuse_file_info *fileinfo) override;
|
||||
int release(const fusepp::path &path, fuse_file_info *fileinfo) override;
|
||||
int read(const fusepp::path &path, char *buf, size_t size, off_t offset, fuse_file_info *fileinfo) override;
|
||||
int write(const fusepp::path &path, const char *buf, size_t size, off_t offset, fuse_file_info *fileinfo) override;
|
||||
int statfs(const fusepp::path &path, struct statvfs *fsstat) override;
|
||||
int flush(const fusepp::path &path, fuse_file_info *fileinfo) override;
|
||||
int fsync(const fusepp::path &path, int flags, fuse_file_info *fileinfo) override;
|
||||
int opendir(const fusepp::path &path, fuse_file_info *fileinfo) override;
|
||||
int readdir(const fusepp::path &path, void *buf, fuse_fill_dir_t filler, off_t offset, fuse_file_info *fileinfo) override;
|
||||
int releasedir(const fusepp::path &path, fuse_file_info *fileinfo) override;
|
||||
int fsyncdir(const fusepp::path &path, int datasync, fuse_file_info *fileinfo) override;
|
||||
void init(fuse_conn_info *conn) override;
|
||||
void destroy() override;
|
||||
int access(const char *path, int mask) override;
|
||||
int create(const char *path, mode_t mode, fuse_file_info *fileinfo) override;
|
||||
int access(const fusepp::path &path, int mask) override;
|
||||
int create(const fusepp::path &path, mode_t mode, fuse_file_info *fileinfo) override;
|
||||
};
|
||||
|
||||
} /* namespace cryfs */
|
||||
|
@ -6,97 +6,99 @@ using std::unique_ptr;
|
||||
using std::make_unique;
|
||||
using std::string;
|
||||
|
||||
namespace bf = boost::filesystem;
|
||||
|
||||
using namespace fusepp;
|
||||
|
||||
#define FUSE_OBJ ((Fuse *) fuse_get_context()->private_data)
|
||||
|
||||
namespace {
|
||||
int getattr(const char *path, struct stat *stbuf) {
|
||||
return FUSE_OBJ->getattr(path, stbuf);
|
||||
return FUSE_OBJ->getattr(bf::path(path), stbuf);
|
||||
}
|
||||
|
||||
int fgetattr(const char *path, struct stat *stbuf, fuse_file_info *fileinfo) {
|
||||
return FUSE_OBJ->fgetattr(path, stbuf, fileinfo);
|
||||
return FUSE_OBJ->fgetattr(bf::path(path), stbuf, fileinfo);
|
||||
}
|
||||
|
||||
int readlink(const char *path, char *buf, size_t size) {
|
||||
return FUSE_OBJ->readlink(path, buf, size);
|
||||
return FUSE_OBJ->readlink(bf::path(path), buf, size);
|
||||
}
|
||||
|
||||
int mknod(const char *path, mode_t mode, dev_t rdev) {
|
||||
return FUSE_OBJ->mknod(path, mode, rdev);
|
||||
return FUSE_OBJ->mknod(bf::path(path), mode, rdev);
|
||||
}
|
||||
|
||||
int mkdir(const char *path, mode_t mode) {
|
||||
return FUSE_OBJ->mkdir(path, mode);
|
||||
return FUSE_OBJ->mkdir(bf::path(path), mode);
|
||||
}
|
||||
|
||||
int unlink(const char *path) {
|
||||
return FUSE_OBJ->unlink(path);
|
||||
return FUSE_OBJ->unlink(bf::path(path));
|
||||
}
|
||||
|
||||
int rmdir(const char *path) {
|
||||
return FUSE_OBJ->rmdir(path);
|
||||
return FUSE_OBJ->rmdir(bf::path(path));
|
||||
}
|
||||
|
||||
int symlink(const char *from, const char *to) {
|
||||
return FUSE_OBJ->symlink(from, to);
|
||||
return FUSE_OBJ->symlink(bf::path(from), bf::path(to));
|
||||
}
|
||||
|
||||
int rename(const char *from, const char *to) {
|
||||
return FUSE_OBJ->rename(from, to);
|
||||
return FUSE_OBJ->rename(bf::path(from), bf::path(to));
|
||||
}
|
||||
|
||||
int link(const char *from, const char *to) {
|
||||
return FUSE_OBJ->link(from, to);
|
||||
return FUSE_OBJ->link(bf::path(from), bf::path(to));
|
||||
}
|
||||
|
||||
int chmod(const char *path, mode_t mode) {
|
||||
return FUSE_OBJ->chmod(path, mode);
|
||||
return FUSE_OBJ->chmod(bf::path(path), mode);
|
||||
}
|
||||
|
||||
int chown(const char *path, uid_t uid, gid_t gid) {
|
||||
return FUSE_OBJ->chown(path, uid, gid);
|
||||
return FUSE_OBJ->chown(bf::path(path), uid, gid);
|
||||
}
|
||||
|
||||
int truncate(const char *path, off_t size) {
|
||||
return FUSE_OBJ->truncate(path, size);
|
||||
return FUSE_OBJ->truncate(bf::path(path), size);
|
||||
}
|
||||
|
||||
int ftruncate(const char *path, off_t size, fuse_file_info *fileinfo) {
|
||||
return FUSE_OBJ->ftruncate(path, size, fileinfo);
|
||||
return FUSE_OBJ->ftruncate(bf::path(path), size, fileinfo);
|
||||
}
|
||||
|
||||
int utimens(const char *path, const timespec times[2]) {
|
||||
return FUSE_OBJ->utimens(path, times);
|
||||
return FUSE_OBJ->utimens(bf::path(path), times);
|
||||
}
|
||||
|
||||
int open(const char *path, fuse_file_info *fileinfo) {
|
||||
return FUSE_OBJ->open(path, fileinfo);
|
||||
return FUSE_OBJ->open(bf::path(path), fileinfo);
|
||||
}
|
||||
|
||||
int release(const char *path, fuse_file_info *fileinfo) {
|
||||
return FUSE_OBJ->release(path, fileinfo);
|
||||
return FUSE_OBJ->release(bf::path(path), fileinfo);
|
||||
}
|
||||
|
||||
int read(const char *path, char *buf, size_t size, off_t offset, fuse_file_info *fileinfo) {
|
||||
return FUSE_OBJ->read(path, buf, size, offset, fileinfo);
|
||||
return FUSE_OBJ->read(bf::path(path), buf, size, offset, fileinfo);
|
||||
}
|
||||
|
||||
int write(const char *path, const char *buf, size_t size, off_t offset, fuse_file_info *fileinfo) {
|
||||
return FUSE_OBJ->write(path, buf, size, offset, fileinfo);
|
||||
return FUSE_OBJ->write(bf::path(path), buf, size, offset, fileinfo);
|
||||
}
|
||||
|
||||
int statfs(const char *path, struct statvfs *fsstat) {
|
||||
return FUSE_OBJ->statfs(path, fsstat);
|
||||
return FUSE_OBJ->statfs(bf::path(path), fsstat);
|
||||
}
|
||||
|
||||
int flush(const char *path, fuse_file_info *fileinfo) {
|
||||
return FUSE_OBJ->flush(path, fileinfo);
|
||||
return FUSE_OBJ->flush(bf::path(path), fileinfo);
|
||||
}
|
||||
|
||||
int fsync(const char *path, int flags, fuse_file_info *fileinfo) {
|
||||
return FUSE_OBJ->fsync(path, flags, fileinfo);
|
||||
return FUSE_OBJ->fsync(bf::path(path), flags, fileinfo);
|
||||
}
|
||||
|
||||
//int setxattr(const char*, const char*, const char*, size_t, int)
|
||||
@ -105,19 +107,19 @@ int fsync(const char *path, int flags, fuse_file_info *fileinfo) {
|
||||
//int removexattr(const char*, const char*)
|
||||
|
||||
int opendir(const char *path, fuse_file_info *fileinfo) {
|
||||
return FUSE_OBJ->opendir(path, fileinfo);
|
||||
return FUSE_OBJ->opendir(bf::path(path), fileinfo);
|
||||
}
|
||||
|
||||
int readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, fuse_file_info *fileinfo) {
|
||||
return FUSE_OBJ->readdir(path, buf, filler, offset, fileinfo);
|
||||
return FUSE_OBJ->readdir(bf::path(path), buf, filler, offset, fileinfo);
|
||||
}
|
||||
|
||||
int releasedir(const char *path, fuse_file_info *fileinfo) {
|
||||
return FUSE_OBJ->releasedir(path, fileinfo);
|
||||
return FUSE_OBJ->releasedir(bf::path(path), fileinfo);
|
||||
}
|
||||
|
||||
int fsyncdir(const char *path, int datasync, fuse_file_info *fileinfo) {
|
||||
return FUSE_OBJ->fsyncdir(path, datasync, fileinfo);
|
||||
return FUSE_OBJ->fsyncdir(bf::path(path), datasync, fileinfo);
|
||||
}
|
||||
|
||||
void* init(fuse_conn_info *conn) {
|
||||
@ -133,11 +135,11 @@ void destroy(void *userdata) {
|
||||
}
|
||||
|
||||
int access(const char *path, int mask) {
|
||||
return FUSE_OBJ->access(path, mask);
|
||||
return FUSE_OBJ->access(bf::path(path), mask);
|
||||
}
|
||||
|
||||
int create(const char *path, mode_t mode, fuse_file_info *fileinfo) {
|
||||
return FUSE_OBJ->create(path, mode, fileinfo);
|
||||
return FUSE_OBJ->create(bf::path(path), mode, fileinfo);
|
||||
}
|
||||
|
||||
/*int lock(const char*, fuse_file_info*, int cmd, flock*)
|
||||
|
@ -7,8 +7,12 @@
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <sys/stat.h>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
namespace fusepp {
|
||||
|
||||
typedef boost::filesystem::path path;
|
||||
|
||||
//TODO If performance suffers here, we could use template<class FuseImpl>
|
||||
// and redirect the fuse calls directly to the FuseImpl class instead
|
||||
// of using virtual functions.
|
||||
@ -18,36 +22,36 @@ public:
|
||||
|
||||
void run(int argc, char **argv);
|
||||
|
||||
virtual int getattr(const char *path, struct stat *stbuf) = 0;
|
||||
virtual int fgetattr(const char *path, struct stat *stbuf, fuse_file_info *fileinfo) = 0;
|
||||
virtual int readlink(const char *path, char *buf, size_t size) = 0;
|
||||
virtual int mknod(const char *path, mode_t mode, dev_t rdev) = 0;
|
||||
virtual int mkdir(const char *path, mode_t mode) = 0;
|
||||
virtual int unlink(const char *path) = 0;
|
||||
virtual int rmdir(const char *path) = 0;
|
||||
virtual int symlink(const char *from, const char *to) = 0;
|
||||
virtual int rename(const char *from, const char *to) = 0;
|
||||
virtual int link(const char *from, const char *to) = 0;
|
||||
virtual int chmod(const char *path, mode_t mode) = 0;
|
||||
virtual int chown(const char *path, uid_t uid, gid_t gid) = 0;
|
||||
virtual int truncate(const char *path, off_t size) = 0;
|
||||
virtual int ftruncate(const char *path, off_t size, fuse_file_info *fileinfo) = 0;
|
||||
virtual int utimens(const char *path, const timespec times[2]) = 0;
|
||||
virtual int open(const char *path, fuse_file_info *fileinfo) = 0;
|
||||
virtual int release(const char *path, fuse_file_info *fileinfo) = 0;
|
||||
virtual int read(const char *path, char *buf, size_t size, off_t offset, fuse_file_info *fileinfo) = 0;
|
||||
virtual int write(const char *path, const char *buf, size_t size, off_t offset, fuse_file_info *fileinfo) = 0;
|
||||
virtual int statfs(const char *path, struct statvfs *fsstat) = 0;
|
||||
virtual int flush(const char *path, fuse_file_info *fileinfo) = 0;
|
||||
virtual int fsync(const char *path, int flags, fuse_file_info *fileinfo) = 0;
|
||||
virtual int opendir(const char *path, fuse_file_info *fileinfo) = 0;
|
||||
virtual int readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, fuse_file_info *fileinfo) = 0;
|
||||
virtual int releasedir(const char *path, fuse_file_info *fileinfo) = 0;
|
||||
virtual int fsyncdir(const char *path, int datasync, fuse_file_info *fileinfo) = 0;
|
||||
virtual int getattr(const path &path, struct stat *stbuf) = 0;
|
||||
virtual int fgetattr(const path &path, struct stat *stbuf, fuse_file_info *fileinfo) = 0;
|
||||
virtual int readlink(const path &path, char *buf, size_t size) = 0;
|
||||
virtual int mknod(const path &path, mode_t mode, dev_t rdev) = 0;
|
||||
virtual int mkdir(const path &path, mode_t mode) = 0;
|
||||
virtual int unlink(const path &path) = 0;
|
||||
virtual int rmdir(const path &path) = 0;
|
||||
virtual int symlink(const path &from, const path &to) = 0;
|
||||
virtual int rename(const path &from, const path &to) = 0;
|
||||
virtual int link(const path &from, const path &to) = 0;
|
||||
virtual int chmod(const path &path, mode_t mode) = 0;
|
||||
virtual int chown(const path &path, uid_t uid, gid_t gid) = 0;
|
||||
virtual int truncate(const path &path, off_t size) = 0;
|
||||
virtual int ftruncate(const path &path, off_t size, fuse_file_info *fileinfo) = 0;
|
||||
virtual int utimens(const path &path, const timespec times[2]) = 0;
|
||||
virtual int open(const path &path, fuse_file_info *fileinfo) = 0;
|
||||
virtual int release(const path &path, fuse_file_info *fileinfo) = 0;
|
||||
virtual int read(const path &path, char *buf, size_t size, off_t offset, fuse_file_info *fileinfo) = 0;
|
||||
virtual int write(const path &path, const char *buf, size_t size, off_t offset, fuse_file_info *fileinfo) = 0;
|
||||
virtual int statfs(const path &path, struct statvfs *fsstat) = 0;
|
||||
virtual int flush(const path &path, fuse_file_info *fileinfo) = 0;
|
||||
virtual int fsync(const path &path, int flags, fuse_file_info *fileinfo) = 0;
|
||||
virtual int opendir(const path &path, fuse_file_info *fileinfo) = 0;
|
||||
virtual int readdir(const path &path, void *buf, fuse_fill_dir_t filler, off_t offset, fuse_file_info *fileinfo) = 0;
|
||||
virtual int releasedir(const path &path, fuse_file_info *fileinfo) = 0;
|
||||
virtual int fsyncdir(const path &path, int datasync, fuse_file_info *fileinfo) = 0;
|
||||
virtual void init(fuse_conn_info *conn) = 0;
|
||||
virtual void destroy() = 0;
|
||||
virtual int access(const char *path, int mask) = 0;
|
||||
virtual int create(const char *path, mode_t mode, fuse_file_info *fileinfo) = 0;
|
||||
virtual int access(const path &path, int mask) = 0;
|
||||
virtual int create(const path &path, mode_t mode, fuse_file_info *fileinfo) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user