Skip to content

Commit c103561

Browse files
authored
Merge pull request #565 from andyzhangx/RemoveStageTarget
cleanup: remove useless functions
2 parents a18fca5 + 11124b5 commit c103561

File tree

3 files changed

+4
-34
lines changed

3 files changed

+4
-34
lines changed

pkg/smb/smb_common_darwin.go

-8
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,6 @@ func Mount(m *mount.SafeFormatAndMount, source, target, fsType string, options [
2929
return m.MountSensitive(source, target, fsType, options, sensitiveMountOptions)
3030
}
3131

32-
func Unmount(m *mount.SafeFormatAndMount, target string) error {
33-
return m.Unmount(target)
34-
}
35-
36-
func RemoveStageTarget(m *mount.SafeFormatAndMount, target string) error {
37-
return os.Remove(target)
38-
}
39-
4032
func CleanupSMBMountPoint(m *mount.SafeFormatAndMount, target string, extensiveMountCheck bool) error {
4133
return mount.CleanupMountPoint(target, m, extensiveMountCheck)
4234
}

pkg/smb/smb_common_linux.go

-11
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,7 @@ func Mount(m *mount.SafeFormatAndMount, source, target, fsType string, options,
2929
return m.MountSensitive(source, target, fsType, options, sensitiveMountOptions)
3030
}
3131

32-
func Unmount(m *mount.SafeFormatAndMount, target string) error {
33-
return m.Unmount(target)
34-
}
35-
36-
func RemoveStageTarget(m *mount.SafeFormatAndMount, target string) error {
37-
return os.Remove(target)
38-
}
39-
4032
func CleanupSMBMountPoint(m *mount.SafeFormatAndMount, target string, extensiveMountCheck bool) error {
41-
// unmount first since if remote SMB directory is not found, linked path cannot be deleted with CleanupMountPoint
42-
// https://github.com/kubernetes/kubernetes/issues/97031
43-
_ = m.Unmount(target)
4433
return mount.CleanupMountPoint(target, m, extensiveMountCheck)
4534
}
4635

pkg/smb/smb_common_windows.go

+4-15
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,14 @@ func Mount(m *mount.SafeFormatAndMount, source, target, fsType string, mountOpti
3535
return fmt.Errorf("could not cast to csi proxy class")
3636
}
3737

38-
func Unmount(m *mount.SafeFormatAndMount, target string) error {
39-
if proxy, ok := m.Interface.(mounter.CSIProxyMounter); ok {
40-
return proxy.SMBUnmount(target)
41-
}
42-
return fmt.Errorf("could not cast to csi proxy class")
43-
}
44-
45-
func RemoveStageTarget(m *mount.SafeFormatAndMount, target string) error {
46-
if proxy, ok := m.Interface.(mounter.CSIProxyMounter); ok {
47-
return proxy.Rmdir(target)
48-
}
49-
return fmt.Errorf("could not cast to csi proxy class")
50-
}
51-
5238
// CleanupSMBMountPoint - In windows CSI proxy call to umount is used to unmount the SMB.
5339
// The clean up mount point point calls is supposed for fix the corrupted directories as well.
5440
// For alpha CSI proxy integration, we only do an unmount.
5541
func CleanupSMBMountPoint(m *mount.SafeFormatAndMount, target string, extensiveMountCheck bool) error {
56-
return Unmount(m, target)
42+
if proxy, ok := m.Interface.(mounter.CSIProxyMounter); ok {
43+
return proxy.SMBUnmount(target)
44+
}
45+
return fmt.Errorf("could not cast to csi proxy class")
5746
}
5847

5948
func CleanupMountPoint(m *mount.SafeFormatAndMount, target string, extensiveMountCheck bool) error {

0 commit comments

Comments
 (0)