Fix IdList and implement statfs()

This commit is contained in:
Sebastian Messmer 2014-11-12 22:38:12 +01:00
parent 708ca7b1d6
commit 3b376aa048
2 changed files with 9 additions and 13 deletions

View File

@ -14,15 +14,6 @@ using fusepp::path;
namespace cryfs {
namespace {
int errcode_map(int exit_status) {
if (exit_status < 0) {
return -errno;
}
return exit_status;
}
}
CryFuse::CryFuse(CryDevice *device)
:_device(device) {
}
@ -235,10 +226,13 @@ int CryFuse::write(const path &path, const char *buf, size_t size, off_t offset,
//TODO
int CryFuse::statfs(const path &path, struct statvfs *fsstat) {
printf("HALF-IMPLEMENTED: statfs(%s, _)\n", path.c_str());
auto real_path = _device->RootDir() / path;
int retstat = ::statvfs(real_path.c_str(), fsstat);
return errcode_map(retstat);
//printf("statfs(%s, _)\n", path.c_str());
try {
_device->statfs(path, fsstat);
return 0;
} catch (CryErrnoException &e) {
return -e.getErrno();
}
}
//TODO

View File

@ -11,6 +11,7 @@ namespace bf = boost::filesystem;
using namespace fusepp;
#define FUSE_OBJ ((Fuse *) fuse_get_context()->private_data)
#define UNUSED(obj) (void)obj
namespace {
int fusepp_getattr(const char *path, struct stat *stbuf) {
@ -131,6 +132,7 @@ void* fusepp_init(fuse_conn_info *conn) {
void fusepp_destroy(void *userdata) {
auto f = FUSE_OBJ;
assert(userdata == f);
UNUSED(userdata); //In the Release build, the assert doesn't run
f->destroy();
}