summaryrefslogtreecommitdiff
path: root/internal/fusefrontend/node_helpers.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/fusefrontend/node_helpers.go')
-rw-r--r--internal/fusefrontend/node_helpers.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/fusefrontend/node_helpers.go b/internal/fusefrontend/node_helpers.go
index 1eb6d4a..a7a32af 100644
--- a/internal/fusefrontend/node_helpers.go
+++ b/internal/fusefrontend/node_helpers.go
@@ -3,6 +3,8 @@ package fusefrontend
import (
"context"
+ "github.com/hanwen/go-fuse/v2/fs"
+
"github.com/hanwen/go-fuse/v2/fuse"
)
@@ -18,3 +20,12 @@ func toFuseCtx(ctx context.Context) (ctx2 *fuse.Context) {
}
return ctx2
}
+
+// toNode casts a generic fs.InodeEmbedder into *Node. Also handles *RootNode
+// by return rn.Node.
+func toNode(op fs.InodeEmbedder) *Node {
+ if r, ok := op.(*RootNode); ok {
+ return &r.Node
+ }
+ return op.(*Node)
+}