From 474abe572375f1ae9efcaaa93f66df21361f27c6 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 28 Sep 2020 11:35:02 +0200 Subject: [PATCH] mount: remove unused mount.PID() Signed-off-by: Sebastiaan van Stijn --- mount/mountinfo_linux.go | 35 ------------------- mount/{mountinfo_bsd.go => mountinfo_unix.go} | 10 +----- mount/mountinfo_unsupported.go | 7 +--- 3 files changed, 2 insertions(+), 50 deletions(-) delete mode 100644 mount/mountinfo_linux.go rename mount/{mountinfo_bsd.go => mountinfo_unix.go} (76%) diff --git a/mount/mountinfo_linux.go b/mount/mountinfo_linux.go deleted file mode 100644 index 4273eadd6..000000000 --- a/mount/mountinfo_linux.go +++ /dev/null @@ -1,35 +0,0 @@ -// +build linux - -/* - Copyright The containerd 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 mount - -import ( - "github.com/moby/sys/mountinfo" -) - -// Self retrieves a list of mounts for the current running process. -func Self() ([]*Info, error) { - return mountinfo.GetMounts(nil) -} - -// PID collects the mounts for a specific process ID. If the process -// ID is unknown, it is better to use `Self` which will inspect -// "/proc/self/mountinfo" instead. -func PID(pid int) ([]*Info, error) { - return mountinfo.PidMountInfo(pid) -} diff --git a/mount/mountinfo_bsd.go b/mount/mountinfo_unix.go similarity index 76% rename from mount/mountinfo_bsd.go rename to mount/mountinfo_unix.go index 5888d0d84..cded478a8 100644 --- a/mount/mountinfo_bsd.go +++ b/mount/mountinfo_unix.go @@ -1,4 +1,4 @@ -// +build freebsd openbsd +// +build linux freebsd openbsd /* Copyright The containerd Authors. @@ -19,9 +19,6 @@ package mount import ( - "fmt" - "runtime" - "github.com/moby/sys/mountinfo" ) @@ -29,8 +26,3 @@ import ( func Self() ([]*Info, error) { return mountinfo.GetMounts(nil) } - -// PID collects the mounts for a specific process ID. -func PID(pid int) ([]*Info, error) { - return nil, fmt.Errorf("mountinfo.PID is not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) -} diff --git a/mount/mountinfo_unsupported.go b/mount/mountinfo_unsupported.go index ee3e08764..994871426 100644 --- a/mount/mountinfo_unsupported.go +++ b/mount/mountinfo_unsupported.go @@ -1,4 +1,4 @@ -// +build !linux,!freebsd,!solaris,!openbsd freebsd,!cgo solaris,!cgo openbsd,!cgo +// +build !linux,!freebsd,!openbsd /* Copyright The containerd Authors. @@ -27,8 +27,3 @@ import ( func Self() ([]*Info, error) { return nil, fmt.Errorf("mountinfo.Self is not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) } - -// PID collects the mounts for a specific process ID. -func PID(pid int) ([]*Info, error) { - return nil, fmt.Errorf("mountinfo.PID is not implemented on %s/%s", runtime.GOOS, runtime.GOARCH) -}