cmount: implement --fuse-flag to pass commands to fuse library directly

Useful for `--fuse-flag -h` to see exactly which options the library supports.
This commit is contained in:
Nick Craig-Wood 2017-05-10 09:13:46 +01:00
parent bc88f1dafa
commit 763facfd78

View File

@ -47,6 +47,7 @@ var (
dirPerms = os.FileMode(0777) dirPerms = os.FileMode(0777)
filePerms = os.FileMode(0666) filePerms = os.FileMode(0666)
extraOptions *[]string extraOptions *[]string
extraFlags *[]string
) )
func init() { func init() {
@ -66,6 +67,7 @@ func init() {
commandDefintion.Flags().VarP(&maxReadAhead, "max-read-ahead", "", "The number of bytes that can be prefetched for sequential reads.") commandDefintion.Flags().VarP(&maxReadAhead, "max-read-ahead", "", "The number of bytes that can be prefetched for sequential reads.")
commandDefintion.Flags().IntVarP(&umask, "umask", "", umask, "Override the permission bits set by the filesystem.") commandDefintion.Flags().IntVarP(&umask, "umask", "", umask, "Override the permission bits set by the filesystem.")
extraOptions = commandDefintion.Flags().StringArrayP("option", "o", []string{}, "Option for libfuse/WinFsp. Repeat if required.") extraOptions = commandDefintion.Flags().StringArrayP("option", "o", []string{}, "Option for libfuse/WinFsp. Repeat if required.")
extraFlags = commandDefintion.Flags().StringArrayP("fuse-flag", "", []string{}, "Flags or arguments to be passed direct to libfuse/WinFsp. Repeat if required.")
//commandDefintion.Flags().BoolVarP(&foreground, "foreground", "", foreground, "Do not detach.") //commandDefintion.Flags().BoolVarP(&foreground, "foreground", "", foreground, "Do not detach.")
} }
@ -209,6 +211,9 @@ func mountOptions(device string, mountpoint string) (options []string) {
for _, option := range *extraOptions { for _, option := range *extraOptions {
options = append(options, "-o", option) options = append(options, "-o", option)
} }
for _, option := range *extraFlags {
options = append(options, option)
}
return options return options
} }