Refine interface

This commit is contained in:
Sebastian Messmer 2014-11-04 18:34:33 +01:00
parent a5f293e0f8
commit 24b81dab7b
4 changed files with 13 additions and 10 deletions

View File

@ -156,14 +156,12 @@ int CryFuse::fsyncdir(const char *path, int datasync, fuse_file_info *fileinfo)
return 0;
}
void* CryFuse::init(fuse_conn_info *conn) {
void CryFuse::init(fuse_conn_info *conn) {
UNUSED(conn);
printf("Called non-implemented init()\n");
return this;
}
void CryFuse::destroy(void *userdata) {
UNUSED(userdata);
void CryFuse::destroy() {
printf("Called non-implemented destroy()\n");
}

View File

@ -34,8 +34,8 @@ public:
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;
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;
};

View File

@ -1,5 +1,6 @@
#include "../fusepp/Fuse.h"
#include <memory>
#include <cassert>
using std::unique_ptr;
using std::make_unique;
@ -120,11 +121,15 @@ int fsyncdir(const char *path, int datasync, fuse_file_info *fileinfo) {
}
void* init(fuse_conn_info *conn) {
return FUSE_OBJ->init(conn);
auto f = FUSE_OBJ;
f->init(conn);
return f;
}
void destroy(void *userdata) {
return FUSE_OBJ->destroy(userdata);
auto f = FUSE_OBJ;
assert(userdata == f);
f->destroy();
}
int access(const char *path, int mask) {

View File

@ -44,8 +44,8 @@ public:
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 void* init(fuse_conn_info *conn) = 0;
virtual void destroy(void *userdata) = 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;
};