un-export mount.FMountat
It's only used internally, so we can un-export this utility until it is needed elsewhere. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
21f532d518
commit
a964cf0cc4
@ -26,8 +26,8 @@ import (
|
|||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FMountat performs mount from the provided directory.
|
// fMountat performs mount from the provided directory.
|
||||||
func FMountat(dirfd uintptr, source, target, fstype string, flags uintptr, data string) error {
|
func fMountat(dirfd uintptr, source, target, fstype string, flags uintptr, data string) error {
|
||||||
var (
|
var (
|
||||||
sourceP, targetP, fstypeP, dataP *byte
|
sourceP, targetP, fstypeP, dataP *byte
|
||||||
pid uintptr
|
pid uintptr
|
||||||
|
@ -88,7 +88,7 @@ func testFMountatNormal(t *testing.T, root string) {
|
|||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
// mount work to fs
|
// mount work to fs
|
||||||
if err = FMountat(f.Fd(), workdir, "fs", "bind", unix.MS_BIND|unix.MS_RDONLY, ""); err != nil {
|
if err = fMountat(f.Fd(), workdir, "fs", "bind", unix.MS_BIND|unix.MS_RDONLY, ""); err != nil {
|
||||||
t.Fatalf("expected no error here, but got error: %+v", err)
|
t.Fatalf("expected no error here, but got error: %+v", err)
|
||||||
}
|
}
|
||||||
defer umount(t, fsdir)
|
defer umount(t, fsdir)
|
||||||
@ -124,7 +124,7 @@ func testFMountatWithFileFd(t *testing.T, root string) {
|
|||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
err = FMountat(f.Fd(), filepath.Join(root, "empty"), filepath.Join(root, "work"), "", 0, "")
|
err = fMountat(f.Fd(), filepath.Join(root, "empty"), filepath.Join(root, "work"), "", 0, "")
|
||||||
if !errors.Is(err, expectedErr) {
|
if !errors.Is(err, expectedErr) {
|
||||||
t.Fatalf("expected error %v, but got %v", expectedErr, errors.Cause(err))
|
t.Fatalf("expected error %v, but got %v", expectedErr, errors.Cause(err))
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ func testFMountatWithInvalidSource(t *testing.T, root string) {
|
|||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
err = FMountat(f.Fd(), filepath.Join(root, "oops"), "at", "bind", unix.MS_BIND, "")
|
err = fMountat(f.Fd(), filepath.Join(root, "oops"), "at", "bind", unix.MS_BIND, "")
|
||||||
if !errors.Is(err, expectedErr) {
|
if !errors.Is(err, expectedErr) {
|
||||||
t.Fatalf("expected error %v, but got %v", expectedErr, err)
|
t.Fatalf("expected error %v, but got %v", expectedErr, err)
|
||||||
}
|
}
|
||||||
|
@ -377,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(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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user