-
Notifications
You must be signed in to change notification settings - Fork 50
/
registry_os.go
65 lines (50 loc) · 1.27 KB
/
registry_os.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package registry
import (
"strings"
"github.com/emccode/libstorage/api/types"
)
type odm struct {
types.OSDriver
types.Context
}
// NewOSDriverManager returns a new OS driver manager.
func NewOSDriverManager(
d types.OSDriver) types.OSDriver {
return &odm{OSDriver: d}
}
func (d *odm) Mounts(
ctx types.Context,
deviceName, mountPoint string,
opts types.Store) ([]*types.MountInfo, error) {
ctx = ctx.Join(d.Context)
return d.OSDriver.Mounts(ctx.Join(d.Context), deviceName, mountPoint, opts)
}
func (d *odm) Mount(
ctx types.Context,
deviceName, mountPoint string,
opts *types.DeviceMountOpts) error {
ctx = ctx.Join(d.Context)
return d.OSDriver.Mount(ctx.Join(d.Context), deviceName, mountPoint, opts)
}
func (d *odm) Unmount(
ctx types.Context,
mountPoint string,
opts types.Store) error {
return d.OSDriver.Unmount(ctx.Join(d.Context), mountPoint, opts)
}
func (d *odm) IsMounted(
ctx types.Context,
mountPoint string,
opts types.Store) (bool, error) {
return d.OSDriver.IsMounted(ctx.Join(d.Context), mountPoint, opts)
}
func (d *odm) Format(
ctx types.Context,
deviceName string,
opts *types.DeviceFormatOpts) error {
ctx = ctx.Join(d.Context)
if strings.Contains(deviceName, ":") {
return nil
}
return d.OSDriver.Format(ctx, deviceName, opts)
}