move sys.FMountat() into mount package

It's the only location this is used, so might as well move it
into that package. I could not find external users of this utility,
so not adding an alias / deprecation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2021-06-23 09:59:46 +02:00
parent 03bfcd8a32
commit 21f532d518
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
5 changed files with 5 additions and 6 deletions

View File

@ -14,7 +14,7 @@
limitations under the License. limitations under the License.
*/ */
package sys package mount
import ( import (
"runtime" "runtime"

View File

@ -14,7 +14,7 @@
limitations under the License. limitations under the License.
*/ */
package sys package mount
import ( import (
"io/ioutil" "io/ioutil"
@ -32,7 +32,7 @@ import (
type fMountatCaseFunc func(t *testing.T, root string) type fMountatCaseFunc func(t *testing.T, root string)
func TestFMountat(t *testing.T) { func TestFMountat(t *testing.T) {
if !runningPrivileged() { if unix.Geteuid() != 0 {
t.Skip("Needs to be run as root") t.Skip("Needs to be run as root")
return return
} }

View File

@ -24,7 +24,6 @@ import (
"strings" "strings"
"time" "time"
"github.com/containerd/containerd/sys"
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
) )
@ -378,7 +377,7 @@ func mountAt(chdir string, source, target, fstype string, flags uintptr, data st
if !fs.IsDir() { if !fs.IsDir() {
return errors.Wrap(errors.Errorf("%s is not dir", chdir), "failed to mountat") 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 { func (m *Mount) mountWithHelper(helperBinary, typePrefix, target string) error {

View File

@ -14,7 +14,7 @@
limitations under the License. limitations under the License.
*/ */
package sys package mount
import ( import (
_ "unsafe" // required for go:linkname. _ "unsafe" // required for go:linkname.