Commit b1188e32 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

example/zipfs: use new nodefs

parent b5b6396e
...@@ -16,7 +16,7 @@ import ( ...@@ -16,7 +16,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/hanwen/go-fuse/fuse/nodefs" "github.com/hanwen/go-fuse/nodefs"
"github.com/hanwen/go-fuse/zipfs" "github.com/hanwen/go-fuse/zipfs"
) )
...@@ -26,7 +26,7 @@ func main() { ...@@ -26,7 +26,7 @@ func main() {
profile := flag.String("profile", "", "record cpu profile.") profile := flag.String("profile", "", "record cpu profile.")
mem_profile := flag.String("mem-profile", "", "record memory profile.") mem_profile := flag.String("mem-profile", "", "record memory profile.")
command := flag.String("run", "", "run this command after mounting.") command := flag.String("run", "", "run this command after mounting.")
ttl := flag.Float64("ttl", 1.0, "attribute/entry cache TTL.") ttl := flag.Duration("ttl", time.Second, "attribute/entry cache TTL.")
flag.Parse() flag.Parse()
if flag.NArg() < 2 { if flag.NArg() < 2 {
fmt.Fprintf(os.Stderr, "usage: %s MOUNTPOINT ZIP-FILE\n", os.Args[0]) fmt.Fprintf(os.Stderr, "usage: %s MOUNTPOINT ZIP-FILE\n", os.Args[0])
...@@ -55,11 +55,12 @@ func main() { ...@@ -55,11 +55,12 @@ func main() {
} }
opts := &nodefs.Options{ opts := &nodefs.Options{
AttrTimeout: time.Duration(*ttl * float64(time.Second)), AttrTimeout: ttl,
EntryTimeout: time.Duration(*ttl * float64(time.Second)), EntryTimeout: ttl,
Debug: *debug, DefaultPermissions: true,
} }
state, _, err := nodefs.MountRoot(flag.Arg(0), root, opts) opts.Debug = *debug
server, err := nodefs.Mount(flag.Arg(0), root, opts)
if err != nil { if err != nil {
fmt.Printf("Mount fail: %v\n", err) fmt.Printf("Mount fail: %v\n", err)
os.Exit(1) os.Exit(1)
...@@ -78,7 +79,7 @@ func main() { ...@@ -78,7 +79,7 @@ func main() {
cmd.Start() cmd.Start()
} }
state.Serve() server.Wait()
if memProfFile != nil { if memProfFile != nil {
pprof.WriteHeapProfile(memProfFile) pprof.WriteHeapProfile(memProfFile)
} }
......
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