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

Run gofmt.

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