forked from containers/storage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.go
42 lines (34 loc) · 1.29 KB
/
utils.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
package storage
import (
"fmt"
"github.com/containers/storage/types"
)
// ParseIDMapping takes idmappings and subuid and subgid maps and returns a storage mapping
func ParseIDMapping(UIDMapSlice, GIDMapSlice []string, subUIDMap, subGIDMap string) (*types.IDMappingOptions, error) {
return types.ParseIDMapping(UIDMapSlice, GIDMapSlice, subUIDMap, subGIDMap)
}
// GetRootlessRuntimeDir returns the runtime directory when running as non root
func GetRootlessRuntimeDir(rootlessUID int) (string, error) {
return types.GetRootlessRuntimeDir(rootlessUID)
}
// DefaultStoreOptionsAutoDetectUID returns the default storage ops for containers
func DefaultStoreOptionsAutoDetectUID() (types.StoreOptions, error) {
return types.DefaultStoreOptionsAutoDetectUID()
}
// DefaultStoreOptions returns the default storage ops for containers
func DefaultStoreOptions(rootless bool, rootlessUID int) (types.StoreOptions, error) {
return types.DefaultStoreOptions(rootless, rootlessUID)
}
func validateMountOptions(mountOptions []string) error {
var Empty struct{}
// Add invalid options for ImageMount() here.
invalidOptions := map[string]struct{}{
"rw": Empty,
}
for _, opt := range mountOptions {
if _, ok := invalidOptions[opt]; ok {
return fmt.Errorf(" %q option not supported", opt)
}
}
return nil
}