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.
*/
package sys
package mount
import (
"runtime"

View File

@ -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
}

View File

@ -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 {

View File

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