summaryrefslogtreecommitdiff
path: root/internal/syscallcompat
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-07-11 19:23:04 +0200
committerJakob Unterwurzacher2020-07-11 19:23:04 +0200
commitb971c75e67c26b126a64ab8b00f416b3b573f194 (patch)
tree2413772e19270621ff31bcaf939e7d73062fb276 /internal/syscallcompat
parent855b4a95b794b9905c68afff2863138461a4be3a (diff)
v2api: implement Mknod
Diffstat (limited to 'internal/syscallcompat')
-rw-r--r--internal/syscallcompat/sys_linux.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/syscallcompat/sys_linux.go b/internal/syscallcompat/sys_linux.go
index c82480e..5a23084 100644
--- a/internal/syscallcompat/sys_linux.go
+++ b/internal/syscallcompat/sys_linux.go
@@ -136,6 +136,20 @@ func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
return syscall.Mknodat(dirfd, path, mode, dev)
}
+// MknodatUserCtx is a tries to extract a fuse.Context from the generic ctx and
+// calls OpenatUser.
+func MknodatUserCtx(dirfd int, path string, mode uint32, dev int, ctx context.Context) (err error) {
+ var ctx2 *fuse.Context
+ if ctx != nil {
+ if caller, ok := fuse.FromContext(ctx); ok {
+ ctx2 = &fuse.Context{
+ Caller: *caller,
+ }
+ }
+ }
+ return MknodatUser(dirfd, path, mode, dev, ctx2)
+}
+
// MknodatUser runs the Mknodat syscall in the context of a different user.
func MknodatUser(dirfd int, path string, mode uint32, dev int, context *fuse.Context) (err error) {
if context != nil {