Fix lstat
This commit is contained in:
parent
49a4486a40
commit
e4a0084ea3
@ -29,6 +29,12 @@ CryDir::CryDir(CryDevice *device, unique_ptr<DirBlob> blob)
|
||||
CryDir::~CryDir() {
|
||||
}
|
||||
|
||||
void CryDir::stat(struct ::stat *result) const {
|
||||
result->st_mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IWUSR;
|
||||
return;
|
||||
throw FuseErrnoException(ENOTSUP);
|
||||
}
|
||||
|
||||
unique_ptr<fspp::File> CryDir::createFile(const string &name, mode_t mode) {
|
||||
auto child = _device->CreateBlob();
|
||||
_blob->AddChild(name, child->key());
|
||||
|
1
CryDir.h
1
CryDir.h
@ -13,6 +13,7 @@ public:
|
||||
CryDir(CryDevice *device, std::unique_ptr<DirBlob> blob);
|
||||
virtual ~CryDir();
|
||||
|
||||
void stat(struct ::stat *result) const override;
|
||||
//TODO return type variance to CryFile/CryDir?
|
||||
std::unique_ptr<fspp::File> createFile(const std::string &name, mode_t mode) override;
|
||||
std::unique_ptr<fspp::Dir> createDir(const std::string &name, mode_t mode) override;
|
||||
|
@ -26,6 +26,12 @@ unique_ptr<fspp::OpenFile> CryFile::open(int flags) const {
|
||||
throw FuseErrnoException(ENOTSUP);
|
||||
}
|
||||
|
||||
void CryFile::stat(struct ::stat *result) const {
|
||||
result->st_mode = S_IFREG | S_IRUSR | S_IXUSR | S_IWUSR;
|
||||
return;
|
||||
throw FuseErrnoException(ENOTSUP);
|
||||
}
|
||||
|
||||
void CryFile::truncate(off_t size) const {
|
||||
throw FuseErrnoException(ENOTSUP);
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ public:
|
||||
CryFile(std::unique_ptr<FileBlob> blob);
|
||||
virtual ~CryFile();
|
||||
|
||||
void stat(struct ::stat *result) const override;
|
||||
std::unique_ptr<fspp::OpenFile> open(int flags) const override;
|
||||
void truncate(off_t size) const override;
|
||||
void unlink() override;
|
||||
|
15
CryNode.cpp
15
CryNode.cpp
@ -21,21 +21,6 @@ CryNode::CryNode() {
|
||||
CryNode::~CryNode() {
|
||||
}
|
||||
|
||||
void CryNode::stat(struct ::stat *result) const {
|
||||
if (dynamic_cast<const CryDir*>(this) != nullptr) {
|
||||
//printf("Stat: dir\n");
|
||||
result->st_mode = S_IFDIR;
|
||||
} else if (dynamic_cast<const CryFile*>(this) != nullptr) {
|
||||
//printf("Stat: file\n");
|
||||
result->st_mode = S_IFREG;
|
||||
} else {
|
||||
throw FuseErrnoException(EIO);
|
||||
}
|
||||
result->st_mode |= S_IRUSR | S_IXUSR | S_IWUSR;
|
||||
return;
|
||||
throw FuseErrnoException(ENOTSUP);
|
||||
}
|
||||
|
||||
void CryNode::access(int mask) const {
|
||||
return;
|
||||
throw FuseErrnoException(ENOTSUP);
|
||||
|
@ -11,14 +11,14 @@ namespace cryfs {
|
||||
|
||||
class CryNode: public virtual fspp::Node {
|
||||
public:
|
||||
CryNode();
|
||||
virtual ~CryNode();
|
||||
|
||||
void stat(struct ::stat *result) const override;
|
||||
void access(int mask) const override;
|
||||
void rename(const boost::filesystem::path &to) override;
|
||||
void utimens(const timespec times[2]) override;
|
||||
|
||||
protected:
|
||||
CryNode();
|
||||
virtual ~CryNode();
|
||||
|
||||
private:
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CryNode);
|
||||
|
Loading…
Reference in New Issue
Block a user