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

Run gofmt.

parent 7e4c459b
......@@ -17,7 +17,7 @@ func main() {
filename := flag.Args()[0]
f, err := os.Open(filename, os.O_RDONLY, 0)
if err != nil {
panic("err"+err.String())
panic("err" + err.String())
}
linelen := 1000
......@@ -25,7 +25,7 @@ func main() {
files := make([]string, 0)
for {
l, _, err := reader.ReadLine()
l, _, err := reader.ReadLine()
if err != nil {
break
}
......@@ -37,7 +37,7 @@ func main() {
dts := make(chan int64, parallel)
fmt.Printf("Statting %d files with %d threads\n", len(files), parallel)
for i := 0 ; i < parallel; i++ {
for i := 0; i < parallel; i++ {
go func() {
for {
fn := <-todo
......@@ -57,7 +57,7 @@ func main() {
}
total := 0.0
for i := 0 ; i < len(files); i++ {
for i := 0; i < len(files); i++ {
total += float64(<-dts) * 1e-6
}
......
......@@ -71,7 +71,7 @@ func main() {
hot, unique := timing.HotPaths("GetAttr")
top := 20
start := len(hot)-top
start := len(hot) - top
if start < 0 {
start = 0
}
......
......@@ -27,4 +27,3 @@ func CheckSuccess(e os.Error) {
panic(fmt.Sprintf("Unexpected error: %v", e))
}
}
......@@ -223,5 +223,3 @@ func (me *MultiZipFs) Create(name string, flags uint32, mode uint32) (file fuse.
return z, fuse.OK
}
......@@ -23,7 +23,7 @@ func TestMultiZipFs(t *testing.T) {
go state.Loop(true)
f, err := os.Open(mountPoint + "", os.O_RDONLY, 0)
f, err := os.Open(mountPoint+"", os.O_RDONLY, 0)
CheckSuccess(err)
names, err := f.Readdirnames(-1)
......@@ -35,16 +35,16 @@ func TestMultiZipFs(t *testing.T) {
err = f.Close()
CheckSuccess(err)
f, err = os.Open(mountPoint + "/random", os.O_WRONLY | os.O_CREATE, 0)
f, err = os.Open(mountPoint+"/random", os.O_WRONLY|os.O_CREATE, 0)
if err == nil {
t.Error("Must fail writing in root.")
}
f, err = os.Open(mountPoint + "/config/zipmount", os.O_WRONLY, 0)
f, err = os.Open(mountPoint+"/config/zipmount", os.O_WRONLY, 0)
if err == nil {
t.Error("Must fail without O_CREATE")
}
f, err = os.Open(mountPoint + "/config/zipmount", os.O_WRONLY | os.O_CREATE, 0)
f, err = os.Open(mountPoint+"/config/zipmount", os.O_WRONLY|os.O_CREATE, 0)
CheckSuccess(err)
// Directory exists, but is empty.
......
......@@ -43,7 +43,7 @@ func TestZipFs(t *testing.T) {
t.Error("file type", fi)
}
f, err := os.Open(mountPoint + "/file.txt", os.O_RDONLY, 0)
f, err := os.Open(mountPoint+"/file.txt", os.O_RDONLY, 0)
CheckSuccess(err)
b := make([]byte, 1024)
......
......@@ -42,7 +42,7 @@ type fuseRequest struct {
output []byte
// Start timestamp for timing info.
startNs int64
startNs int64
dispatchNs int64
preWriteNs int64
}
......@@ -66,9 +66,9 @@ type MountState struct {
fileSystem RawFileSystem
// I/O with kernel and daemon.
mountFile *os.File
mountFile *os.File
errorChannel chan os.Error
errorChannel chan os.Error
// Run each operation in its own Go-routine.
threaded bool
......@@ -79,8 +79,8 @@ type MountState struct {
// For efficient reads.
buffers *BufferPool
statisticsMutex sync.Mutex
operationCounts map[string]int64
statisticsMutex sync.Mutex
operationCounts map[string]int64
// In nanoseconds.
operationLatencies map[string]int64
......@@ -254,7 +254,7 @@ func (me *MountState) Stats() string {
////////////////////////////////////////////////////////////////
// Logic for the control loop.
func (me *MountState) newFuseRequest() (*fuseRequest) {
func (me *MountState) newFuseRequest() *fuseRequest {
req := new(fuseRequest)
req.status = OK
req.inputBuf = me.buffers.AllocBuffer(bufSize)
......
......@@ -18,7 +18,7 @@ import (
// Make a temporary directory securely.
func MakeTempDir() string {
nm, err := ioutil.TempDir("", "go-fuse");
nm, err := ioutil.TempDir("", "go-fuse")
if err != nil {
panic("TempDir() failed: " + err.String())
}
......@@ -258,7 +258,7 @@ func Writev(fd int, packet [][]byte) (n int, err os.Error) {
continue
}
vec := syscall.Iovec{
Base: &v[0],
Base: &v[0],
}
vec.SetLen(len(v))
iovecs = append(iovecs, vec)
......@@ -309,7 +309,7 @@ func CheckSuccess(e os.Error) {
}
// For printing latency data.
func PrintMap(m map[string]float64) {
func PrintMap(m map[string]float64) {
keys := make([]string, len(m))
for k, _ := range m {
keys = append(keys, k)
......
......@@ -53,8 +53,8 @@ func mount(mountPoint string) (f *os.File, finalMountPoint string, err os.Error)
proc, err := os.StartProcess("/bin/fusermount",
[]string{"/bin/fusermount", mountPoint},
&os.ProcAttr{
Env:[]string{"_FUSE_COMMFD=3"},
Files: []*os.File{os.Stdin, os.Stdout, os.Stderr, remote}})
Env: []string{"_FUSE_COMMFD=3"},
Files: []*os.File{os.Stdin, os.Stdout, os.Stderr, remote}})
if err != nil {
return
......
......@@ -170,4 +170,3 @@ func (me *TimingRawFilesystem) ReleaseDir(header *InHeader, f RawFuseDir) {
defer me.startTimer("ReleaseDir")()
me.original.ReleaseDir(header, f)
}
......@@ -188,6 +188,3 @@ func (me *WrappingRawFilesystem) Release(header *InHeader, f RawFuseFile) {
func (me *WrappingRawFilesystem) ReleaseDir(header *InHeader, f RawFuseDir) {
me.original.ReleaseDir(header, f)
}
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