Skip to content

Commit

Permalink
Merge pull request #50 from noahdesu/setattr
Browse files Browse the repository at this point in the history
set attribute updates

Signed-off-by: Noah Watkins <[email protected]>
  • Loading branch information
dotnwat committed Feb 19, 2016
2 parents f8fc890 + 274ad7d commit 224f0f5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sudo: required
dist: trusty
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq libfuse-dev build-essential curl libacl1-dev
- sudo apt-get install -qq libfuse-dev build-essential curl libacl1-dev samtools
- sudo usermod -a -G fuse $USER
env:
- USE_GASNET_EVERYTHING=1
Expand Down
4 changes: 4 additions & 0 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@ sudo prove -r ../test/pjd-fstest-20090130-RC/tests/
sudo rm -rf *

sudo ../test/git.sh
sudo rm -rf *

sudo ../test/bamsort.sh
sudo rm -rf *
18 changes: 18 additions & 0 deletions gassy_fs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -571,13 +571,31 @@ int GassyFs::SetAttr(fuse_ino_t ino, FileHandle *fh, struct stat *attr,
if (uid && in->i_st.st_uid != uid)
return -EPERM;

#ifdef FUSE_SET_ATTR_MTIME_NOW
if (to_set & FUSE_SET_ATTR_MTIME_NOW)
in->i_st.st_mtime = time_now();
else
#endif
if (to_set & FUSE_SET_ATTR_MTIME)
in->i_st.st_mtime = attr->st_mtime;

#ifdef FUSE_SET_ATTR_ATIME_NOW
if (to_set & FUSE_SET_ATTR_ATIME_NOW)
in->i_st.st_atime = time_now();
else
#endif
if (to_set & FUSE_SET_ATTR_ATIME)
in->i_st.st_atime = attr->st_atime;
}

#ifdef FUSE_SET_ATTR_CTIME
if (to_set & FUSE_SET_ATTR_CTIME) {
if (uid && in->i_st.st_uid != uid)
return -EPERM;
in->i_st.st_ctime = attr->st_ctime;
}
#endif

if (to_set & FUSE_SET_ATTR_SIZE) {

if (uid) { // not root
Expand Down

0 comments on commit 224f0f5

Please sign in to comment.