summaryrefslogtreecommitdiff
path: root/internal/fusefrontend/node_helpers.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-07-11 19:44:45 +0200
committerJakob Unterwurzacher2020-07-11 19:44:45 +0200
commit84344834c4fb49c2eb484bcc43d24a2522b1b5c1 (patch)
tree3330c70ad66dec26ab0a7a702eee1d8f8f22acd5 /internal/fusefrontend/node_helpers.go
parent250dbc64362265beace368b62f5a6656908a2e84 (diff)
v2api: remove OpenatUserCtx, MknodatUserCtx helpers
Instead, use the new toFuseCtx() function introduced in an earlier commit.
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
+}