summaryrefslogtreecommitdiff
path: root/internal/fusefrontend/node.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-07-05 20:05:07 +0200
committerJakob Unterwurzacher2020-07-05 20:10:53 +0200
commit63f68a0fcd514b7cf96a485016c2db23c60c3405 (patch)
treeb3c7cdb39fcec34250036a1d5cdef8321c79fe6e /internal/fusefrontend/node.go
parentc22e78ee41f4c5a91429bb83c6be3e60b4c2a20f (diff)
v2api: implement Setattr
Diffstat (limited to 'internal/fusefrontend/node.go')
-rw-r--r--internal/fusefrontend/node.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/fusefrontend/node.go b/internal/fusefrontend/node.go
index 239ec54..dae38df 100644
--- a/internal/fusefrontend/node.go
+++ b/internal/fusefrontend/node.go
@@ -266,3 +266,19 @@ func (n *Node) Open(ctx context.Context, flags uint32) (fh fs.FileHandle, fuseFl
fh = NewFile2(f, rn, &st)
return
}
+
+// Setattr - FUSE call. Called for chmod, truncate, utimens, ...
+func (n *Node) Setattr(ctx context.Context, f fs.FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) (errno syscall.Errno) {
+ var f2 *File2
+ if f != nil {
+ f2 = f.(*File2)
+ } else {
+ f, _, errno := n.Open(ctx, syscall.O_RDWR)
+ if errno != 0 {
+ return errno
+ }
+ f2 = f.(*File2)
+ defer f2.Release()
+ }
+ return f2.Setattr(ctx, in, out)
+}