package fusefrontend import ( "context" "github.com/hanwen/go-fuse/v2/fs" "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 } // toNode casts a generic fs.InodeEmbedder into *Node. Also handles *RootNode // by return rn.Node. func toNode(op fs.InodeEmbedder) *Node { if r, ok := op.(*RootNode); ok { return &r.Node } return op.(*Node) }