Debian Codegraph @

mount/mount_unsupported.go

raw
1 //go:build !linux && !windows
2 // +build !linux,!windows
3
4 /*
5 Copyright 2014 The Kubernetes Authors.
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 */
19
20 package mount
21
22 import (
23 "errors"
24 )
25
26 // Mounter implements mount.Interface for unsupported platforms
27 type Mounter struct {
28 mounterPath string
29 }
30
31 var errUnsupported = errors.New("util/mount on this platform is not supported")
32
33 // New returns a mount.Interface for the current system.
34 // It provides options to override the default mounter behavior.
35 // mounterPath allows using an alternative to `/bin/mount` for mounting.
36 func New(mounterPath string) Interface {
37 return &Mounter{
38 mounterPath: mounterPath,
39 }
40 }
41
42 // Mount always returns an error on unsupported platforms
43 func (mounter *Mounter) Mount(source string, target string, fstype string, options []string) error {
44 return errUnsupported
45 }
46
47 // Mount always returns an error on unsupported platforms
48 func (mounter *Mounter) MountSensitive(source string, target string, fstype string, options []string, sensitiveOptions []string) error {
49 return errUnsupported
50 }
51
52 // Unmount always returns an error on unsupported platforms
53 func (mounter *Mounter) Unmount(target string) error {
54 return errUnsupported
55 }
56
57 // List always returns an error on unsupported platforms
58 func (mounter *Mounter) List() ([]MountPoint, error) {
59 return []MountPoint{}, errUnsupported
60 }
61
62 // IsLikelyNotMountPoint always returns an error on unsupported platforms
63 func (mounter *Mounter) IsLikelyNotMountPoint(file string) (bool, error) {
64 return true, errUnsupported
65 }
66
67 // GetMountRefs always returns an error on unsupported platforms
68 func (mounter *Mounter) GetMountRefs(pathname string) ([]string, error) {
69 return nil, errUnsupported
70 }
71
72 func (mounter *SafeFormatAndMount) formatAndMountSensitive(source string, target string, fstype string, options []string, sensitiveOptions []string) error {
73 return mounter.Interface.Mount(source, target, fstype, options)
74 }
75
76 func (mounter *SafeFormatAndMount) diskLooksUnformatted(disk string) (bool, error) {
77 return true, errUnsupported
78 }