Debian Codegraph @

mount/mount_unsupported.go

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