From 63f68a0fcd514b7cf96a485016c2db23c60c3405 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 5 Jul 2020 20:05:07 +0200 Subject: v2api: implement Setattr --- internal/fusefrontend/node.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'internal/fusefrontend/node.go') 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) +} -- cgit v1.2.3