mount_unsupported.go 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. )
  18. // Mounter implements mount.Interface for unsupported platforms
  19. type Mounter struct {
  20. mounterPath string
  21. }
  22. var errUnsupported = 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. // Mount always returns an error on unsupported platforms
  32. func (mounter *Mounter) Mount(source string, target string, fstype string, options []string) error {
  33. return errUnsupported
  34. }
  35. // Unmount always returns an error on unsupported platforms
  36. func (mounter *Mounter) Unmount(target string) error {
  37. return errUnsupported
  38. }
  39. // List always returns an error on unsupported platforms
  40. func (mounter *Mounter) List() ([]MountPoint, error) {
  41. return []MountPoint{}, errUnsupported
  42. }
  43. // IsLikelyNotMountPoint always returns an error on unsupported platforms
  44. func (mounter *Mounter) IsLikelyNotMountPoint(file string) (bool, error) {
  45. return true, errUnsupported
  46. }
  47. // GetMountRefs always returns an error on unsupported platforms
  48. func (mounter *Mounter) GetMountRefs(pathname string) ([]string, error) {
  49. return nil, errUnsupported
  50. }
  51. func (mounter *SafeFormatAndMount) formatAndMount(source string, target string, fstype string, options []string) error {
  52. return mounter.Interface.Mount(source, target, fstype, options)
  53. }
  54. func (mounter *SafeFormatAndMount) diskLooksUnformatted(disk string) (bool, error) {
  55. return true, errUnsupported
  56. }