From bcef079ec24d56d37a670c4c4149c638be6fb110 Mon Sep 17 00:00:00 2001 From: "Zyad A. Ali" Date: Wed, 11 Aug 2021 21:24:10 +0200 Subject: Move CtxIPCNamespace to kernel/ipc package. CtxIPCNamespace is needed by mqfs package to be able to retreive an IPCNamespace using ctx.Value. As ctx.Value compares keys as interfaces, we need to use type kernel.contextID in package mqfs, which is not possible due to circular depenedency, so move it to kernel/ipc instead. Updates #136 --- pkg/sentry/kernel/context.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'pkg/sentry/kernel/context.go') diff --git a/pkg/sentry/kernel/context.go b/pkg/sentry/kernel/context.go index a8596410f..7e11c6580 100644 --- a/pkg/sentry/kernel/context.go +++ b/pkg/sentry/kernel/context.go @@ -16,6 +16,7 @@ package kernel import ( "gvisor.dev/gvisor/pkg/context" + "gvisor.dev/gvisor/pkg/sentry/kernel/ipc" ) // contextID is the kernel package's type for context.Context.Value keys. @@ -37,9 +38,6 @@ const ( // CtxUTSNamespace is a Context.Value key for a UTSNamespace. CtxUTSNamespace - - // CtxIPCNamespace is a Context.Value key for a IPCNamespace. - CtxIPCNamespace ) // ContextCanTrace returns true if ctx is permitted to trace t, in the same sense @@ -82,7 +80,7 @@ func UTSNamespaceFromContext(ctx context.Context) *UTSNamespace { // or nil if there is no such IPC namespace. It takes a reference on the // namespace. func IPCNamespaceFromContext(ctx context.Context) *IPCNamespace { - if v := ctx.Value(CtxIPCNamespace); v != nil { + if v := ctx.Value(ipc.CtxIPCNamespace); v != nil { return v.(*IPCNamespace) } return nil -- cgit v1.2.3