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/ipc/BUILD | 1 + pkg/sentry/kernel/ipc/ns.go | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 pkg/sentry/kernel/ipc/ns.go (limited to 'pkg/sentry/kernel/ipc') diff --git a/pkg/sentry/kernel/ipc/BUILD b/pkg/sentry/kernel/ipc/BUILD index e42a94e15..a5cbb2b51 100644 --- a/pkg/sentry/kernel/ipc/BUILD +++ b/pkg/sentry/kernel/ipc/BUILD @@ -7,6 +7,7 @@ go_library( srcs = [ "object.go", "registry.go", + "ns.go", ], visibility = ["//pkg/sentry:internal"], deps = [ diff --git a/pkg/sentry/kernel/ipc/ns.go b/pkg/sentry/kernel/ipc/ns.go new file mode 100644 index 000000000..220c9eafb --- /dev/null +++ b/pkg/sentry/kernel/ipc/ns.go @@ -0,0 +1,22 @@ +// Copyright 2021 The gVisor Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package ipc + +type contextID int + +// CtxIPCNamespace is the context.Value key used to retreive an IPC namespace. +// We define it here because it's needed in several packages, and is not +// possible to use otherwise without causing a circular depenedency. +const CtxIPCNamespace contextID = iota -- cgit v1.2.3