Commit b16becb1 authored by Daniel Martí's avatar Daniel Martí

Fix building (go build ./...)

parent 1104e6ba
...@@ -3,8 +3,6 @@ package main ...@@ -3,8 +3,6 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
"github.com/hanwen/go-fuse/benchmark"
"github.com/hanwen/go-fuse/fuse"
"io" "io"
"log" "log"
"os" "os"
...@@ -13,12 +11,15 @@ import ( ...@@ -13,12 +11,15 @@ import (
"runtime/pprof" "runtime/pprof"
"strings" "strings"
"time" "time"
"github.com/hanwen/go-fuse/benchmark"
"github.com/hanwen/go-fuse/fuse/nodefs"
"github.com/hanwen/go-fuse/fuse/pathfs"
) )
func main() { func main() {
// Scans the arg list and sets up flags // Scans the arg list and sets up flags
debug := flag.Bool("debug", false, "print debugging messages.") debug := flag.Bool("debug", false, "print debugging messages.")
latencies := flag.Bool("latencies", false, "record operation latencies.")
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.")
...@@ -48,18 +49,17 @@ func main() { ...@@ -48,18 +49,17 @@ func main() {
for _, l := range lines { for _, l := range lines {
fs.AddFile(l) fs.AddFile(l)
} }
nfs := fuse.NewPathNodeFs(fs, nil) nfs := pathfs.NewPathNodeFs(fs, nil)
opts := &fuse.FileSystemOptions{ opts := &nodefs.Options{
AttrTimeout: time.Duration(*ttl * float64(time.Second)), AttrTimeout: time.Duration(*ttl * float64(time.Second)),
EntryTimeout: time.Duration(*ttl * float64(time.Second)), EntryTimeout: time.Duration(*ttl * float64(time.Second)),
} }
state, _, err := fuse.MountNodeFileSystem(flag.Arg(0), nfs, opts) state, _, err := nodefs.MountRoot(flag.Arg(0), nfs.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)
} }
state.SetRecordStatistics(*latencies)
state.SetDebug(*debug) state.SetDebug(*debug)
runtime.GC() runtime.GC()
if profFile != nil { if profFile != nil {
...@@ -74,7 +74,7 @@ func main() { ...@@ -74,7 +74,7 @@ func main() {
cmd.Start() cmd.Start()
} }
state.Loop() state.Serve()
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