MountConfig.toOptionsString
parent
440c9ee7f7
commit
f4d8f98165
|
@ -15,8 +15,10 @@
|
||||||
package fuse
|
package fuse
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
@ -126,7 +128,26 @@ func (c *MountConfig) toMap() (opts map[string]string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func escapeOptionsKey(s string) (res string) {
|
||||||
|
res = s
|
||||||
|
res = strings.Replace(res, `\`, `\\`, -1)
|
||||||
|
res = strings.Replace(res, `,`, `\,`, -1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Create an options string suitable for passing to the mount helper.
|
// Create an options string suitable for passing to the mount helper.
|
||||||
func (c *MountConfig) toOptionsString() string {
|
func (c *MountConfig) toOptionsString() string {
|
||||||
panic("TODO")
|
var components []string
|
||||||
|
for k, v := range c.toMap() {
|
||||||
|
k = escapeOptionsKey(k)
|
||||||
|
|
||||||
|
component := k
|
||||||
|
if v != "" {
|
||||||
|
component = fmt.Sprintf("%s=%s", k, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
components = append(components, component)
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.Join(components, ",")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue