Commit 51f7cee9 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

all: run gofmt.

parent 408ce31f
...@@ -343,7 +343,7 @@ func (c *FileSystemConnector) Unmount(node *Inode) Status { ...@@ -343,7 +343,7 @@ func (c *FileSystemConnector) Unmount(node *Inode) Status {
// This operation is rare, so we kludge it to avoid // This operation is rare, so we kludge it to avoid
// contention. // contention.
time.Sleep(delay) time.Sleep(delay)
delay = delay * 2 + 1 delay = delay*2 + 1
if !c.inodeMap.Has(nodeId) { if !c.inodeMap.Has(nodeId) {
break break
} }
...@@ -351,10 +351,10 @@ func (c *FileSystemConnector) Unmount(node *Inode) Status { ...@@ -351,10 +351,10 @@ func (c *FileSystemConnector) Unmount(node *Inode) Status {
parentNode.mount.treeLock.Lock() parentNode.mount.treeLock.Lock()
mount.treeLock.Lock() mount.treeLock.Lock()
} }
mount.mountInode = nil mount.mountInode = nil
node.mountPoint = nil node.mountPoint = nil
return OK return OK
} }
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
) )
// HandleMap translates objects in Go space to 64-bit handles that can // HandleMap translates objects in Go space to 64-bit handles that can
// be given out to -say- the linux kernel. // be given out to -say- the linux kernel.
// //
// The 32 bits version of this is a threadsafe wrapper around a map. // The 32 bits version of this is a threadsafe wrapper around a map.
// //
......
...@@ -78,7 +78,7 @@ func TestMemoryPressure(t *testing.T) { ...@@ -78,7 +78,7 @@ func TestMemoryPressure(t *testing.T) {
}(i) }(i)
} }
time.Sleep(100 * time.Millisecond) time.Sleep(100 * time.Millisecond)
state.reqMu.Lock() state.reqMu.Lock()
bufs.lock.Lock() bufs.lock.Lock()
created := bufs.createdBuffers + state.outstandingReadBufs created := bufs.createdBuffers + state.outstandingReadBufs
...@@ -87,7 +87,7 @@ func TestMemoryPressure(t *testing.T) { ...@@ -87,7 +87,7 @@ func TestMemoryPressure(t *testing.T) {
t.Logf("Have %d read bufs", state.outstandingReadBufs) t.Logf("Have %d read bufs", state.outstandingReadBufs)
// +1 due to batch forget? // +1 due to batch forget?
if created > _MAX_READERS + 1 { if created > _MAX_READERS+1 {
t.Errorf("created %d buffers, max reader %d", created, _MAX_READERS) t.Errorf("created %d buffers, max reader %d", created, _MAX_READERS)
} }
......
...@@ -6,4 +6,3 @@ import ( ...@@ -6,4 +6,3 @@ import (
const syscall_O_LARGEFILE = syscall.O_LARGEFILE const syscall_O_LARGEFILE = syscall.O_LARGEFILE
const syscall_O_NOATIME = syscall.O_NOATIME const syscall_O_NOATIME = syscall.O_NOATIME
...@@ -24,22 +24,21 @@ func init() { ...@@ -24,22 +24,21 @@ func init() {
READ_LOCKOWNER: "LOCKOWNER", READ_LOCKOWNER: "LOCKOWNER",
} }
initFlagNames = map[int64]string{ initFlagNames = map[int64]string{
CAP_ASYNC_READ: "ASYNC_READ", CAP_ASYNC_READ: "ASYNC_READ",
CAP_POSIX_LOCKS: "POSIX_LOCKS", CAP_POSIX_LOCKS: "POSIX_LOCKS",
CAP_FILE_OPS: "FILE_OPS", CAP_FILE_OPS: "FILE_OPS",
CAP_ATOMIC_O_TRUNC: "ATOMIC_O_TRUNC", CAP_ATOMIC_O_TRUNC: "ATOMIC_O_TRUNC",
CAP_EXPORT_SUPPORT: "EXPORT_SUPPORT", CAP_EXPORT_SUPPORT: "EXPORT_SUPPORT",
CAP_BIG_WRITES: "BIG_WRITES", CAP_BIG_WRITES: "BIG_WRITES",
CAP_DONT_MASK: "DONT_MASK", CAP_DONT_MASK: "DONT_MASK",
CAP_SPLICE_WRITE: "SPLICE_WRITE", CAP_SPLICE_WRITE: "SPLICE_WRITE",
CAP_SPLICE_MOVE: "SPLICE_MOVE", CAP_SPLICE_MOVE: "SPLICE_MOVE",
CAP_SPLICE_READ: "SPLICE_READ", CAP_SPLICE_READ: "SPLICE_READ",
CAP_FLOCK_LOCKS: "FLOCK_LOCKS", CAP_FLOCK_LOCKS: "FLOCK_LOCKS",
CAP_IOCTL_DIR: "IOCTL_DIR", CAP_IOCTL_DIR: "IOCTL_DIR",
CAP_AUTO_INVAL_DATA: "AUTO_INVAL_DATA", CAP_AUTO_INVAL_DATA: "AUTO_INVAL_DATA",
CAP_READDIRPLUS: "READDIRPLUS", CAP_READDIRPLUS: "READDIRPLUS",
CAP_READDIRPLUS_AUTO: "READDIRPLUS_AUTO", CAP_READDIRPLUS_AUTO: "READDIRPLUS_AUTO",
} }
releaseFlagNames = map[int64]string{ releaseFlagNames = map[int64]string{
RELEASE_FLUSH: "FLUSH", RELEASE_FLUSH: "FLUSH",
......
package raw package raw
import ( import (
"fmt" "fmt"
) )
func init() { func init() {
......
package raw package raw
import ( import (
"fmt" "fmt"
"syscall" "syscall"
......
...@@ -92,8 +92,6 @@ const ( ...@@ -92,8 +92,6 @@ const (
FOPEN_DIRECT_IO = (1 << 0) FOPEN_DIRECT_IO = (1 << 0)
FOPEN_KEEP_CACHE = (1 << 1) FOPEN_KEEP_CACHE = (1 << 1)
FOPEN_NONSEEKABLE = (1 << 2) FOPEN_NONSEEKABLE = (1 << 2)
) )
type OpenOut struct { type OpenOut struct {
...@@ -104,20 +102,20 @@ type OpenOut struct { ...@@ -104,20 +102,20 @@ type OpenOut struct {
// To be set in InitIn/InitOut.Flags. // To be set in InitIn/InitOut.Flags.
const ( const (
CAP_ASYNC_READ = (1 << 0) CAP_ASYNC_READ = (1 << 0)
CAP_POSIX_LOCKS = (1 << 1) CAP_POSIX_LOCKS = (1 << 1)
CAP_FILE_OPS = (1 << 2) CAP_FILE_OPS = (1 << 2)
CAP_ATOMIC_O_TRUNC = (1 << 3) CAP_ATOMIC_O_TRUNC = (1 << 3)
CAP_EXPORT_SUPPORT = (1 << 4) CAP_EXPORT_SUPPORT = (1 << 4)
CAP_BIG_WRITES = (1 << 5) CAP_BIG_WRITES = (1 << 5)
CAP_DONT_MASK = (1 << 6) CAP_DONT_MASK = (1 << 6)
CAP_SPLICE_WRITE = (1 << 7) CAP_SPLICE_WRITE = (1 << 7)
CAP_SPLICE_MOVE = (1 << 8) CAP_SPLICE_MOVE = (1 << 8)
CAP_SPLICE_READ = (1 << 9) CAP_SPLICE_READ = (1 << 9)
CAP_FLOCK_LOCKS = (1 << 10) CAP_FLOCK_LOCKS = (1 << 10)
CAP_IOCTL_DIR = (1 << 11) CAP_IOCTL_DIR = (1 << 11)
CAP_AUTO_INVAL_DATA = (1 << 12) CAP_AUTO_INVAL_DATA = (1 << 12)
CAP_READDIRPLUS = (1 << 13) CAP_READDIRPLUS = (1 << 13)
CAP_READDIRPLUS_AUTO = (1 << 14) CAP_READDIRPLUS_AUTO = (1 << 14)
) )
...@@ -382,9 +380,9 @@ const ( ...@@ -382,9 +380,9 @@ const (
) )
type FallocateIn struct { type FallocateIn struct {
Fh uint64 Fh uint64
Offset uint64 Offset uint64
Length uint64 Length uint64
Mode uint32 Mode uint32
Padding uint32 Padding uint32
} }
package raw package raw
type Attr struct { type Attr struct {
Ino uint64 Ino uint64
Size uint64 Size uint64
Blocks uint64 Blocks uint64
Atime uint64 Atime uint64
Mtime uint64 Mtime uint64
Ctime uint64 Ctime uint64
Crtime_ uint64 // OS X Crtime_ uint64 // OS X
Atimensec uint32 Atimensec uint32
Mtimensec uint32 Mtimensec uint32
Ctimensec uint32 Ctimensec uint32
Crtimensec_ uint32 // OS X Crtimensec_ uint32 // OS X
Mode uint32 Mode uint32
Nlink uint32 Nlink uint32
Owner Owner
Rdev uint32 Rdev uint32
Flags_ uint32 // OS X Flags_ uint32 // OS X
} }
const ( const (
FATTR_CRTIME = (1 << 28) FATTR_CRTIME = (1 << 28)
FATTR_CHGTIME = (1 << 29) FATTR_CHGTIME = (1 << 29)
FATTR_BKUPTIME = (1 << 30) FATTR_BKUPTIME = (1 << 30)
FATTR_FLAGS = (1 << 31) FATTR_FLAGS = (1 << 31)
) )
type SetAttrIn struct { type SetAttrIn struct {
...@@ -40,8 +40,8 @@ type SetAttrIn struct { ...@@ -40,8 +40,8 @@ type SetAttrIn struct {
} }
const ( const (
FOPEN_PURGE_ATTR =(1 << 30) FOPEN_PURGE_ATTR = (1 << 30)
FOPEN_PURGE_UBC = (1 << 31) FOPEN_PURGE_UBC = (1 << 31)
) )
// compat with linux. // compat with linux.
...@@ -82,14 +82,14 @@ const ( ...@@ -82,14 +82,14 @@ const (
) )
type GetxtimesOut struct { type GetxtimesOut struct {
Bkuptime uint64 Bkuptime uint64
Crtime uint64 Crtime uint64
Bkuptimensec uint32 Bkuptimensec uint32
Crtimensec uint32 Crtimensec uint32
} }
type ExchangeIn struct { type ExchangeIn struct {
Olddir uint64 Olddir uint64
Newdir uint64 Newdir uint64
Options uint64 Options uint64
} }
...@@ -29,19 +29,18 @@ const ( ...@@ -29,19 +29,18 @@ const (
type GetAttrIn struct { type GetAttrIn struct {
Flags_ uint32 Flags_ uint32
Dummy uint32 Dummy uint32
Fh_ uint64 Fh_ uint64
} }
func (g *GetAttrIn) Flags() uint32 { func (g *GetAttrIn) Flags() uint32 {
return g.Flags_ return g.Flags_
} }
func (g *GetAttrIn) Fh() uint64 { func (g *GetAttrIn) Fh() uint64 {
return g.Fh_ return g.Fh_
} }
type ReadIn struct { type ReadIn struct {
Fh uint64 Fh uint64
Offset uint64 Offset uint64
...@@ -52,7 +51,6 @@ type ReadIn struct { ...@@ -52,7 +51,6 @@ type ReadIn struct {
Padding uint32 Padding uint32
} }
type WriteIn struct { type WriteIn struct {
Fh uint64 Fh uint64
Offset uint64 Offset uint64
......
...@@ -11,11 +11,10 @@ type Pair struct { ...@@ -11,11 +11,10 @@ type Pair struct {
} }
func (p *Pair) MaxGrow() { func (p *Pair) MaxGrow() {
for p.Grow(2 * p.size) == nil { for p.Grow(2*p.size) == nil {
} }
} }
func (p *Pair) Grow(n int) error { func (p *Pair) Grow(n int) error {
if n <= p.size { if n <= p.size {
return nil return nil
...@@ -63,5 +62,3 @@ func (p *Pair) WriteFd() uintptr { ...@@ -63,5 +62,3 @@ func (p *Pair) WriteFd() uintptr {
func (p *Pair) Write(d []byte) (n int, err error) { func (p *Pair) Write(d []byte) (n int, err error) {
return p.w.Write(d) return p.w.Write(d)
} }
package splice package splice
import ( import ()
)
func (p *Pair) LoadFromAt(fd uintptr, sz int, off int64) (int, error) { func (p *Pair) LoadFromAt(fd uintptr, sz int, off int64) (int, error) {
panic("not implemented") panic("not implemented")
......
...@@ -9,8 +9,8 @@ import ( ...@@ -9,8 +9,8 @@ import (
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"regexp" "regexp"
"strings"
"strconv" "strconv"
"strings"
"syscall" "syscall"
"testing" "testing"
"time" "time"
...@@ -44,7 +44,9 @@ func setRecursiveWritable(t *testing.T, dir string, writable bool) { ...@@ -44,7 +44,9 @@ func setRecursiveWritable(t *testing.T, dir string, writable bool) {
} else { } else {
newMode = uint32(fi.Mode().Perm()) &^ 0222 newMode = uint32(fi.Mode().Perm()) &^ 0222
} }
if fi.Mode() | os.ModeSymlink != 0 { return nil } if fi.Mode()|os.ModeSymlink != 0 {
return nil
}
return os.Chmod(path, os.FileMode(newMode)) return os.Chmod(path, os.FileMode(newMode))
}) })
if err != nil { if err != nil {
...@@ -950,7 +952,7 @@ func TestUnionFsRmRf(t *testing.T) { ...@@ -950,7 +952,7 @@ func TestUnionFsRmRf(t *testing.T) {
if err != nil { if err != nil {
t.Logf("ProgramVersion failed: %v", err) t.Logf("ProgramVersion failed: %v", err)
} }
if maj < 8 { // assuming GNU coreutils. if maj < 8 { // assuming GNU coreutils.
t.Skipf("Skipping test; GNU rm %d.%d is not POSIX compliant.", maj, min) t.Skipf("Skipping test; GNU rm %d.%d is not POSIX compliant.", maj, min)
} }
command := fmt.Sprintf("%s -f %s/mnt/dir", bin, wd) command := fmt.Sprintf("%s -f %s/mnt/dir", bin, wd)
......
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