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.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/internal/fusefrontend/node_helpers.go b/internal/fusefrontend/node_helpers.go
new file mode 100644
index 0000000..1eb6d4a
--- /dev/null
+++ b/internal/fusefrontend/node_helpers.go
@@ -0,0 +1,20 @@
+package fusefrontend
+
+import (
+ "context"
+
+ "github.com/hanwen/go-fuse/v2/fuse"
+)
+
+// toFuseCtx tries to extract a fuse.Context from a generic context.Context.
+func toFuseCtx(ctx context.Context) (ctx2 *fuse.Context) {
+ if ctx == nil {
+ return nil
+ }
+ if caller, ok := fuse.FromContext(ctx); ok {
+ ctx2 = &fuse.Context{
+ Caller: *caller,
+ }
+ }
+ return ctx2
+}