diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2014-07-15 17:41:02 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2014-07-15 17:42:44 +0200 |
commit | 978d10a42b2cfccf6bfc4df1cfad480ac3bbcb3d (patch) | |
tree | 5485f445bcf0cbf83729929ba62e4bbd1b6cc70e /lib | |
parent | 57a93b3dacbf9259178dacff5d2fbb25427f3b86 (diff) | |
download | libfuse-978d10a42b2cfccf6bfc4df1cfad480ac3bbcb3d.tar.gz |
libfuse: allow setting ctime in ->setattr()
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/fuse_lowlevel.c | 5 | ||||
-rw-r--r-- | lib/fuse_misc.h | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index dc27cb5..9131811 100755 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -79,8 +79,10 @@ static void convert_attr(const struct fuse_setattr_in *attr, struct stat *stbuf) stbuf->st_size = attr->size; stbuf->st_atime = attr->atime; stbuf->st_mtime = attr->mtime; + stbuf->st_ctime = attr->ctime; ST_ATIM_NSEC_SET(stbuf, attr->atimensec); ST_MTIM_NSEC_SET(stbuf, attr->mtimensec); + ST_CTIM_NSEC_SET(stbuf, attr->ctimensec); } static size_t iov_length(const struct iovec *iov, size_t count) @@ -1173,7 +1175,8 @@ static void do_setattr(fuse_req_t req, fuse_ino_t nodeid, const void *inarg) FUSE_SET_ATTR_ATIME | FUSE_SET_ATTR_MTIME | FUSE_SET_ATTR_ATIME_NOW | - FUSE_SET_ATTR_MTIME_NOW; + FUSE_SET_ATTR_MTIME_NOW | + FUSE_SET_ATTR_CTIME; req->f->op.setattr(req, nodeid, &stbuf, arg->valid, fi); } else diff --git a/lib/fuse_misc.h b/lib/fuse_misc.h index 8b76775..1839a67 100644 --- a/lib/fuse_misc.h +++ b/lib/fuse_misc.h @@ -28,6 +28,7 @@ static inline void fuse_mutex_init(pthread_mutex_t *mut) #define ST_CTIM_NSEC(stbuf) ((stbuf)->st_ctim.tv_nsec) #define ST_MTIM_NSEC(stbuf) ((stbuf)->st_mtim.tv_nsec) #define ST_ATIM_NSEC_SET(stbuf, val) (stbuf)->st_atim.tv_nsec = (val) +#define ST_CTIM_NSEC_SET(stbuf, val) (stbuf)->st_ctim.tv_nsec = (val) #define ST_MTIM_NSEC_SET(stbuf, val) (stbuf)->st_mtim.tv_nsec = (val) #elif defined(HAVE_STRUCT_STAT_ST_ATIMESPEC) /* FreeBSD */ @@ -35,11 +36,13 @@ static inline void fuse_mutex_init(pthread_mutex_t *mut) #define ST_CTIM_NSEC(stbuf) ((stbuf)->st_ctimespec.tv_nsec) #define ST_MTIM_NSEC(stbuf) ((stbuf)->st_mtimespec.tv_nsec) #define ST_ATIM_NSEC_SET(stbuf, val) (stbuf)->st_atimespec.tv_nsec = (val) +#define ST_CTIM_NSEC_SET(stbuf, val) (stbuf)->st_ctimespec.tv_nsec = (val) #define ST_MTIM_NSEC_SET(stbuf, val) (stbuf)->st_mtimespec.tv_nsec = (val) #else #define ST_ATIM_NSEC(stbuf) 0 #define ST_CTIM_NSEC(stbuf) 0 #define ST_MTIM_NSEC(stbuf) 0 #define ST_ATIM_NSEC_SET(stbuf, val) do { } while (0) +#define ST_CTIM_NSEC_SET(stbuf, val) do { } while (0) #define ST_MTIM_NSEC_SET(stbuf, val) do { } while (0) #endif |