Skip to content

Commit

Permalink
Parse key=value pairs from data and pass through to nmount
Browse files Browse the repository at this point in the history
  • Loading branch information
dfr committed Apr 27, 2022
1 parent 1c71147 commit f6f5655
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions pkg/mount/mounter_freebsd.go
Expand Up @@ -28,14 +28,25 @@ func allocateIOVecs(options []string) []C.struct_iovec {
func mount(device, target, mType string, flag uintptr, data string) error {
isNullFS := false

xs := strings.Split(data, ",")
for _, x := range xs {
if x == "bind" {
isNullFS = true
options := []string{"fspath", target}

if data != "" {
xs := strings.Split(data, ",")
for _, x := range xs {
if x == "bind" {
isNullFS = true
continue
}
opt := strings.SplitN(x, "=", 2)
options = append(options, opt[0])
if len(opt) == 2 {
options = append(options, opt[1])
} else {
options = append(options, "")
}
}
}

options := []string{"fspath", target}
if isNullFS {
options = append(options, "fstype", "nullfs", "target", device)
} else {
Expand Down

0 comments on commit f6f5655

Please sign in to comment.