Commit 59d90a47 authored by Jakob Unterwurzacher's avatar Jakob Unterwurzacher Committed by Han-Wen Nienhuys

example: loopback: pull MountOptions into opts initializer

These were open-coded before. Pull them into the struct
initializer for somewhat clearer code.

I'm doing this now as I'm about to add another option.

Change-Id: Ie04cfc9fb1f4128b8faf5c85757d7263aa77e5a0
parent 3de2e5e1
......@@ -19,6 +19,7 @@ import (
"time"
"github.com/hanwen/go-fuse/v2/fs"
"github.com/hanwen/go-fuse/v2/fuse"
)
func writeMemProfile(fn string, sigs <-chan os.Signal) {
......@@ -90,13 +91,19 @@ func main() {
sec := time.Second
opts := &fs.Options{
// These options are to be compatible with libfuse defaults,
// The timeout options are to be compatible with libfuse defaults,
// making benchmarking easier.
AttrTimeout: &sec,
EntryTimeout: &sec,
NullPermissions: true, // Leave file permissions on "000" files as-is
MountOptions: fuse.MountOptions{
AllowOther: *other,
Debug: *debug,
Name: "loopback", // Second column in "df -T" will be shown as "fuse." + Name
},
}
opts.Debug = *debug
opts.AllowOther = *other
if opts.AllowOther {
// Make the kernel check file permissions for us
opts.MountOptions.Options = append(opts.MountOptions.Options, "default_permissions")
......@@ -106,10 +113,6 @@ func main() {
}
// First column in "df -T": original dir
opts.MountOptions.Options = append(opts.MountOptions.Options, "fsname="+orig)
// Second column in "df -T" will be shown as "fuse." + Name
opts.MountOptions.Name = "loopback"
// Leave file permissions on "000" files as-is
opts.NullPermissions = true
// Enable diagnostics logging
if !*quiet {
opts.Logger = log.New(os.Stderr, "", 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment