From a583ff69708d23f40eec4e080b57db811f76f76d Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Tue, 9 Feb 2016 09:19:45 +0100 Subject: [PATCH] Improve utimens interface --- fs_interface/Node.h | 2 +- fuse/Filesystem.h | 2 +- fuse/Fuse.cpp | 3 +-- impl/FilesystemImpl.cpp | 4 ++-- impl/FilesystemImpl.h | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/fs_interface/Node.h b/fs_interface/Node.h index e13a50f9..650f247a 100644 --- a/fs_interface/Node.h +++ b/fs_interface/Node.h @@ -17,7 +17,7 @@ public: virtual void chown(uid_t uid, gid_t gid) = 0; virtual void access(int mask) const = 0; virtual void rename(const boost::filesystem::path &to) = 0; - virtual void utimens(const timespec times[2]) = 0; + virtual void utimens(const timespec lastAccessTime, const timespec lastModificationTime) = 0; virtual void remove() = 0; }; diff --git a/fuse/Filesystem.h b/fuse/Filesystem.h index c47dbccb..c2676ddf 100644 --- a/fuse/Filesystem.h +++ b/fuse/Filesystem.h @@ -37,7 +37,7 @@ public: virtual void rmdir(const boost::filesystem::path &path) = 0; virtual void unlink(const boost::filesystem::path &path) = 0; virtual void rename(const boost::filesystem::path &from, const boost::filesystem::path &to) = 0; - virtual void utimens(const boost::filesystem::path &path, const timespec times[2]) = 0; + virtual void utimens(const boost::filesystem::path &path, timespec lastAccessTime, timespec lastModificationTime) = 0; virtual void statfs(const boost::filesystem::path &path, struct statvfs *fsstat) = 0; //TODO We shouldn't use Dir::Entry here, that's in another layer virtual cpputils::unique_ref> readDir(const boost::filesystem::path &path) = 0; diff --git a/fuse/Fuse.cpp b/fuse/Fuse.cpp index 008d4bdc..cc3dc8ec 100644 --- a/fuse/Fuse.cpp +++ b/fuse/Fuse.cpp @@ -525,13 +525,12 @@ int Fuse::ftruncate(const bf::path &path, off_t size, fuse_file_info *fileinfo) } } -//TODO int Fuse::utimens(const bf::path &path, const timespec times[2]) { #ifdef FSPP_LOG LOG(DEBUG) << "utimens(" << path << ", _)"; #endif try { - _fs->utimens(path, times); + _fs->utimens(path, times[0], times[1]); return 0; } catch(const cpputils::AssertFailed &e) { LOG(ERROR) << "AssertFailed in Fuse::utimens: " << e.what(); diff --git a/impl/FilesystemImpl.cpp b/impl/FilesystemImpl.cpp index eacaeaa6..b975b7d2 100644 --- a/impl/FilesystemImpl.cpp +++ b/impl/FilesystemImpl.cpp @@ -290,13 +290,13 @@ unique_ref> FilesystemImpl::readDir(const bf::path &path) { return dir->children(); } -void FilesystemImpl::utimens(const bf::path &path, const timespec times[2]) { +void FilesystemImpl::utimens(const bf::path &path, timespec lastAccessTime, timespec lastModificationTime) { PROFILE(_utimensNanosec); auto node = _device->Load(path); if(node == none) { throw fuse::FuseErrnoException(ENOENT); } else { - (*node)->utimens(times); + (*node)->utimens(lastAccessTime, lastModificationTime); } } diff --git a/impl/FilesystemImpl.h b/impl/FilesystemImpl.h index 7fcb3717..052abe32 100644 --- a/impl/FilesystemImpl.h +++ b/impl/FilesystemImpl.h @@ -44,7 +44,7 @@ public: void unlink(const boost::filesystem::path &path) override; void rename(const boost::filesystem::path &from, const boost::filesystem::path &to) override; cpputils::unique_ref> readDir(const boost::filesystem::path &path) override; - void utimens(const boost::filesystem::path &path, const timespec times[2]) override; + void utimens(const boost::filesystem::path &path, timespec lastAccessTime, timespec lastModificationTime) override; void statfs(const boost::filesystem::path &path, struct statvfs *fsstat) override; void createSymlink(const boost::filesystem::path &to, const boost::filesystem::path &from, uid_t uid, gid_t gid) override; void readSymlink(const boost::filesystem::path &path, char *buf, size_t size) override;