Show current time as modification time for mountdir. This probably confuses people less than if we show timestamp zero.

This commit is contained in:
Sebastian Messmer 2016-02-26 10:47:47 +01:00
parent e48188f470
commit ab5eb920a5

View File

@ -7,6 +7,7 @@
#include "CryFile.h" #include "CryFile.h"
#include <fspp/fuse/FuseErrnoException.h> #include <fspp/fuse/FuseErrnoException.h>
#include <cpp-utils/pointer/cast.h> #include <cpp-utils/pointer/cast.h>
#include <cpp-utils/system/clock_gettime.h>
namespace bf = boost::filesystem; namespace bf = boost::filesystem;
@ -106,6 +107,19 @@ void CryNode::stat(struct ::stat *result) const {
result->st_gid = getgid(); 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; 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;
struct timespec now;
clock_gettime(CLOCK_REALTIME, &now);
#ifdef __APPLE__
result->st_atimespec = now;
result->st_mtimespec = now;
result->st_ctimespec = now;
#else
result->st_atim = now;
result->st_mtim = now;
result->st_ctim = now;
#endif
} else { } else {
(*_parent)->statChild(_key, result); (*_parent)->statChild(_key, result);
} }