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

Run gofmt.

parent 8bfc931c
...@@ -18,8 +18,8 @@ func main() { ...@@ -18,8 +18,8 @@ func main() {
deldirname := flag.String( deldirname := flag.String(
"deletion_dirname", "GOUNIONFS_DELETIONS", "Directory name to use for deletions.") "deletion_dirname", "GOUNIONFS_DELETIONS", "Directory name to use for deletions.")
hide_readonly_link := flag.Bool("hide_readonly_link", true, hide_readonly_link := flag.Bool("hide_readonly_link", true,
"Hides READONLY link from the top mountpoints. " + "Hides READONLY link from the top mountpoints. "+
"Enabled by default.") "Enabled by default.")
flag.Parse() flag.Parse()
if *version { if *version {
...@@ -48,7 +48,7 @@ func main() { ...@@ -48,7 +48,7 @@ func main() {
PathNodeFsOptions: fuse.PathNodeFsOptions{ PathNodeFsOptions: fuse.PathNodeFsOptions{
ClientInodes: *hardlinks, ClientInodes: *hardlinks,
}, },
HideReadonly: *hide_readonly_link, HideReadonly: *hide_readonly_link,
} }
fmt.Printf("AutoUnionFs - Go-FUSE Version %v.\n", fuse.Version()) fmt.Printf("AutoUnionFs - Go-FUSE Version %v.\n", fuse.Version())
......
...@@ -17,7 +17,6 @@ type BufferPool interface { ...@@ -17,7 +17,6 @@ type BufferPool interface {
} }
type GcBufferPool struct { type GcBufferPool struct {
} }
// NewGcBufferPool is just a fallback to the standard allocation routines. // NewGcBufferPool is just a fallback to the standard allocation routines.
......
...@@ -40,7 +40,7 @@ func (me *FileSystemConnector) internalLookup(parent *Inode, name string, contex ...@@ -40,7 +40,7 @@ func (me *FileSystemConnector) internalLookup(parent *Inode, name string, contex
} else { } else {
fi, fsNode, code = parent.fsInode.Lookup(name, context) fi, fsNode, code = parent.fsInode.Lookup(name, context)
} }
if child == nil && fsNode != nil { if child == nil && fsNode != nil {
child = fsNode.Inode() child = fsNode.Inode()
} }
...@@ -51,7 +51,7 @@ func (me *FileSystemConnector) internalLookup(parent *Inode, name string, contex ...@@ -51,7 +51,7 @@ func (me *FileSystemConnector) internalLookup(parent *Inode, name string, contex
func (me *FileSystemConnector) Lookup(header *InHeader, name string) (out *EntryOut, code Status) { func (me *FileSystemConnector) Lookup(header *InHeader, name string) (out *EntryOut, code Status) {
parent := me.toInode(header.NodeId) parent := me.toInode(header.NodeId)
if !parent.IsDir() { if !parent.IsDir() {
log.Printf("Lookup %q called on non-Directory node %d", name, header.NodeId) log.Printf("Lookup %q called on non-Directory node %d", name, header.NodeId)
return nil, ENOTDIR return nil, ENOTDIR
} }
context := &header.Context context := &header.Context
......
...@@ -33,6 +33,7 @@ type Handled struct { ...@@ -33,6 +33,7 @@ type Handled struct {
} }
const _ALREADY_MSG = "Object already has a handle" const _ALREADY_MSG = "Object already has a handle"
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// portable version using 32 bit integers. // portable version using 32 bit integers.
......
...@@ -283,9 +283,9 @@ func TestLinkExisting(t *testing.T) { ...@@ -283,9 +283,9 @@ func TestLinkExisting(t *testing.T) {
CheckSuccess(err) CheckSuccess(err)
var s1, s2 syscall.Stat_t var s1, s2 syscall.Stat_t
err = syscall.Lstat(me.mnt + "/file1", &s1) err = syscall.Lstat(me.mnt+"/file1", &s1)
CheckSuccess(err) CheckSuccess(err)
err = syscall.Lstat(me.mnt + "/file2", &s2) err = syscall.Lstat(me.mnt+"/file2", &s2)
CheckSuccess(err) CheckSuccess(err)
if s1.Ino != s2.Ino { if s1.Ino != s2.Ino {
...@@ -313,12 +313,12 @@ func TestLinkForget(t *testing.T) { ...@@ -313,12 +313,12 @@ func TestLinkForget(t *testing.T) {
CheckSuccess(err) CheckSuccess(err)
var s1, s2 syscall.Stat_t var s1, s2 syscall.Stat_t
err = syscall.Lstat(me.mnt + "/file1", &s1) err = syscall.Lstat(me.mnt+"/file1", &s1)
CheckSuccess(err) CheckSuccess(err)
me.pathFs.ForgetClientInodes() me.pathFs.ForgetClientInodes()
err = syscall.Lstat(me.mnt + "/file2", &s2) err = syscall.Lstat(me.mnt+"/file2", &s2)
CheckSuccess(err) CheckSuccess(err)
if s1.Ino == s2.Ino { if s1.Ino == s2.Ino {
t.Error("After forget, we should not export links") t.Error("After forget, we should not export links")
......
...@@ -36,11 +36,11 @@ func TestLinkAt(t *testing.T) { ...@@ -36,11 +36,11 @@ func TestLinkAt(t *testing.T) {
} }
var s1, s2 syscall.Stat_t var s1, s2 syscall.Stat_t
err := syscall.Lstat(dir + "/a", &s1) err := syscall.Lstat(dir+"/a", &s1)
if err != nil { if err != nil {
t.Fatalf("Lstat a: %v", err) t.Fatalf("Lstat a: %v", err)
} }
err = syscall.Lstat(dir + "/b", &s2) err = syscall.Lstat(dir+"/b", &s2)
if err != nil { if err != nil {
t.Fatalf("Lstat b: %v", err) t.Fatalf("Lstat b: %v", err)
} }
......
...@@ -166,7 +166,7 @@ func doGetXAttr(state *MountState, req *request) { ...@@ -166,7 +166,7 @@ func doGetXAttr(state *MountState, req *request) {
sz, code := state.fileSystem.GetXAttrSize(req.inHeader, req.filenames[0]) sz, code := state.fileSystem.GetXAttrSize(req.inHeader, req.filenames[0])
if code.Ok() { if code.Ok() {
out := &GetXAttrOut{ out := &GetXAttrOut{
Size: uint32(sz), Size: uint32(sz),
} }
req.outData = unsafe.Pointer(out) req.outData = unsafe.Pointer(out)
req.status = ERANGE req.status = ERANGE
...@@ -182,7 +182,7 @@ func doGetXAttr(state *MountState, req *request) { ...@@ -182,7 +182,7 @@ func doGetXAttr(state *MountState, req *request) {
if len(data) > int(input.Size) { if len(data) > int(input.Size) {
req.status = ERANGE req.status = ERANGE
} }
if !req.status.Ok() { if !req.status.Ok() {
return return
} }
......
...@@ -46,7 +46,7 @@ func TestOwnerDefault(t *testing.T) { ...@@ -46,7 +46,7 @@ func TestOwnerDefault(t *testing.T) {
defer cleanup() defer cleanup()
var stat syscall.Stat_t var stat syscall.Stat_t
err := syscall.Lstat(wd + "/foo", &stat) err := syscall.Lstat(wd+"/foo", &stat)
CheckSuccess(err) CheckSuccess(err)
if int(stat.Uid) != os.Getuid() || int(stat.Gid) != os.Getgid() { if int(stat.Uid) != os.Getuid() || int(stat.Gid) != os.Getgid() {
...@@ -59,7 +59,7 @@ func TestOwnerRoot(t *testing.T) { ...@@ -59,7 +59,7 @@ func TestOwnerRoot(t *testing.T) {
defer cleanup() defer cleanup()
var st syscall.Stat_t var st syscall.Stat_t
err := syscall.Lstat(wd + "/foo", &st) err := syscall.Lstat(wd+"/foo", &st)
CheckSuccess(err) CheckSuccess(err)
if st.Uid != _RANDOM_OWNER || st.Gid != _RANDOM_OWNER { if st.Uid != _RANDOM_OWNER || st.Gid != _RANDOM_OWNER {
...@@ -72,7 +72,7 @@ func TestOwnerOverride(t *testing.T) { ...@@ -72,7 +72,7 @@ func TestOwnerOverride(t *testing.T) {
defer cleanup() defer cleanup()
var stat syscall.Stat_t var stat syscall.Stat_t
err := syscall.Lstat(wd + "/foo", &stat) err := syscall.Lstat(wd+"/foo", &stat)
CheckSuccess(err) CheckSuccess(err)
if stat.Uid != 42 || stat.Gid != 43 { if stat.Uid != 42 || stat.Gid != 43 {
......
...@@ -21,16 +21,16 @@ func init() { ...@@ -21,16 +21,16 @@ func init() {
RELEASE_FLUSH: "FLUSH", RELEASE_FLUSH: "FLUSH",
} }
openFlagNames = map[int]string{ openFlagNames = map[int]string{
os.O_WRONLY: "WRONLY", os.O_WRONLY: "WRONLY",
os.O_RDWR: "RDWR", os.O_RDWR: "RDWR",
os.O_APPEND: "APPEND", os.O_APPEND: "APPEND",
syscall.O_ASYNC: "ASYNC", syscall.O_ASYNC: "ASYNC",
os.O_CREATE: "CREAT", os.O_CREATE: "CREAT",
os.O_EXCL: "EXCL", os.O_EXCL: "EXCL",
syscall.O_NOCTTY: "NOCTTY", syscall.O_NOCTTY: "NOCTTY",
syscall.O_NONBLOCK: "NONBLOCK", syscall.O_NONBLOCK: "NONBLOCK",
os.O_SYNC: "SYNC", os.O_SYNC: "SYNC",
os.O_TRUNC: "TRUNC", os.O_TRUNC: "TRUNC",
syscall.O_CLOEXEC: "CLOEXEC", syscall.O_CLOEXEC: "CLOEXEC",
syscall.O_DIRECT: "DIRECT", syscall.O_DIRECT: "DIRECT",
......
...@@ -5,7 +5,6 @@ import ( ...@@ -5,7 +5,6 @@ import (
"syscall" "syscall"
) )
const ( const (
FUSE_ROOT_ID = 1 FUSE_ROOT_ID = 1
......
...@@ -82,7 +82,7 @@ func (me *AutoUnionFs) String() string { ...@@ -82,7 +82,7 @@ func (me *AutoUnionFs) String() string {
func (me *AutoUnionFs) OnMount(nodeFs *fuse.PathNodeFs) { func (me *AutoUnionFs) OnMount(nodeFs *fuse.PathNodeFs) {
me.nodeFs = nodeFs me.nodeFs = nodeFs
if me.options.UpdateOnMount { if me.options.UpdateOnMount {
time.AfterFunc(100 * time.Millisecond, func() { me.updateKnownFses() }) time.AfterFunc(100*time.Millisecond, func() { me.updateKnownFses() })
} }
} }
...@@ -356,9 +356,9 @@ func (me *AutoUnionFs) DebugData() string { ...@@ -356,9 +356,9 @@ func (me *AutoUnionFs) DebugData() string {
} }
setting := me.mountState.KernelSettings() setting := me.mountState.KernelSettings()
msg := fmt.Sprintf( msg := fmt.Sprintf(
"Version: %v\n" + "Version: %v\n"+
"Bufferpool: %v\n" + "Bufferpool: %v\n"+
"Kernel: %v\n", "Kernel: %v\n",
fuse.Version(), fuse.Version(),
me.mountState.BufferPoolStats(), me.mountState.BufferPoolStats(),
&setting) &setting)
......
...@@ -14,7 +14,6 @@ import ( ...@@ -14,7 +14,6 @@ import (
"time" "time"
) )
func filePathHash(path string) string { func filePathHash(path string) string {
dir, base := filepath.Split(path) dir, base := filepath.Split(path)
......
...@@ -26,7 +26,7 @@ var testOpts = UnionFsOptions{ ...@@ -26,7 +26,7 @@ var testOpts = UnionFsOptions{
DeletionCacheTTL: entryTtl, DeletionCacheTTL: entryTtl,
DeletionDirName: "DELETIONS", DeletionDirName: "DELETIONS",
BranchCacheTTL: entryTtl, BranchCacheTTL: entryTtl,
HiddenFiles: []string{ "hidden" }, HiddenFiles: []string{"hidden"},
} }
func freezeRo(dir string) { func freezeRo(dir string) {
...@@ -64,8 +64,8 @@ func setupUfs(t *testing.T) (workdir string, cleanup func()) { ...@@ -64,8 +64,8 @@ func setupUfs(t *testing.T) (workdir string, cleanup func()) {
// We configure timeouts are smaller, so we can check for // We configure timeouts are smaller, so we can check for
// UnionFs's cache consistency. // UnionFs's cache consistency.
opts := &fuse.FileSystemOptions{ opts := &fuse.FileSystemOptions{
EntryTimeout: entryTtl / 2, EntryTimeout: entryTtl / 2,
AttrTimeout: entryTtl / 2, AttrTimeout: entryTtl / 2,
NegativeTimeout: entryTtl / 2, NegativeTimeout: entryTtl / 2,
} }
...@@ -302,7 +302,7 @@ func TestUnionFsBasic(t *testing.T) { ...@@ -302,7 +302,7 @@ func TestUnionFsBasic(t *testing.T) {
names = dirNames(wd + "/rw") names = dirNames(wd + "/rw")
checkMapEq(t, names, map[string]bool{ checkMapEq(t, names, map[string]bool{
testOpts.DeletionDirName: true, testOpts.DeletionDirName: true,
"rw": true, "ro1": true, "rw": true, "ro1": true,
}) })
names = dirNames(wd + "/rw/" + testOpts.DeletionDirName) names = dirNames(wd + "/rw/" + testOpts.DeletionDirName)
if len(names) != 0 { if len(names) != 0 {
...@@ -763,7 +763,7 @@ func TestUnionFsRmRf(t *testing.T) { ...@@ -763,7 +763,7 @@ func TestUnionFsRmRf(t *testing.T) {
bin, err := exec.LookPath("rm") bin, err := exec.LookPath("rm")
CheckSuccess(err) CheckSuccess(err)
command := fmt.Sprintf("%s -f %s/mnt/dir", bin, wd); command := fmt.Sprintf("%s -f %s/mnt/dir", bin, wd)
log.Printf("Command: %s", command) log.Printf("Command: %s", command)
names, _ := Readdirnames(wd + "/mnt/dir") names, _ := Readdirnames(wd + "/mnt/dir")
log.Printf("Contents of %s/mnt/dir: %s", wd, strings.Join(names, ", ")) log.Printf("Contents of %s/mnt/dir: %s", wd, strings.Join(names, ", "))
...@@ -886,8 +886,8 @@ func TestUnionFsDisappearing(t *testing.T) { ...@@ -886,8 +886,8 @@ func TestUnionFsDisappearing(t *testing.T) {
ufs := NewUnionFs(fses, testOpts) ufs := NewUnionFs(fses, testOpts)
opts := &fuse.FileSystemOptions{ opts := &fuse.FileSystemOptions{
EntryTimeout: entryTtl, EntryTimeout: entryTtl,
AttrTimeout: entryTtl, AttrTimeout: entryTtl,
NegativeTimeout: entryTtl, NegativeTimeout: entryTtl,
} }
......
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