libgocryptfs/internal/fusefrontend/node_helpers.go
Jakob Unterwurzacher 84344834c4 v2api: remove OpenatUserCtx, MknodatUserCtx helpers
Instead, use the new toFuseCtx() function introduced
in an earlier commit.
2020-07-11 19:44:45 +02:00

21 lines
364 B
Go

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
}