Commit 9fe49c6f authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Run Gofmt.

parent e4dc4c71
...@@ -39,7 +39,7 @@ func main() { ...@@ -39,7 +39,7 @@ func main() {
tot := 0.0 tot := 0.0
totalRuns := *runs + 1 totalRuns := *runs + 1
for j := 0 ; j < totalRuns; j++ { for j := 0; j < totalRuns; j++ {
result := BulkStat(*threads, files) result := BulkStat(*threads, files)
if j > 0 { if j > 0 {
tot += result tot += result
......
...@@ -430,7 +430,7 @@ func init() { ...@@ -430,7 +430,7 @@ func init() {
operationHandlers[op].DecodeOut = f operationHandlers[op].DecodeOut = f
} }
for op, count := range map[opcode]int { for op, count := range map[opcode]int{
FUSE_LOOKUP: 1, FUSE_LOOKUP: 1,
FUSE_RENAME: 2, FUSE_RENAME: 2,
FUSE_SYMLINK: 2, FUSE_SYMLINK: 2,
......
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ import (
"path/filepath" "path/filepath"
"time" "time"
) )
var _ = fmt.Println var _ = fmt.Println
func NewFileSystemConnector(fs FileSystem, opts *MountOptions) (out *FileSystemConnector) { func NewFileSystemConnector(fs FileSystem, opts *MountOptions) (out *FileSystemConnector) {
...@@ -147,7 +148,7 @@ func (me *FileSystemConnector) SetAttr(header *InHeader, input *SetAttrIn) (out ...@@ -147,7 +148,7 @@ func (me *FileSystemConnector) SetAttr(header *InHeader, input *SetAttrIn) (out
if input.Valid&FATTR_MODE != 0 { if input.Valid&FATTR_MODE != 0 {
permissionMask := uint32(07777) permissionMask := uint32(07777)
err = mount.fs.Chmod(fullPath, input.Mode & permissionMask) err = mount.fs.Chmod(fullPath, input.Mode&permissionMask)
} }
if err == OK && (input.Valid&FATTR_UID != 0 || input.Valid&FATTR_GID != 0) { if err == OK && (input.Valid&FATTR_UID != 0 || input.Valid&FATTR_GID != 0) {
// TODO - can we get just FATTR_GID but not FATTR_UID ? // TODO - can we get just FATTR_GID but not FATTR_UID ?
......
...@@ -4,7 +4,9 @@ import ( ...@@ -4,7 +4,9 @@ import (
"fmt" "fmt"
"github.com/hanwen/go-fuse/fuse" "github.com/hanwen/go-fuse/fuse"
) )
var _ = fmt.Println var _ = fmt.Println
type attrResponse struct { type attrResponse struct {
*fuse.Attr *fuse.Attr
fuse.Status fuse.Status
......
...@@ -154,7 +154,7 @@ func (me *UnionFs) getBranchAttrNoCache(name string) getBranchResult { ...@@ -154,7 +154,7 @@ func (me *UnionFs) getBranchAttrNoCache(name string) getBranchResult {
a, s := fs.GetAttr(name) a, s := fs.GetAttr(name)
if s == fuse.OK { if s == fuse.OK {
if a.Mode & fuse.S_IFDIR != 0 { if a.Mode&fuse.S_IFDIR != 0 {
// Make all directories appear writable // Make all directories appear writable
a.Mode |= 0200 a.Mode |= 0200
} }
...@@ -383,7 +383,7 @@ func (me *UnionFs) Readlink(name string) (out string, code fuse.Status) { ...@@ -383,7 +383,7 @@ func (me *UnionFs) Readlink(name string) (out string, code fuse.Status) {
func IsDir(fs fuse.FileSystem, name string) bool { func IsDir(fs fuse.FileSystem, name string) bool {
a, code := fs.GetAttr(name) a, code := fs.GetAttr(name)
return code == fuse.OK && a.Mode & fuse.S_IFDIR != 0 return code == fuse.OK && a.Mode&fuse.S_IFDIR != 0
} }
func (me *UnionFs) makeDirTo(name string) fuse.Status { func (me *UnionFs) makeDirTo(name string) fuse.Status {
......
...@@ -138,18 +138,18 @@ func TestChmod(t *testing.T) { ...@@ -138,18 +138,18 @@ func TestChmod(t *testing.T) {
wd, state := setup(t) wd, state := setup(t)
defer state.Unmount() defer state.Unmount()
ro_fn := wd+"/ro/file" ro_fn := wd + "/ro/file"
m_fn := wd+"/mount/file" m_fn := wd + "/mount/file"
writeToFile(ro_fn, "a") writeToFile(ro_fn, "a")
err := os.Chmod(m_fn, 07070) err := os.Chmod(m_fn, 07070)
CheckSuccess(err) CheckSuccess(err)
fi, err := os.Lstat(m_fn) fi, err := os.Lstat(m_fn)
CheckSuccess(err) CheckSuccess(err)
if fi.Mode & 07777 != 07070 { if fi.Mode&07777 != 07070 {
t.Errorf("Unexpected mode found: %v", fi.Mode) t.Errorf("Unexpected mode found: %v", fi.Mode)
} }
_, err = os.Lstat(wd+"/rw/file") _, err = os.Lstat(wd + "/rw/file")
if err != nil { if err != nil {
t.Errorf("File not promoted") t.Errorf("File not promoted")
} }
...@@ -220,19 +220,19 @@ func TestPromote(t *testing.T) { ...@@ -220,19 +220,19 @@ func TestPromote(t *testing.T) {
wd, state := setup(t) wd, state := setup(t)
defer state.Unmount() defer state.Unmount()
err := os.Mkdir(wd + "/ro/subdir", 0755) err := os.Mkdir(wd+"/ro/subdir", 0755)
CheckSuccess(err) CheckSuccess(err)
writeToFile(wd + "/ro/subdir/file", "content") writeToFile(wd+"/ro/subdir/file", "content")
writeToFile(wd + "/mount/subdir/file", "other-content") writeToFile(wd+"/mount/subdir/file", "other-content")
} }
func TestCreate(t *testing.T) { func TestCreate(t *testing.T) {
wd, state := setup(t) wd, state := setup(t)
defer state.Unmount() defer state.Unmount()
err := os.MkdirAll(wd + "/ro/subdir/sub2", 0755) err := os.MkdirAll(wd+"/ro/subdir/sub2", 0755)
CheckSuccess(err) CheckSuccess(err)
writeToFile(wd + "/mount/subdir/sub2/file", "other-content") writeToFile(wd+"/mount/subdir/sub2/file", "other-content")
_, err = os.Lstat(wd + "/mount/subdir/sub2/file") _, err = os.Lstat(wd + "/mount/subdir/sub2/file")
CheckSuccess(err) CheckSuccess(err)
} }
...@@ -241,10 +241,10 @@ func TestOpenUndeletes(t *testing.T) { ...@@ -241,10 +241,10 @@ func TestOpenUndeletes(t *testing.T) {
wd, state := setup(t) wd, state := setup(t)
defer state.Unmount() defer state.Unmount()
writeToFile(wd + "/ro/file", "X") writeToFile(wd+"/ro/file", "X")
err := os.Remove(wd + "/mount/file") err := os.Remove(wd + "/mount/file")
CheckSuccess(err) CheckSuccess(err)
writeToFile(wd + "/mount/file", "X") writeToFile(wd+"/mount/file", "X")
_, err = os.Lstat(wd + "/mount/file") _, err = os.Lstat(wd + "/mount/file")
CheckSuccess(err) CheckSuccess(err)
} }
...@@ -282,19 +282,19 @@ func TestRename(t *testing.T) { ...@@ -282,19 +282,19 @@ func TestRename(t *testing.T) {
t.Log("Config", i, c) t.Log("Config", i, c)
wd, state := setup(t) wd, state := setup(t)
if c.f1_ro { if c.f1_ro {
writeToFile(wd + "/ro/file1", "c1") writeToFile(wd+"/ro/file1", "c1")
} }
if c.f1_rw { if c.f1_rw {
writeToFile(wd + "/rw/file1", "c2") writeToFile(wd+"/rw/file1", "c2")
} }
if c.f2_ro { if c.f2_ro {
writeToFile(wd + "/ro/file2", "c3") writeToFile(wd+"/ro/file2", "c3")
} }
if c.f2_rw { if c.f2_rw {
writeToFile(wd + "/rw/file2", "c4") writeToFile(wd+"/rw/file2", "c4")
} }
err := os.Rename(wd + "/mount/file1", wd + "/mount/file2") err := os.Rename(wd+"/mount/file1", wd+"/mount/file2")
CheckSuccess(err) CheckSuccess(err)
_, err = os.Lstat(wd + "/mount/file1") _, err = os.Lstat(wd + "/mount/file1")
...@@ -304,7 +304,7 @@ func TestRename(t *testing.T) { ...@@ -304,7 +304,7 @@ func TestRename(t *testing.T) {
_, err = os.Lstat(wd + "/mount/file2") _, err = os.Lstat(wd + "/mount/file2")
CheckSuccess(err) CheckSuccess(err)
err = os.Rename(wd + "/mount/file2", wd + "/mount/file1") err = os.Rename(wd+"/mount/file2", wd+"/mount/file1")
CheckSuccess(err) CheckSuccess(err)
_, err = os.Lstat(wd + "/mount/file2") _, err = os.Lstat(wd + "/mount/file2")
...@@ -327,9 +327,9 @@ func TestWritableDir(t *testing.T) { ...@@ -327,9 +327,9 @@ func TestWritableDir(t *testing.T) {
err := os.Mkdir(dirname, 0555) err := os.Mkdir(dirname, 0555)
CheckSuccess(err) CheckSuccess(err)
fi, err := os.Lstat(wd+"/mount/subdir") fi, err := os.Lstat(wd + "/mount/subdir")
CheckSuccess(err) CheckSuccess(err)
if fi.Permission() & 0222 == 0 { if fi.Permission()&0222 == 0 {
t.Errorf("unexpected permission %o", fi.Permission()) t.Errorf("unexpected permission %o", fi.Permission())
} }
} }
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