From ef855c7c08c8a19e1f86d4cebbc78e02f20a1717 Mon Sep 17 00:00:00 2001 From: Travis Rhoden Date: Tue, 27 Aug 2019 10:16:10 -0600 Subject: [PATCH] Rename mount.IsBind to mount.MakeBindOpts --- pkg/util/mount/mount.go | 4 ++-- pkg/util/mount/mount_linux.go | 2 +- pkg/util/mount/mount_test.go | 4 ++-- pkg/util/mount/mount_windows.go | 2 +- pkg/volume/util/exec/exec_mount.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/util/mount/mount.go b/pkg/util/mount/mount.go index 72650884fb5..14b53d9bb82 100644 --- a/pkg/util/mount/mount.go +++ b/pkg/util/mount/mount.go @@ -201,11 +201,11 @@ func IsNotMountPoint(mounter Interface, file string) (bool, error) { return notMnt, nil } -// IsBind detects whether a bind mount is being requested and makes the remount options to +// MakeBindOpts detects whether a bind mount is being requested and makes the remount options to // use in case of bind mount, due to the fact that bind mount doesn't respect mount options. // The list equals: // options - 'bind' + 'remount' (no duplicate) -func IsBind(options []string) (bool, []string, []string) { +func MakeBindOpts(options []string) (bool, []string, []string) { // Because we have an FD opened on the subpath bind mount, the "bind" option // needs to be included, otherwise the mount target will error as busy if you // remount as readonly. diff --git a/pkg/util/mount/mount_linux.go b/pkg/util/mount/mount_linux.go index fe762e347b6..6555ac8b75f 100644 --- a/pkg/util/mount/mount_linux.go +++ b/pkg/util/mount/mount_linux.go @@ -73,7 +73,7 @@ func (mounter *Mounter) Mount(source string, target string, fstype string, optio // Path to mounter binary if containerized mounter is needed. Otherwise, it is set to empty. // All Linux distros are expected to be shipped with a mount utility that a support bind mounts. mounterPath := "" - bind, bindOpts, bindRemountOpts := IsBind(options) + bind, bindOpts, bindRemountOpts := MakeBindOpts(options) if bind { err := mounter.doMount(mounterPath, defaultMountCommand, source, target, fstype, bindOpts) if err != nil { diff --git a/pkg/util/mount/mount_test.go b/pkg/util/mount/mount_test.go index 6479bd759cc..6b9d5d5fc4b 100644 --- a/pkg/util/mount/mount_test.go +++ b/pkg/util/mount/mount_test.go @@ -21,7 +21,7 @@ import ( "testing" ) -func TestIsBind(t *testing.T) { +func TestMakeBindOpts(t *testing.T) { tests := []struct { mountOption []string isBind bool @@ -43,7 +43,7 @@ func TestIsBind(t *testing.T) { }, } for _, test := range tests { - bind, bindOpts, bindRemountOpts := IsBind(test.mountOption) + bind, bindOpts, bindRemountOpts := MakeBindOpts(test.mountOption) if bind != test.isBind { t.Errorf("Expected bind to be %v but got %v", test.isBind, bind) } diff --git a/pkg/util/mount/mount_windows.go b/pkg/util/mount/mount_windows.go index 9176a066528..bd5bfa6def6 100644 --- a/pkg/util/mount/mount_windows.go +++ b/pkg/util/mount/mount_windows.go @@ -68,7 +68,7 @@ func (mounter *Mounter) Mount(source string, target string, fstype string, optio bindSource := source // tell it's going to mount azure disk or azure file according to options - if bind, _, _ := IsBind(options); bind { + if bind, _, _ := MakeBindOpts(options); bind { // mount azure disk bindSource = NormalizeWindowsPath(source) } else { diff --git a/pkg/volume/util/exec/exec_mount.go b/pkg/volume/util/exec/exec_mount.go index 1732f424c44..868f989ecea 100644 --- a/pkg/volume/util/exec/exec_mount.go +++ b/pkg/volume/util/exec/exec_mount.go @@ -47,7 +47,7 @@ var _ mount.Interface = &execMounter{} // Mount runs mount(8) using given exec interface. func (m *execMounter) Mount(source string, target string, fstype string, options []string) error { - bind, bindOpts, bindRemountOpts := mount.IsBind(options) + bind, bindOpts, bindRemountOpts := mount.MakeBindOpts(options) if bind { err := m.doExecMount(source, target, fstype, bindOpts)