diff --git a/sys/mount_linux.go b/mount/fmountat_linux.go similarity index 99% rename from sys/mount_linux.go rename to mount/fmountat_linux.go index a21045529..45732488d 100644 --- a/sys/mount_linux.go +++ b/mount/fmountat_linux.go @@ -14,7 +14,7 @@ limitations under the License. */ -package sys +package mount import ( "runtime" diff --git a/sys/mount_linux_test.go b/mount/fmountat_linux_test.go similarity index 99% rename from sys/mount_linux_test.go rename to mount/fmountat_linux_test.go index 38745f497..4f25acf9b 100644 --- a/sys/mount_linux_test.go +++ b/mount/fmountat_linux_test.go @@ -14,7 +14,7 @@ limitations under the License. */ -package sys +package mount import ( "io/ioutil" @@ -32,7 +32,7 @@ import ( type fMountatCaseFunc func(t *testing.T, root string) func TestFMountat(t *testing.T) { - if !runningPrivileged() { + if unix.Geteuid() != 0 { t.Skip("Needs to be run as root") return } diff --git a/mount/mount_linux.go b/mount/mount_linux.go index 3f05ebc89..e0e066b31 100644 --- a/mount/mount_linux.go +++ b/mount/mount_linux.go @@ -24,7 +24,6 @@ import ( "strings" "time" - "github.com/containerd/containerd/sys" "github.com/pkg/errors" "golang.org/x/sys/unix" ) @@ -378,7 +377,7 @@ func mountAt(chdir string, source, target, fstype string, flags uintptr, data st if !fs.IsDir() { return errors.Wrap(errors.Errorf("%s is not dir", chdir), "failed to mountat") } - return errors.Wrap(sys.FMountat(f.Fd(), source, target, fstype, flags, data), "failed to mountat") + return errors.Wrap(FMountat(f.Fd(), source, target, fstype, flags, data), "failed to mountat") } func (m *Mount) mountWithHelper(helperBinary, typePrefix, target string) error { diff --git a/sys/subprocess_unsafe_linux.go b/mount/subprocess_unsafe_linux.go similarity index 98% rename from sys/subprocess_unsafe_linux.go rename to mount/subprocess_unsafe_linux.go index 6e40a9c7d..c7cb0c034 100644 --- a/sys/subprocess_unsafe_linux.go +++ b/mount/subprocess_unsafe_linux.go @@ -14,7 +14,7 @@ limitations under the License. */ -package sys +package mount import ( _ "unsafe" // required for go:linkname. diff --git a/sys/subprocess_unsafe_linux.s b/mount/subprocess_unsafe_linux.s similarity index 100% rename from sys/subprocess_unsafe_linux.s rename to mount/subprocess_unsafe_linux.s