From b971c75e67c26b126a64ab8b00f416b3b573f194 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 11 Jul 2020 19:23:04 +0200 Subject: v2api: implement Mknod --- internal/syscallcompat/sys_linux.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'internal/syscallcompat/sys_linux.go') 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 { -- cgit v1.2.3