du reports correct space usage

This commit is contained in:
Sebastian Messmer 2017-02-18 13:21:24 +00:00
parent 4bcad82186
commit 19bfe97d52
7 changed files with 12 additions and 11 deletions

View File

@ -1,6 +1,7 @@
Version 0.9.8 (unreleased)
--------------
Fixed bugs:
* `du` shows correct file system size
Version 0.9.7
--------------

View File

@ -160,10 +160,10 @@ void CryNode::stat(struct ::stat *result) const {
device()->callFsActionCallbacks();
if(_parent == none) {
//We are the root directory.
//TODO What should we do?
//TODO What should we do?
result->st_uid = getuid();
result->st_gid = getgid();
result->st_mode = S_IFDIR | S_IRUSR | S_IWUSR | S_IXUSR;
result->st_mode = S_IFDIR | S_IRUSR | S_IWUSR | S_IXUSR;
result->st_size = fsblobstore::DirBlob::DIR_LSTAT_SIZE;
//TODO If possible without performance loss, then for a directory, st_nlink should return number of dir entries (including "." and "..")
result->st_nlink = 1;

View File

@ -35,8 +35,8 @@ void CryOpenFile::flush() {
void CryOpenFile::stat(struct ::stat *result) const {
_device->callFsActionCallbacks();
_parent->statChildExceptSize(_fileBlob->key(), result);
result->st_size = _fileBlob->size();
_parent->statChildWithSizeAlreadySet(_fileBlob->key(), result);
}
void CryOpenFile::truncate(off_t size) const {

View File

@ -56,8 +56,8 @@ public:
return _base->statChild(key, result);
}
void statChildExceptSize(const blockstore::Key &key, struct ::stat *result) const {
return _base->statChildExceptSize(key, result);
void statChildWithSizeAlreadySet(const blockstore::Key &key, struct ::stat *result) const {
return _base->statChildWithSizeAlreadySet(key, result);
}
void updateAccessTimestampForChild(const blockstore::Key &key) {

View File

@ -135,11 +135,11 @@ off_t DirBlob::lstat_size() const {
}
void DirBlob::statChild(const Key &key, struct ::stat *result) const {
statChildExceptSize(key, result);
result->st_size = _getLstatSize(key);
statChildWithSizeAlreadySet(key, result);
}
void DirBlob::statChildExceptSize(const Key &key, struct ::stat *result) const {
void DirBlob::statChildWithSizeAlreadySet(const Key &key, struct ::stat *result) const {
auto childOpt = GetChild(key);
if (childOpt == boost::none) {
throw fspp::fuse::FuseErrnoException(ENOENT);

View File

@ -57,7 +57,7 @@ namespace cryfs {
void statChild(const blockstore::Key &key, struct ::stat *result) const;
void statChildExceptSize(const blockstore::Key &key, struct ::stat *result) const;
void statChildWithSizeAlreadySet(const blockstore::Key &key, struct ::stat *result) const;
void updateAccessTimestampForChild(const blockstore::Key &key);

View File

@ -52,8 +52,8 @@ public:
return _base->statChild(key, result);
}
void statChildExceptSize(const blockstore::Key &key, struct ::stat *result) const {
return _base->statChildExceptSize(key, result);
void statChildWithSizeAlreadySet(const blockstore::Key &key, struct ::stat *result) const {
return _base->statChildWithSizeAlreadySet(key, result);
}
void updateAccessTimestampForChild(const blockstore::Key &key) {