mount_unsupported.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // +build !linux,!windows
  2. /*
  3. Copyright 2014 The Kubernetes Authors.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. */
  14. package mount
  15. import (
  16. "errors"
  17. "os"
  18. )
  19. type Mounter struct {
  20. mounterPath string
  21. }
  22. var unsupportedErr = errors.New("util/mount on this platform is not supported")
  23. // New returns a mount.Interface for the current system.
  24. // It provides options to override the default mounter behavior.
  25. // mounterPath allows using an alternative to `/bin/mount` for mounting.
  26. func New(mounterPath string) Interface {
  27. return &Mounter{
  28. mounterPath: mounterPath,
  29. }
  30. }
  31. func (mounter *Mounter) Mount(source string, target string, fstype string, options []string) error {
  32. return unsupportedErr
  33. }
  34. func (mounter *Mounter) Unmount(target string) error {
  35. return unsupportedErr
  36. }
  37. func (mounter *Mounter) List() ([]MountPoint, error) {
  38. return []MountPoint{}, unsupportedErr
  39. }
  40. func (mounter *Mounter) IsMountPointMatch(mp MountPoint, dir string) bool {
  41. return (mp.Path == dir)
  42. }
  43. func (mounter *Mounter) IsLikelyNotMountPoint(file string) (bool, error) {
  44. return true, unsupportedErr
  45. }
  46. func (mounter *Mounter) GetDeviceNameFromMount(mountPath, pluginMountDir string) (string, error) {
  47. return "", unsupportedErr
  48. }
  49. func getDeviceNameFromMount(mounter Interface, mountPath, pluginMountDir string) (string, error) {
  50. return "", unsupportedErr
  51. }
  52. func (mounter *Mounter) DeviceOpened(pathname string) (bool, error) {
  53. return false, unsupportedErr
  54. }
  55. func (mounter *Mounter) PathIsDevice(pathname string) (bool, error) {
  56. return true, unsupportedErr
  57. }
  58. func (mounter *Mounter) MakeRShared(path string) error {
  59. return unsupportedErr
  60. }
  61. func (mounter *SafeFormatAndMount) formatAndMount(source string, target string, fstype string, options []string) error {
  62. return mounter.Interface.Mount(source, target, fstype, options)
  63. }
  64. func (mounter *SafeFormatAndMount) diskLooksUnformatted(disk string) (bool, error) {
  65. return true, unsupportedErr
  66. }
  67. func (mounter *Mounter) GetFileType(pathname string) (FileType, error) {
  68. return FileType("fake"), unsupportedErr
  69. }
  70. func (mounter *Mounter) MakeDir(pathname string) error {
  71. return unsupportedErr
  72. }
  73. func (mounter *Mounter) MakeFile(pathname string) error {
  74. return unsupportedErr
  75. }
  76. func (mounter *Mounter) ExistsPath(pathname string) (bool, error) {
  77. return true, errors.New("not implemented")
  78. }
  79. func (mounter *Mounter) EvalHostSymlinks(pathname string) (string, error) {
  80. return "", unsupportedErr
  81. }
  82. func (mounter *Mounter) GetMountRefs(pathname string) ([]string, error) {
  83. return nil, errors.New("not implemented")
  84. }
  85. func (mounter *Mounter) GetFSGroup(pathname string) (int64, error) {
  86. return -1, errors.New("not implemented")
  87. }
  88. func (mounter *Mounter) GetSELinuxSupport(pathname string) (bool, error) {
  89. return false, errors.New("not implemented")
  90. }
  91. func (mounter *Mounter) GetMode(pathname string) (os.FileMode, error) {
  92. return 0, errors.New("not implemented")
  93. }