Commit 00bf79b1 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Run gofmt in example/

parent b3ea7e6b
...@@ -38,7 +38,7 @@ func main() { ...@@ -38,7 +38,7 @@ func main() {
EntryTimeout: 1.0, EntryTimeout: 1.0,
AttrTimeout: 1.0, AttrTimeout: 1.0,
NegativeTimeout: 1.0, NegativeTimeout: 1.0,
Owner: fuse.CurrentOwner(), Owner: fuse.CurrentOwner(),
}, },
UpdateOnMount: true, UpdateOnMount: true,
} }
......
...@@ -75,21 +75,21 @@ func Analyze(times []float64) { ...@@ -75,21 +75,21 @@ func Analyze(times []float64) {
avg := tot / n avg := tot / n
variance := 0.0 variance := 0.0
for _, v := range times { for _, v := range times {
variance += (v - avg)*(v - avg) variance += (v - avg) * (v - avg)
} }
variance /= n variance /= n
stddev := math.Sqrt(variance) stddev := math.Sqrt(variance)
median := sorted[len(times)/2] median := sorted[len(times)/2]
perc90 := sorted[int(n * 0.9)] perc90 := sorted[int(n*0.9)]
perc10 := sorted[int(n * 0.1)] perc10 := sorted[int(n*0.1)]
fmt.Printf( fmt.Printf(
"%d samples\n" + "%d samples\n"+
"avg %.2f ms 2sigma %.2f " + "avg %.2f ms 2sigma %.2f "+
"median %.2fms\n" + "median %.2fms\n"+
"10%%tile %.2fms, 90%%tile %.2fms\n", "10%%tile %.2fms, 90%%tile %.2fms\n",
len(times), avg, 2*stddev, median, perc10, perc90) len(times), avg, 2*stddev, median, perc10, perc90)
} }
......
...@@ -18,11 +18,11 @@ func (me *HelloFs) GetAttr(name string) (*os.FileInfo, fuse.Status) { ...@@ -18,11 +18,11 @@ func (me *HelloFs) GetAttr(name string) (*os.FileInfo, fuse.Status) {
case "file.txt": case "file.txt":
return &os.FileInfo{ return &os.FileInfo{
Mode: fuse.S_IFREG | 0644, Size: int64(len(name)), Mode: fuse.S_IFREG | 0644, Size: int64(len(name)),
}, fuse.OK },fuse.OK
case "": case "":
return &os.FileInfo{ return &os.FileInfo{
Mode: fuse.S_IFDIR | 0755, Mode: fuse.S_IFDIR | 0755,
}, fuse.OK },fuse.OK
} }
return nil, fuse.ENOENT return nil, fuse.ENOENT
} }
...@@ -30,7 +30,7 @@ func (me *HelloFs) GetAttr(name string) (*os.FileInfo, fuse.Status) { ...@@ -30,7 +30,7 @@ func (me *HelloFs) GetAttr(name string) (*os.FileInfo, fuse.Status) {
func (me *HelloFs) OpenDir(name string) (c chan fuse.DirEntry, code fuse.Status) { func (me *HelloFs) OpenDir(name string) (c chan fuse.DirEntry, code fuse.Status) {
if name == "" { if name == "" {
c = make(chan fuse.DirEntry, 1) c = make(chan fuse.DirEntry, 1)
c <- fuse.DirEntry{Name: "file.txt",Mode: fuse.S_IFREG} c <- fuse.DirEntry{Name: "file.txt", Mode: fuse.S_IFREG}
close(c) close(c)
return c, fuse.OK return c, fuse.OK
} }
...@@ -41,7 +41,7 @@ func (me *HelloFs) Open(name string, flags uint32) (file fuse.File, code fuse.St ...@@ -41,7 +41,7 @@ func (me *HelloFs) Open(name string, flags uint32) (file fuse.File, code fuse.St
if name != "file.txt" { if name != "file.txt" {
return nil, fuse.ENOENT return nil, fuse.ENOENT
} }
if flags & fuse.O_ANYWRITE != 0 { if flags&fuse.O_ANYWRITE != 0 {
return nil, fuse.EPERM return nil, fuse.EPERM
} }
return fuse.NewReadOnlyFile([]byte(name)), fuse.OK return fuse.NewReadOnlyFile([]byte(name)), fuse.OK
......
...@@ -27,7 +27,7 @@ func main() { ...@@ -27,7 +27,7 @@ func main() {
fmt.Printf("Mount fail: %v\n", err) fmt.Printf("Mount fail: %v\n", err)
os.Exit(1) os.Exit(1)
} }
state.Debug = *debug state.Debug = *debug
state.Loop(true) state.Loop(true)
} }
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