Sebastian Messmer df041ac845 Fix a bug where deleting a directory could leave over some blocks.
Details: Before, we allowed removing non-empty directories. Seems 'rm -rf' is trying to do that. Now, we return the correct error code ENOTEMPTY in this case, which causes that 'rm -rf' deletes the entries first.
2016-02-17 12:52:01 +01:00

31 lines
812 B
C++

#pragma once
#ifndef MESSMER_CRYFS_FILESYSTEM_CRYFILE_H_
#define MESSMER_CRYFS_FILESYSTEM_CRYFILE_H_
#include "parallelaccessfsblobstore/FileBlobRef.h"
#include "parallelaccessfsblobstore/DirBlobRef.h"
#include <fspp/fs_interface/File.h>
#include "CryNode.h"
namespace cryfs {
class CryFile final: public fspp::File, CryNode {
public:
CryFile(CryDevice *device, cpputils::unique_ref<parallelaccessfsblobstore::DirBlobRef> parent, const blockstore::Key &key);
~CryFile();
cpputils::unique_ref<fspp::OpenFile> open(int flags) const override;
void truncate(off_t size) const override;
fspp::Dir::EntryType getType() const override;
void remove() override;
private:
cpputils::unique_ref<parallelaccessfsblobstore::FileBlobRef> LoadBlob() const;
DISALLOW_COPY_AND_ASSIGN(CryFile);
};
}
#endif