Fix some stuff and make getattr go through our class structure

This commit is contained in:
Sebastian Messmer 2014-11-05 01:35:41 +01:00
parent fd07c4892d
commit 9981b5aeae

View File

@ -5,6 +5,9 @@
#include <dirent.h> #include <dirent.h>
#include <cassert> #include <cassert>
#include "cryfs_lib/CryNode.h"
#include "cryfs_lib/CryErrnoException.h"
#define UNUSED(expr) (void)(expr) #define UNUSED(expr) (void)(expr)
using fusepp::path; using fusepp::path;
@ -25,11 +28,12 @@ CryFuse::CryFuse(CryDevice *device)
} }
int CryFuse::getattr(const path &path, struct stat *stbuf) { int CryFuse::getattr(const path &path, struct stat *stbuf) {
UNUSED(stbuf); try {
//printf("getattr(%s, _)\n", path.c_str()); _device->LoadFromPath(path)->stat(stbuf);
auto real_path = _device->RootDir() / path; return 0;
int retstat = lstat(real_path.c_str(), stbuf); } catch(cryfs::CryErrnoException &e) {
return errcode_map(retstat); return -e.getErrno();
}
} }
int CryFuse::fgetattr(const path &path, struct stat *stbuf, fuse_file_info *fileinfo) { int CryFuse::fgetattr(const path &path, struct stat *stbuf, fuse_file_info *fileinfo) {