summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-10-29 04:09:16 -0700
committerGitHub <noreply@github.com>2018-10-29 04:09:16 -0700
commitaef9d56ae20e34447a69e19613629b8281a78502 (patch)
treeed579d0ff42bd792786de1b6b1829327beb08895
parent49555721ec84ca630e8fbbf32a400e523c477439 (diff)
parent22390b3b0441731e14143c560f3e330623922009 (diff)
downloadpodman-aef9d56ae20e34447a69e19613629b8281a78502.tar.gz
podman-aef9d56ae20e34447a69e19613629b8281a78502.tar.bz2
podman-aef9d56ae20e34447a69e19613629b8281a78502.zip
Merge pull request #1696 from QiWang19/ExportForCrio
Change ParseDevice to exported name
-rw-r--r--pkg/spec/config_linux.go2
-rw-r--r--pkg/spec/parse.go14
2 files changed, 8 insertions, 8 deletions
diff --git a/pkg/spec/config_linux.go b/pkg/spec/config_linux.go
index 20cdcc458..5bf8eff43 100644
--- a/pkg/spec/config_linux.go
+++ b/pkg/spec/config_linux.go
@@ -28,7 +28,7 @@ func Device(d *configs.Device) spec.LinuxDevice {
}
func addDevice(g *generate.Generator, device string) error {
- src, dst, permissions, err := parseDevice(device)
+ src, dst, permissions, err := ParseDevice(device)
if err != nil {
return err
}
diff --git a/pkg/spec/parse.go b/pkg/spec/parse.go
index 9b2dd1347..4d20e35d4 100644
--- a/pkg/spec/parse.go
+++ b/pkg/spec/parse.go
@@ -148,21 +148,21 @@ func getLoggingPath(opts []string) string {
return ""
}
-// parseDevice parses device mapping string to a src, dest & permissions string
-func parseDevice(device string) (string, string, string, error) { //nolint
+// ParseDevice parses device mapping string to a src, dest & permissions string
+func ParseDevice(device string) (string, string, string, error) { //nolint
src := ""
dst := ""
permissions := "rwm"
arr := strings.Split(device, ":")
switch len(arr) {
case 3:
- if !validDeviceMode(arr[2]) {
+ if !IsValidDeviceMode(arr[2]) {
return "", "", "", fmt.Errorf("invalid device mode: %s", arr[2])
}
permissions = arr[2]
fallthrough
case 2:
- if validDeviceMode(arr[1]) {
+ if IsValidDeviceMode(arr[1]) {
permissions = arr[1]
} else {
if arr[1][0] != '/' {
@@ -183,9 +183,9 @@ func parseDevice(device string) (string, string, string, error) { //nolint
return src, dst, permissions, nil
}
-// validDeviceMode checks if the mode for device is valid or not.
-// Valid mode is a composition of r (read), w (write), and m (mknod).
-func validDeviceMode(mode string) bool {
+// IsValidDeviceMode checks if the mode for device is valid or not.
+// IsValid mode is a composition of r (read), w (write), and m (mknod).
+func IsValidDeviceMode(mode string) bool {
var legalDeviceMode = map[rune]bool{
'r': true,
'w': true,