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

Update for Go weekly.2011-06-16

parent b68d8e7f
...@@ -4,7 +4,7 @@ package main ...@@ -4,7 +4,7 @@ package main
// in parallel. This is useful for benchmarking purposes. // in parallel. This is useful for benchmarking purposes.
import ( import (
"encoding/line" "bufio"
"flag" "flag"
"fmt" "fmt"
"github.com/hanwen/go-fuse/fuse" "github.com/hanwen/go-fuse/fuse"
...@@ -31,8 +31,7 @@ func main() { ...@@ -31,8 +31,7 @@ func main() {
panic("err" + err.String()) panic("err" + err.String())
} }
linelen := 1000 reader := bufio.NewReader(f)
reader := line.NewReader(f, linelen)
files := make([]string, 0) files := make([]string, 0)
for { for {
...@@ -64,8 +63,8 @@ func main() { ...@@ -64,8 +63,8 @@ func main() {
} }
func Analyze(times []float64) { func Analyze(times []float64) {
sorted := sort.Float64Array(times) sorted := times
sorted.Sort() sort.SortFloat64s(sorted)
tot := 0.0 tot := 0.0
for _, v := range times { for _, v := range times {
......
...@@ -51,8 +51,10 @@ func (me *FileSystemDebug) Open(path string, flags uint32) (fuseFile File, statu ...@@ -51,8 +51,10 @@ func (me *FileSystemDebug) Open(path string, flags uint32) (fuseFile File, statu
return me.FileSystem.Open(path, flags) return me.FileSystem.Open(path, flags)
} }
var SeparatorString = string([]byte{filepath.Separator})
func (me *FileSystemDebug) getContent(path string) []byte { func (me *FileSystemDebug) getContent(path string) []byte {
comps := strings.Split(path, filepath.SeparatorString, -1) comps := strings.Split(path, SeparatorString, -1)
if comps[0] == DebugDir { if comps[0] == DebugDir {
me.RWMutex.RLock() me.RWMutex.RLock()
defer me.RWMutex.RUnlock() defer me.RWMutex.RUnlock()
......
...@@ -173,7 +173,7 @@ func (me *AutoUnionFs) updateKnownFses() { ...@@ -173,7 +173,7 @@ func (me *AutoUnionFs) updateKnownFses() {
} }
func (me *AutoUnionFs) Readlink(path string) (out string, code fuse.Status) { func (me *AutoUnionFs) Readlink(path string) (out string, code fuse.Status) {
comps := strings.Split(path, filepath.SeparatorString, -1) comps := strings.Split(path, fuse.SeparatorString, -1)
if comps[0] == _STATUS && comps[1] == _ROOT { if comps[0] == _STATUS && comps[1] == _ROOT {
return me.root, fuse.OK return me.root, fuse.OK
} }
...@@ -265,7 +265,7 @@ func (me *AutoUnionFs) GetAttr(path string) (*os.FileInfo, fuse.Status) { ...@@ -265,7 +265,7 @@ func (me *AutoUnionFs) GetAttr(path string) (*os.FileInfo, fuse.Status) {
} }
return a, fuse.OK return a, fuse.OK
} }
comps := strings.Split(path, filepath.SeparatorString, -1) comps := strings.Split(path, fuse.SeparatorString, -1)
if len(comps) > 1 && comps[0] == _CONFIG { if len(comps) > 1 && comps[0] == _CONFIG {
fs := me.getUnionFs(comps[1]) fs := me.getUnionFs(comps[1])
......
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