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

Gofmt.

parent bf30f7b8
...@@ -13,7 +13,6 @@ import ( ...@@ -13,7 +13,6 @@ import (
"time" "time"
) )
func ReadLines(name string) []string { func ReadLines(name string) []string {
f, err := os.Open(name) f, err := os.Open(name)
if err != nil { if err != nil {
......
...@@ -157,7 +157,7 @@ func BenchmarkCFuseThreadedStat(b *testing.B) { ...@@ -157,7 +157,7 @@ func BenchmarkCFuseThreadedStat(b *testing.B) {
mountPoint) mountPoint)
cmd.Env = append(os.Environ(), cmd.Env = append(os.Environ(),
fmt.Sprintf("STATFS_INPUT=%s", f.Name()), fmt.Sprintf("STATFS_INPUT=%s", f.Name()),
fmt.Sprintf("STATFS_DELAY_USEC=%d", delay / time.Microsecond)) fmt.Sprintf("STATFS_DELAY_USEC=%d", delay/time.Microsecond))
cmd.Start() cmd.Start()
bin, err := exec.LookPath("fusermount") bin, err := exec.LookPath("fusermount")
......
...@@ -73,5 +73,5 @@ func main() { ...@@ -73,5 +73,5 @@ func main() {
gofs.SetFileSystemConnector(conn) gofs.SetFileSystemConnector(conn)
state.Loop() state.Loop()
time.Sleep(1 *time.Second) time.Sleep(1 * time.Second)
} }
...@@ -3,8 +3,8 @@ package main ...@@ -3,8 +3,8 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/benchmark" "github.com/hanwen/go-fuse/benchmark"
"github.com/hanwen/go-fuse/fuse"
"io" "io"
"log" "log"
"os" "os"
...@@ -52,7 +52,7 @@ func main() { ...@@ -52,7 +52,7 @@ func main() {
} }
nfs := fuse.NewPathNodeFs(fs, nil) nfs := fuse.NewPathNodeFs(fs, nil)
opts := &fuse.FileSystemOptions{ opts := &fuse.FileSystemOptions{
AttrTimeout: time.Duration(*ttl * float64(time.Second)), AttrTimeout: time.Duration(*ttl * float64(time.Second)),
EntryTimeout: time.Duration(*ttl * float64(time.Second)), EntryTimeout: time.Duration(*ttl * float64(time.Second)),
} }
state, _, err := fuse.MountNodeFileSystem(flag.Arg(0), nfs, opts) state, _, err := fuse.MountNodeFileSystem(flag.Arg(0), nfs, opts)
...@@ -60,7 +60,7 @@ func main() { ...@@ -60,7 +60,7 @@ func main() {
fmt.Printf("Mount fail: %v\n", err) fmt.Printf("Mount fail: %v\n", err)
os.Exit(1) os.Exit(1)
} }
state.SetRecordStatistics(*latencies) state.SetRecordStatistics(*latencies)
state.Debug = *debug state.Debug = *debug
runtime.GC() runtime.GC()
...@@ -75,7 +75,7 @@ func main() { ...@@ -75,7 +75,7 @@ func main() {
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
cmd.Start() cmd.Start()
} }
state.Loop() state.Loop()
if memProfFile != nil { if memProfFile != nil {
pprof.WriteHeapProfile(memProfFile) pprof.WriteHeapProfile(memProfFile)
......
...@@ -45,7 +45,7 @@ func main() { ...@@ -45,7 +45,7 @@ func main() {
log.Fatalf("os.Create: %v", err) log.Fatalf("os.Create: %v", err)
} }
} }
var fs fuse.NodeFileSystem var fs fuse.NodeFileSystem
fs, err = zipfs.NewArchiveFileSystem(flag.Arg(1)) fs, err = zipfs.NewArchiveFileSystem(flag.Arg(1))
if err != nil { if err != nil {
...@@ -54,7 +54,7 @@ func main() { ...@@ -54,7 +54,7 @@ func main() {
} }
opts := &fuse.FileSystemOptions{ opts := &fuse.FileSystemOptions{
AttrTimeout: time.Duration(*ttl * float64(time.Second)), AttrTimeout: time.Duration(*ttl * float64(time.Second)),
EntryTimeout: time.Duration(*ttl * float64(time.Second)), EntryTimeout: time.Duration(*ttl * float64(time.Second)),
} }
state, _, err := fuse.MountNodeFileSystem(flag.Arg(0), fs, opts) state, _, err := fuse.MountNodeFileSystem(flag.Arg(0), fs, opts)
...@@ -62,7 +62,7 @@ func main() { ...@@ -62,7 +62,7 @@ func main() {
fmt.Printf("Mount fail: %v\n", err) fmt.Printf("Mount fail: %v\n", err)
os.Exit(1) os.Exit(1)
} }
state.SetRecordStatistics(*latencies) state.SetRecordStatistics(*latencies)
state.Debug = *debug state.Debug = *debug
runtime.GC() runtime.GC()
...@@ -77,7 +77,7 @@ func main() { ...@@ -77,7 +77,7 @@ func main() {
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
cmd.Start() cmd.Start()
} }
state.Loop() state.Loop()
if memProfFile != nil { if memProfFile != nil {
pprof.WriteHeapProfile(memProfFile) pprof.WriteHeapProfile(memProfFile)
......
...@@ -77,7 +77,6 @@ type FsNode interface { ...@@ -77,7 +77,6 @@ type FsNode interface {
StatFs() *StatfsOut StatFs() *StatfsOut
} }
// A filesystem API that uses paths rather than inodes. A minimal // A filesystem API that uses paths rather than inodes. A minimal
// file system should have at least a functional GetAttr method. // file system should have at least a functional GetAttr method.
// Typically, each call happens in its own goroutine, so take care to // Typically, each call happens in its own goroutine, so take care to
...@@ -171,7 +170,7 @@ type File interface { ...@@ -171,7 +170,7 @@ type File interface {
// The methods below may be called on closed files, due to // The methods below may be called on closed files, due to
// concurrency. In that case, you should return EBADF. // concurrency. In that case, you should return EBADF.
Truncate(size uint64) Status Truncate(size uint64) Status
GetAttr(out *Attr) (Status) GetAttr(out *Attr) Status
Chown(uid uint32, gid uint32) Status Chown(uid uint32, gid uint32) Status
Chmod(perms uint32) Status Chmod(perms uint32) Status
Utimens(atimeNs int64, mtimeNs int64) Status Utimens(atimeNs int64, mtimeNs int64) Status
...@@ -279,7 +278,7 @@ type RawFileSystem interface { ...@@ -279,7 +278,7 @@ type RawFileSystem interface {
// File handling. // File handling.
Create(out *raw.CreateOut, header *raw.InHeader, input *raw.CreateIn, name string) (code Status) Create(out *raw.CreateOut, header *raw.InHeader, input *raw.CreateIn, name string) (code Status)
Open(out *raw.OpenOut, header *raw.InHeader, input *raw.OpenIn) (status Status) Open(out *raw.OpenOut, header *raw.InHeader, input *raw.OpenIn) (status Status)
Read(*raw.InHeader, *ReadIn, []byte) ReadResult Read(*raw.InHeader, *ReadIn, []byte) ReadResult
Release(header *raw.InHeader, input *raw.ReleaseIn) Release(header *raw.InHeader, input *raw.ReleaseIn)
Write(*raw.InHeader, *WriteIn, []byte) (written uint32, code Status) Write(*raw.InHeader, *WriteIn, []byte) (written uint32, code Status)
...@@ -288,7 +287,7 @@ type RawFileSystem interface { ...@@ -288,7 +287,7 @@ type RawFileSystem interface {
// Directory handling // Directory handling
OpenDir(out *raw.OpenOut, header *raw.InHeader, input *raw.OpenIn) (status Status) OpenDir(out *raw.OpenOut, header *raw.InHeader, input *raw.OpenIn) (status Status)
ReadDir(out *DirEntryList, header *raw.InHeader, input *ReadIn) (Status) ReadDir(out *DirEntryList, header *raw.InHeader, input *ReadIn) Status
ReleaseDir(header *raw.InHeader, input *raw.ReleaseIn) ReleaseDir(header *raw.InHeader, input *raw.ReleaseIn)
FsyncDir(header *raw.InHeader, input *raw.FsyncIn) (code Status) FsyncDir(header *raw.InHeader, input *raw.FsyncIn) (code Status)
......
...@@ -122,7 +122,6 @@ func (p *BufferPoolImpl) AllocBuffer(size uint32) []byte { ...@@ -122,7 +122,6 @@ func (p *BufferPoolImpl) AllocBuffer(size uint32) []byte {
} }
p.lock.Unlock() p.lock.Unlock()
return b return b
} }
......
...@@ -2,12 +2,12 @@ package fuse ...@@ -2,12 +2,12 @@ package fuse
import ( import (
"bytes" "bytes"
"github.com/hanwen/go-fuse/raw"
"io/ioutil" "io/ioutil"
"log" "log"
"os" "os"
"sync" "sync"
"testing" "testing"
"github.com/hanwen/go-fuse/raw"
) )
var _ = log.Println var _ = log.Println
......
...@@ -27,7 +27,7 @@ func CopyFile(srcFs, destFs FileSystem, srcFile, destFile string, context *Conte ...@@ -27,7 +27,7 @@ func CopyFile(srcFs, destFs FileSystem, srcFile, destFile string, context *Conte
defer dst.Release() defer dst.Release()
defer dst.Flush() defer dst.Flush()
buf := make([]byte, 128 * (1 << 10)) buf := make([]byte, 128*(1<<10))
off := int64(0) off := int64(0)
for { for {
res := src.Read(buf, off) res := src.Read(buf, off)
...@@ -35,7 +35,7 @@ func CopyFile(srcFs, destFs FileSystem, srcFile, destFile string, context *Conte ...@@ -35,7 +35,7 @@ func CopyFile(srcFs, destFs FileSystem, srcFile, destFile string, context *Conte
return res.Status return res.Status
} }
res.Read(buf) res.Read(buf)
if len(res.Data) == 0 { if len(res.Data) == 0 {
break break
} }
......
...@@ -31,7 +31,7 @@ type DefaultFsNode struct { ...@@ -31,7 +31,7 @@ type DefaultFsNode struct {
inode *Inode inode *Inode
} }
var _ = FsNode((*DefaultFsNode)(nil)) var _ = FsNode((*DefaultFsNode)(nil))
func (n *DefaultFsNode) StatFs() *StatfsOut { func (n *DefaultFsNode) StatFs() *StatfsOut {
return nil return nil
......
...@@ -6,7 +6,6 @@ import ( ...@@ -6,7 +6,6 @@ import (
var _ = RawFileSystem((*DefaultRawFileSystem)(nil)) var _ = RawFileSystem((*DefaultRawFileSystem)(nil))
func (fs *DefaultRawFileSystem) Init(init *RawFsInit) { func (fs *DefaultRawFileSystem) Init(init *RawFsInit) {
} }
...@@ -116,7 +115,7 @@ func (fs *DefaultRawFileSystem) Fsync(header *raw.InHeader, input *raw.FsyncIn) ...@@ -116,7 +115,7 @@ func (fs *DefaultRawFileSystem) Fsync(header *raw.InHeader, input *raw.FsyncIn)
return ENOSYS return ENOSYS
} }
func (fs *DefaultRawFileSystem) ReadDir(l *DirEntryList, header *raw.InHeader, input *ReadIn) ( Status) { func (fs *DefaultRawFileSystem) ReadDir(l *DirEntryList, header *raw.InHeader, input *ReadIn) Status {
return ENOSYS return ENOSYS
} }
......
...@@ -11,6 +11,7 @@ import ( ...@@ -11,6 +11,7 @@ import (
var _ = log.Print var _ = log.Print
var eightPadding [8]byte var eightPadding [8]byte
const direntSize = int(unsafe.Sizeof(raw.Dirent{})) const direntSize = int(unsafe.Sizeof(raw.Dirent{}))
// DirEntry is a type for PathFileSystem and NodeFileSystem to return // DirEntry is a type for PathFileSystem and NodeFileSystem to return
...@@ -21,13 +22,13 @@ type DirEntry struct { ...@@ -21,13 +22,13 @@ type DirEntry struct {
} }
type DirEntryList struct { type DirEntryList struct {
buf []byte buf []byte
offset uint64 offset uint64
} }
func NewDirEntryList(data []byte, off uint64) *DirEntryList { func NewDirEntryList(data []byte, off uint64) *DirEntryList {
return &DirEntryList{ return &DirEntryList{
buf: data[:0], buf: data[:0],
offset: off, offset: off,
} }
} }
...@@ -37,7 +38,7 @@ func (l *DirEntryList) AddDirEntry(e DirEntry) bool { ...@@ -37,7 +38,7 @@ func (l *DirEntryList) AddDirEntry(e DirEntry) bool {
} }
func (l *DirEntryList) Add(name string, inode uint64, mode uint32) bool { func (l *DirEntryList) Add(name string, inode uint64, mode uint32) bool {
padding := (8 - len(name)&7)&7 padding := (8 - len(name)&7) & 7
delta := padding + direntSize + len(name) delta := padding + direntSize + len(name)
oldLen := len(l.buf) oldLen := len(l.buf)
newLen := delta + oldLen newLen := delta + oldLen
...@@ -47,18 +48,18 @@ func (l *DirEntryList) Add(name string, inode uint64, mode uint32) bool { ...@@ -47,18 +48,18 @@ func (l *DirEntryList) Add(name string, inode uint64, mode uint32) bool {
} }
l.buf = l.buf[:newLen] l.buf = l.buf[:newLen]
dirent := (*raw.Dirent)(unsafe.Pointer(&l.buf[oldLen])) dirent := (*raw.Dirent)(unsafe.Pointer(&l.buf[oldLen]))
dirent.Off = l.offset+1 dirent.Off = l.offset + 1
dirent.Ino = inode dirent.Ino = inode
dirent.NameLen= uint32(len(name)) dirent.NameLen = uint32(len(name))
dirent.Typ = ModeToType(mode) dirent.Typ = ModeToType(mode)
oldLen += direntSize oldLen += direntSize
copy(l.buf[oldLen:], name) copy(l.buf[oldLen:], name)
oldLen += len(name) oldLen += len(name)
if padding > 0 { if padding > 0 {
copy(l.buf[oldLen:], eightPadding[:padding]) copy(l.buf[oldLen:], eightPadding[:padding])
} }
l.offset = dirent.Off l.offset = dirent.Off
return true return true
} }
...@@ -70,12 +71,12 @@ func (l *DirEntryList) Bytes() []byte { ...@@ -70,12 +71,12 @@ func (l *DirEntryList) Bytes() []byte {
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
type rawDir interface { type rawDir interface {
ReadDir(out *DirEntryList, input *ReadIn) (Status) ReadDir(out *DirEntryList, input *ReadIn) Status
Release() Release()
} }
type connectorDir struct { type connectorDir struct {
node FsNode node FsNode
stream []DirEntry stream []DirEntry
lastOffset uint64 lastOffset uint64
} }
......
...@@ -102,9 +102,9 @@ func (f *LoopbackFile) String() string { ...@@ -102,9 +102,9 @@ func (f *LoopbackFile) String() string {
func (f *LoopbackFile) Read(buf []byte, off int64) (res ReadResult) { func (f *LoopbackFile) Read(buf []byte, off int64) (res ReadResult) {
return ReadResult{ return ReadResult{
Fd: f.File.Fd(), Fd: f.File.Fd(),
FdOff: off, FdOff: off,
FdSize:len(buf), FdSize: len(buf),
Status: OK, Status: OK,
} }
} }
......
...@@ -79,7 +79,7 @@ func (c *FileSystemConnector) verify() { ...@@ -79,7 +79,7 @@ func (c *FileSystemConnector) verify() {
} }
// Generate EntryOut and increase the lookup count for an inode. // Generate EntryOut and increase the lookup count for an inode.
func (c *FileSystemConnector) childLookup(out *raw.EntryOut, fsi FsNode) { func (c *FileSystemConnector) childLookup(out *raw.EntryOut, fsi FsNode) {
n := fsi.Inode() n := fsi.Inode()
fsi.GetAttr((*Attr)(&out.Attr), nil, nil) fsi.GetAttr((*Attr)(&out.Attr), nil, nil)
n.mount.fillEntry(out) n.mount.fillEntry(out)
...@@ -99,7 +99,7 @@ func (c *FileSystemConnector) findMount(parent *Inode, name string) (mount *file ...@@ -99,7 +99,7 @@ func (c *FileSystemConnector) findMount(parent *Inode, name string) (mount *file
} }
parent.treeLock.RUnlock() parent.treeLock.RUnlock()
return return
} }
func (c *FileSystemConnector) toInode(nodeid uint64) *Inode { func (c *FileSystemConnector) toInode(nodeid uint64) *Inode {
...@@ -118,7 +118,7 @@ func (c *FileSystemConnector) lookupUpdate(node *Inode) uint64 { ...@@ -118,7 +118,7 @@ func (c *FileSystemConnector) lookupUpdate(node *Inode) uint64 {
} }
node.lookupCount += 1 node.lookupCount += 1
node.treeLock.Unlock() node.treeLock.Unlock()
return node.nodeId return node.nodeId
} }
...@@ -173,7 +173,7 @@ func (c *FileSystemConnector) recursiveConsiderDropInode(n *Inode) (drop bool) { ...@@ -173,7 +173,7 @@ func (c *FileSystemConnector) recursiveConsiderDropInode(n *Inode) (drop bool) {
n.openFilesMutex.Lock() n.openFilesMutex.Lock()
ok := len(n.openFiles) == 0 ok := len(n.openFiles) == 0
n.openFilesMutex.Unlock() n.openFilesMutex.Unlock()
return ok return ok
} }
......
...@@ -24,7 +24,7 @@ func (f *MutableDataFile) String() string { ...@@ -24,7 +24,7 @@ func (f *MutableDataFile) String() string {
func (f *MutableDataFile) Read(buf []byte, off int64) (r ReadResult) { func (f *MutableDataFile) Read(buf []byte, off int64) (r ReadResult) {
r.Data = f.data[off : off+int64(len(buf))] r.Data = f.data[off : off+int64(len(buf))]
return r return r
} }
func (f *MutableDataFile) Write(d []byte, off int64) (uint32, Status) { func (f *MutableDataFile) Write(d []byte, off int64) (uint32, Status) {
......
...@@ -4,7 +4,7 @@ import ( ...@@ -4,7 +4,7 @@ import (
"log" "log"
"sync" "sync"
"unsafe" "unsafe"
"github.com/hanwen/go-fuse/raw" "github.com/hanwen/go-fuse/raw"
) )
...@@ -65,7 +65,7 @@ func (m *fileSystemMount) fillEntry(out *raw.EntryOut) { ...@@ -65,7 +65,7 @@ func (m *fileSystemMount) fillEntry(out *raw.EntryOut) {
splitDuration(m.options.EntryTimeout, &out.EntryValid, &out.EntryValidNsec) splitDuration(m.options.EntryTimeout, &out.EntryValid, &out.EntryValidNsec)
splitDuration(m.options.AttrTimeout, &out.AttrValid, &out.AttrValidNsec) splitDuration(m.options.AttrTimeout, &out.AttrValid, &out.AttrValidNsec)
m.setOwner(&out.Attr) m.setOwner(&out.Attr)
if out.Mode & S_IFDIR == 0 && out.Nlink == 0 { if out.Mode&S_IFDIR == 0 && out.Nlink == 0 {
out.Nlink = 1 out.Nlink = 1
} }
} }
......
...@@ -114,7 +114,7 @@ func (c *FileSystemConnector) OpenDir(out *raw.OpenOut, header *raw.InHeader, in ...@@ -114,7 +114,7 @@ func (c *FileSystemConnector) OpenDir(out *raw.OpenOut, header *raw.InHeader, in
} }
stream = append(stream, node.getMountDirEntries()...) stream = append(stream, node.getMountDirEntries()...)
de := &connectorDir{ de := &connectorDir{
node: node.FsNode(), node: node.FsNode(),
stream: append(stream, DirEntry{S_IFDIR, "."}, DirEntry{S_IFDIR, ".."}), stream: append(stream, DirEntry{S_IFDIR, "."}, DirEntry{S_IFDIR, ".."}),
} }
h, opened := node.mount.registerFileHandle(node, de, nil, input.Flags) h, opened := node.mount.registerFileHandle(node, de, nil, input.Flags)
...@@ -123,7 +123,7 @@ func (c *FileSystemConnector) OpenDir(out *raw.OpenOut, header *raw.InHeader, in ...@@ -123,7 +123,7 @@ func (c *FileSystemConnector) OpenDir(out *raw.OpenOut, header *raw.InHeader, in
return OK return OK
} }
func (c *FileSystemConnector) ReadDir(l *DirEntryList, header *raw.InHeader, input *ReadIn) (Status) { func (c *FileSystemConnector) ReadDir(l *DirEntryList, header *raw.InHeader, input *ReadIn) Status {
node := c.toInode(header.NodeId) node := c.toInode(header.NodeId)
opened := node.mount.getOpenedFile(input.Fh) opened := node.mount.getOpenedFile(input.Fh)
return opened.dir.ReadDir(l, input) return opened.dir.ReadDir(l, input)
...@@ -350,10 +350,10 @@ func (c *FileSystemConnector) Write(header *raw.InHeader, input *WriteIn, data [ ...@@ -350,10 +350,10 @@ func (c *FileSystemConnector) Write(header *raw.InHeader, input *WriteIn, data [
return opened.WithFlags.File.Write(data, int64(input.Offset)) return opened.WithFlags.File.Write(data, int64(input.Offset))
} }
func (c *FileSystemConnector) Read(header *raw.InHeader, input *ReadIn, buf []byte) (ReadResult) { func (c *FileSystemConnector) Read(header *raw.InHeader, input *ReadIn, buf []byte) ReadResult {
node := c.toInode(header.NodeId) node := c.toInode(header.NodeId)
opened := node.mount.getOpenedFile(input.Fh) opened := node.mount.getOpenedFile(input.Fh)
return opened.WithFlags.File.Read(buf, int64(input.Offset)) return opened.WithFlags.File.Read(buf, int64(input.Offset))
} }
...@@ -372,4 +372,3 @@ func (c *FileSystemConnector) Flush(header *raw.InHeader, input *raw.FlushIn) St ...@@ -372,4 +372,3 @@ func (c *FileSystemConnector) Flush(header *raw.InHeader, input *raw.FlushIn) St
opened := node.mount.getOpenedFile(input.Fh) opened := node.mount.getOpenedFile(input.Fh)
return opened.WithFlags.File.Flush() return opened.WithFlags.File.Flush()
} }
...@@ -65,7 +65,7 @@ func (m *portableHandleMap) Register(obj *Handled, asInt interface{}) (handle ui ...@@ -65,7 +65,7 @@ func (m *portableHandleMap) Register(obj *Handled, asInt interface{}) (handle ui
func (m *portableHandleMap) Count() int { func (m *portableHandleMap) Count() int {
m.RLock() m.RLock()
c := m.used c := m.used
m.RUnlock() m.RUnlock()
return c return c
} }
......
...@@ -296,7 +296,7 @@ func (fs *LockingRawFileSystem) Fsync(header *raw.InHeader, input *raw.FsyncIn) ...@@ -296,7 +296,7 @@ func (fs *LockingRawFileSystem) Fsync(header *raw.InHeader, input *raw.FsyncIn)
return fs.RawFileSystem.Fsync(header, input) return fs.RawFileSystem.Fsync(header, input)
} }
func (fs *LockingRawFileSystem) ReadDir(out *DirEntryList, header *raw.InHeader, input *ReadIn) (Status) { func (fs *LockingRawFileSystem) ReadDir(out *DirEntryList, header *raw.InHeader, input *ReadIn) Status {
defer fs.locked()() defer fs.locked()()
return fs.RawFileSystem.ReadDir(out, header, input) return fs.RawFileSystem.ReadDir(out, header, input)
} }
......
...@@ -140,7 +140,7 @@ func TestReadLarge(t *testing.T) { ...@@ -140,7 +140,7 @@ func TestReadLarge(t *testing.T) {
defer ts.Cleanup() defer ts.Cleanup()
// Add a bit more to test the splicing at the end. // Add a bit more to test the splicing at the end.
content := make([]byte, 1024*1024 + 43) content := make([]byte, 1024*1024+43)
for i := range content { for i := range content {
content[i] = byte(i) content[i] = byte(i)
} }
......
...@@ -48,7 +48,7 @@ func TestMemNodeFsWrite(t *testing.T) { ...@@ -48,7 +48,7 @@ func TestMemNodeFsWrite(t *testing.T) {
err := ioutil.WriteFile(wd+"/test", []byte(want), 0644) err := ioutil.WriteFile(wd+"/test", []byte(want), 0644)
CheckSuccess(err) CheckSuccess(err)
content, err := ioutil.ReadFile(wd +"/test") content, err := ioutil.ReadFile(wd + "/test")
if string(content) != want { if string(content) != want {
t.Fatalf("content mismatch: got %q, want %q", content, want) t.Fatalf("content mismatch: got %q, want %q", content, want)
} }
......
...@@ -49,4 +49,3 @@ func TestLinkAt(t *testing.T) { ...@@ -49,4 +49,3 @@ func TestLinkAt(t *testing.T) {
t.Fatal("Ino mismatch", s1, s2) t.Fatal("Ino mismatch", s1, s2)
} }
} }
...@@ -2,8 +2,8 @@ package fuse ...@@ -2,8 +2,8 @@ package fuse
import ( import (
"fmt" "fmt"
"log"
"io" "io"
"log"
"os" "os"
"strings" "strings"
"sync" "sync"
...@@ -40,14 +40,14 @@ type MountState struct { ...@@ -40,14 +40,14 @@ type MountState struct {
opts *MountOptions opts *MountOptions
kernelSettings raw.InitIn kernelSettings raw.InitIn
reqMu sync.Mutex reqMu sync.Mutex
reqPool []*request reqPool []*request
readPool [][]byte readPool [][]byte
reqReaders int reqReaders int
outstandingReadBufs int outstandingReadBufs int
canSplice bool canSplice bool
loops sync.WaitGroup loops sync.WaitGroup
} }
func (ms *MountState) KernelSettings() raw.InitIn { func (ms *MountState) KernelSettings() raw.InitIn {
...@@ -163,7 +163,7 @@ func (ms *MountState) BufferPoolStats() string { ...@@ -163,7 +163,7 @@ func (ms *MountState) BufferPoolStats() string {
ms.reqMu.Unlock() ms.reqMu.Unlock()
s += fmt.Sprintf(" read buffers: %d (sz %d )", s += fmt.Sprintf(" read buffers: %d (sz %d )",
r, ms.opts.MaxWrite/PAGESIZE + 1) r, ms.opts.MaxWrite/PAGESIZE+1)
return s return s
} }
...@@ -192,7 +192,7 @@ func (ms *MountState) readRequest(exitIdle bool) (req *request, code Status) { ...@@ -192,7 +192,7 @@ func (ms *MountState) readRequest(exitIdle bool) (req *request, code Status) {
dest = ms.readPool[l-1] dest = ms.readPool[l-1]
ms.readPool = ms.readPool[:l-1] ms.readPool = ms.readPool[:l-1]
} else { } else {
dest = make([]byte, ms.opts.MaxWrite + PAGESIZE) dest = make([]byte, ms.opts.MaxWrite+PAGESIZE)
} }
ms.outstandingReadBufs++ ms.outstandingReadBufs++
ms.reqReaders++ ms.reqReaders++
...@@ -272,7 +272,7 @@ func (ms *MountState) Loop() { ...@@ -272,7 +272,7 @@ func (ms *MountState) Loop() {
func (ms *MountState) loop(exitIdle bool) { func (ms *MountState) loop(exitIdle bool) {
defer ms.loops.Done() defer ms.loops.Done()
exit: exit:
for { for {
req, errNo := ms.readRequest(exitIdle) req, errNo := ms.readRequest(exitIdle)
switch errNo { switch errNo {
...@@ -336,7 +336,6 @@ func (ms *MountState) AllocOut(req *request, size uint32) []byte { ...@@ -336,7 +336,6 @@ func (ms *MountState) AllocOut(req *request, size uint32) []byte {
return req.bufferPoolOutputBuf return req.bufferPoolOutputBuf
} }
func (ms *MountState) write(req *request) Status { func (ms *MountState) write(req *request) Status {
// Forget does not wait for reply. // Forget does not wait for reply.
if req.inHeader.Opcode == _OP_FORGET || req.inHeader.Opcode == _OP_BATCH_FORGET { if req.inHeader.Opcode == _OP_FORGET || req.inHeader.Opcode == _OP_BATCH_FORGET {
......
...@@ -67,9 +67,9 @@ const ( ...@@ -67,9 +67,9 @@ const (
func doInit(state *MountState, req *request) { func doInit(state *MountState, req *request) {
const ( const (
FUSE_KERNEL_VERSION = 7 FUSE_KERNEL_VERSION = 7
MINIMUM_MINOR_VERSION = 13 MINIMUM_MINOR_VERSION = 13
OUR_MINOR_VERSION = 16 OUR_MINOR_VERSION = 16
) )
input := (*raw.InitIn)(req.inData) input := (*raw.InitIn)(req.inData)
...@@ -93,7 +93,7 @@ func doInit(state *MountState, req *request) { ...@@ -93,7 +93,7 @@ func doInit(state *MountState, req *request) {
state.opts.MaxWrite = maxW state.opts.MaxWrite = maxW
} }
} }
out := &raw.InitOut{ out := &raw.InitOut{
Major: FUSE_KERNEL_VERSION, Major: FUSE_KERNEL_VERSION,
Minor: OUR_MINOR_VERSION, Minor: OUR_MINOR_VERSION,
...@@ -106,7 +106,7 @@ func doInit(state *MountState, req *request) { ...@@ -106,7 +106,7 @@ func doInit(state *MountState, req *request) {
if out.Minor > input.Minor { if out.Minor > input.Minor {
out.Minor = input.Minor out.Minor = input.Minor
} }
req.outData = unsafe.Pointer(out) req.outData = unsafe.Pointer(out)
req.status = OK req.status = OK
} }
...@@ -130,7 +130,7 @@ func doReadDir(state *MountState, req *request) { ...@@ -130,7 +130,7 @@ func doReadDir(state *MountState, req *request) {
in := (*ReadIn)(req.inData) in := (*ReadIn)(req.inData)
buf := state.AllocOut(req, in.Size) buf := state.AllocOut(req, in.Size)
entries := NewDirEntryList(buf, uint64(in.Offset)) entries := NewDirEntryList(buf, uint64(in.Offset))
code := state.fileSystem.ReadDir(entries, req.inHeader, in) code := state.fileSystem.ReadDir(entries, req.inHeader, in)
req.flatData.Data = entries.Bytes() req.flatData.Data = entries.Bytes()
req.status = code req.status = code
...@@ -180,8 +180,8 @@ func doGetXAttr(state *MountState, req *request) { ...@@ -180,8 +180,8 @@ func doGetXAttr(state *MountState, req *request) {
req.status = code req.status = code
return return
} }
req.outData = nil req.outData = nil
var data []byte var data []byte
switch req.inHeader.Opcode { switch req.inHeader.Opcode {
case _OP_GETXATTR: case _OP_GETXATTR:
...@@ -216,7 +216,7 @@ func doForget(state *MountState, req *request) { ...@@ -216,7 +216,7 @@ func doForget(state *MountState, req *request) {
func doBatchForget(state *MountState, req *request) { func doBatchForget(state *MountState, req *request) {
in := (*raw.BatchForgetIn)(req.inData) in := (*raw.BatchForgetIn)(req.inData)
wantBytes := uintptr(in.Count)*unsafe.Sizeof(raw.BatchForgetIn{}) wantBytes := uintptr(in.Count) * unsafe.Sizeof(raw.BatchForgetIn{})
if uintptr(len(req.arg)) < wantBytes { if uintptr(len(req.arg)) < wantBytes {
// We have no return value to complain, so log an error. // We have no return value to complain, so log an error.
log.Printf("Too few bytes for batch forget. Got %d bytes, want %d (%d entries)", log.Printf("Too few bytes for batch forget. Got %d bytes, want %d (%d entries)",
...@@ -244,7 +244,7 @@ func doLookup(state *MountState, req *request) { ...@@ -244,7 +244,7 @@ func doLookup(state *MountState, req *request) {
func doMknod(state *MountState, req *request) { func doMknod(state *MountState, req *request) {
out := (*raw.EntryOut)(req.outData) out := (*raw.EntryOut)(req.outData)
req.status = state.fileSystem.Mknod(out, req.inHeader, (*raw.MknodIn)(req.inData), req.filenames[0]) req.status = state.fileSystem.Mknod(out, req.inHeader, (*raw.MknodIn)(req.inData), req.filenames[0])
} }
...@@ -568,7 +568,7 @@ func init() { ...@@ -568,7 +568,7 @@ func init() {
var r request var r request
sizeOfOutHeader := unsafe.Sizeof(raw.OutHeader{}) sizeOfOutHeader := unsafe.Sizeof(raw.OutHeader{})
for code, h := range operationHandlers { for code, h := range operationHandlers {
if h.OutputSize + sizeOfOutHeader > unsafe.Sizeof(r.outBuf) { if h.OutputSize+sizeOfOutHeader > unsafe.Sizeof(r.outBuf) {
log.Panicf("request output buffer too small: code %v, sz %d + %d %v", code, h.OutputSize, sizeOfOutHeader, h) log.Panicf("request output buffer too small: code %v, sz %d + %d %v", code, h.OutputSize, sizeOfOutHeader, h)
} }
} }
......
...@@ -223,30 +223,30 @@ func (n *pathInode) GetPath() string { ...@@ -223,30 +223,30 @@ func (n *pathInode) GetPath() string {
if n == n.pathFs.root { if n == n.pathFs.root {
return "" return ""
} }
pathLen := 0 pathLen := 0
// The simple solution is to collect names, and reverse join // The simple solution is to collect names, and reverse join
// them, them, but since this is a hot path, we take some // them, them, but since this is a hot path, we take some
// effort to avoid allocations. // effort to avoid allocations.
n.pathFs.pathLock.RLock() n.pathFs.pathLock.RLock()
p := n p := n
for ; p.Parent != nil; p = p.Parent { for ; p.Parent != nil; p = p.Parent {
pathLen += len(p.Name) + 1 pathLen += len(p.Name) + 1
} }
pathLen-- pathLen--
if p != p.pathFs.root { if p != p.pathFs.root {
n.pathFs.pathLock.RUnlock() n.pathFs.pathLock.RUnlock()
return ".deleted" return ".deleted"
} }
pathBytes := make([]byte, pathLen) pathBytes := make([]byte, pathLen)
end := len(pathBytes) end := len(pathBytes)
for p = n; p.Parent != nil; p = p.Parent { for p = n; p.Parent != nil; p = p.Parent {
l := len(p.Name) l := len(p.Name)
copy(pathBytes[end - l:], p.Name) copy(pathBytes[end-l:], p.Name)
end -= len(p.Name) + 1 end -= len(p.Name) + 1
if end > 0 { if end > 0 {
pathBytes[end] = '/' pathBytes[end] = '/'
......
...@@ -46,7 +46,7 @@ func TestMemoryPressure(t *testing.T) { ...@@ -46,7 +46,7 @@ func TestMemoryPressure(t *testing.T) {
os.Lstat(dir) os.Lstat(dir)
var wg sync.WaitGroup var wg sync.WaitGroup
for i := 0; i < 10 * _MAX_READERS; i++ { for i := 0; i < 10*_MAX_READERS; i++ {
wg.Add(1) wg.Add(1)
go func(x int) { go func(x int) {
fn := fmt.Sprintf("%s/%ddir/file%d", dir, x, x) fn := fmt.Sprintf("%s/%ddir/file%d", dir, x, x)
...@@ -60,10 +60,9 @@ func TestMemoryPressure(t *testing.T) { ...@@ -60,10 +60,9 @@ func TestMemoryPressure(t *testing.T) {
time.Sleep(100 * time.Millisecond) time.Sleep(100 * time.Millisecond)
created := state.buffers.createdBuffers + state.outstandingReadBufs created := state.buffers.createdBuffers + state.outstandingReadBufs
t.Logf("Have %d read bufs", state.outstandingReadBufs) t.Logf("Have %d read bufs", state.outstandingReadBufs)
if created > 2 * _MAX_READERS { if created > 2*_MAX_READERS {
t.Errorf("created %d buffers, max reader %d", created, _MAX_READERS) t.Errorf("created %d buffers, max reader %d", created, _MAX_READERS)
} }
wg.Wait() wg.Wait()
} }
...@@ -11,7 +11,7 @@ type ReadResult struct { ...@@ -11,7 +11,7 @@ type ReadResult struct {
// If Data is nil and Status OK, splice from the following // If Data is nil and Status OK, splice from the following
// file. // file.
Fd uintptr Fd uintptr
// Offset within Fd, or -1 to use current offset. // Offset within Fd, or -1 to use current offset.
FdOff int64 FdOff int64
......
...@@ -17,17 +17,17 @@ type request struct { ...@@ -17,17 +17,17 @@ type request struct {
inputBuf []byte inputBuf []byte
// These split up inputBuf. // These split up inputBuf.
inHeader *raw.InHeader // generic header inHeader *raw.InHeader // generic header
inData unsafe.Pointer // per op data inData unsafe.Pointer // per op data
arg []byte // flat data. arg []byte // flat data.
filenames []string // filename arguments filenames []string // filename arguments
// Unstructured data, a pointer to the relevant XxxxOut struct. // Unstructured data, a pointer to the relevant XxxxOut struct.
outData unsafe.Pointer outData unsafe.Pointer
status Status status Status
flatData ReadResult flatData ReadResult
// Start timestamp for timing info. // Start timestamp for timing info.
startNs int64 startNs int64
preWriteNs int64 preWriteNs int64
...@@ -44,8 +44,8 @@ type request struct { ...@@ -44,8 +44,8 @@ type request struct {
// arrays: // arrays:
// //
// Output header and structured data. // Output header and structured data.
outBuf [160]byte outBuf [160]byte
// Input, if small enough to fit here. // Input, if small enough to fit here.
smallInputBuf [128]byte smallInputBuf [128]byte
} }
...@@ -123,10 +123,10 @@ func (r *request) setInput(input []byte) bool { ...@@ -123,10 +123,10 @@ func (r *request) setInput(input []byte) bool {
copy(r.smallInputBuf[:], input) copy(r.smallInputBuf[:], input)
r.inputBuf = r.smallInputBuf[:len(input)] r.inputBuf = r.smallInputBuf[:len(input)]
return false return false
} }
r.inputBuf = input r.inputBuf = input
r.bufferPoolInputBuf = input r.bufferPoolInputBuf = input
return true return true
} }
...@@ -198,4 +198,3 @@ func (r *request) serializeHeader() (header []byte) { ...@@ -198,4 +198,3 @@ func (r *request) serializeHeader() (header []byte) {
copy(header[sizeOfOutHeader:], asSlice) copy(header[sizeOfOutHeader:], asSlice)
return header return header
} }
package fuse package fuse
import ( import (
"github.com/hanwen/go-fuse/raw"
"os" "os"
"syscall" "syscall"
"github.com/hanwen/go-fuse/raw"
) )
const ( const (
...@@ -41,7 +41,6 @@ const ( ...@@ -41,7 +41,6 @@ const (
EROFS = Status(syscall.EROFS) EROFS = Status(syscall.EROFS)
) )
type Attr raw.Attr type Attr raw.Attr
type Owner raw.Owner type Owner raw.Owner
...@@ -78,4 +77,3 @@ type WriteIn struct { ...@@ -78,4 +77,3 @@ type WriteIn struct {
Flags uint32 Flags uint32
Padding uint32 Padding uint32
} }
...@@ -17,7 +17,6 @@ var xattrGolden = map[string][]byte{ ...@@ -17,7 +17,6 @@ var xattrGolden = map[string][]byte{
"user.attr2": []byte("val2")} "user.attr2": []byte("val2")}
var xattrFilename = "filename" var xattrFilename = "filename"
type XAttrTestFs struct { type XAttrTestFs struct {
tester *testing.T tester *testing.T
filename string filename string
...@@ -118,7 +117,7 @@ func TestXAttrNoExist(t *testing.T) { ...@@ -118,7 +117,7 @@ func TestXAttrNoExist(t *testing.T) {
nm := xattrFilename nm := xattrFilename
mountPoint, clean := xattrTestCase(t, nm) mountPoint, clean := xattrTestCase(t, nm)
defer clean() defer clean()
mounted := filepath.Join(mountPoint, nm) mounted := filepath.Join(mountPoint, nm)
_, err := os.Lstat(mounted) _, err := os.Lstat(mounted)
if err != nil { if err != nil {
......
package raw package raw
import ( import (
"fmt" "fmt"
"os" "os"
...@@ -24,8 +25,8 @@ func init() { ...@@ -24,8 +25,8 @@ func init() {
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",
} }
releaseFlagNames = map[int]string{ releaseFlagNames = map[int]string{
RELEASE_FLUSH: "FLUSH", RELEASE_FLUSH: "FLUSH",
...@@ -58,7 +59,7 @@ func init() { ...@@ -58,7 +59,7 @@ func init() {
W_OK: "w", W_OK: "w",
R_OK: "r", R_OK: "r",
} }
} }
func FlagString(names map[int]string, fl int, def string) string { func FlagString(names map[int]string, fl int, def string) string {
...@@ -78,7 +79,7 @@ func FlagString(names map[int]string, fl int, def string) string { ...@@ -78,7 +79,7 @@ func FlagString(names map[int]string, fl int, def string) string {
return strings.Join(s, ",") return strings.Join(s, ",")
} }
func (me *ForgetIn) String() string { func (me *ForgetIn) String() string {
return fmt.Sprintf("{%d}", me.Nlookup) return fmt.Sprintf("{%d}", me.Nlookup)
} }
...@@ -87,7 +88,6 @@ func (me *BatchForgetIn) String() string { ...@@ -87,7 +88,6 @@ func (me *BatchForgetIn) String() string {
return fmt.Sprintf("{%d}", me.Count) return fmt.Sprintf("{%d}", me.Count)
} }
func (me *MkdirIn) String() string { func (me *MkdirIn) String() string {
return fmt.Sprintf("{0%o (0%o)}", me.Mode, me.Umask) return fmt.Sprintf("{0%o (0%o)}", me.Mode, me.Umask)
} }
...@@ -127,7 +127,6 @@ func (me *GetAttrIn) String() string { ...@@ -127,7 +127,6 @@ func (me *GetAttrIn) String() string {
return fmt.Sprintf("{Fh %d}", me.Fh) return fmt.Sprintf("{Fh %d}", me.Fh)
} }
func (me *ReleaseIn) String() string { func (me *ReleaseIn) String() string {
return fmt.Sprintf("{Fh %d %s %s L%d}", return fmt.Sprintf("{Fh %d %s %s L%d}",
me.Fh, FlagString(OpenFlagNames, int(me.Flags), ""), me.Fh, FlagString(OpenFlagNames, int(me.Flags), ""),
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
package raw package raw
type ForgetIn struct { type ForgetIn struct {
Nlookup uint64 Nlookup uint64
} }
...@@ -18,7 +17,6 @@ type BatchForgetIn struct { ...@@ -18,7 +17,6 @@ type BatchForgetIn struct {
Dummy uint32 Dummy uint32
} }
type MkdirIn struct { type MkdirIn struct {
Mode uint32 Mode uint32
Umask uint32 Umask uint32
...@@ -31,7 +29,7 @@ type RenameIn struct { ...@@ -31,7 +29,7 @@ type RenameIn struct {
type LinkIn struct { type LinkIn struct {
Oldnodeid uint64 Oldnodeid uint64
} }
type MknodIn struct { type MknodIn struct {
Mode uint32 Mode uint32
Rdev uint32 Rdev uint32
...@@ -86,7 +84,6 @@ type GetAttrIn struct { ...@@ -86,7 +84,6 @@ type GetAttrIn struct {
Fh uint64 Fh uint64
} }
const RELEASE_FLUSH = (1 << 0) const RELEASE_FLUSH = (1 << 0)
type ReleaseIn struct { type ReleaseIn struct {
...@@ -289,7 +286,6 @@ type CreateIn struct { ...@@ -289,7 +286,6 @@ type CreateIn struct {
Padding uint32 Padding uint32
} }
type NotifyInvalInodeOut struct { type NotifyInvalInodeOut struct {
Ino uint64 Ino uint64
Off int64 Off int64
...@@ -370,7 +366,6 @@ type InHeader struct { ...@@ -370,7 +366,6 @@ type InHeader struct {
Padding uint32 Padding uint32
} }
type Kstatfs struct { type Kstatfs struct {
Blocks uint64 Blocks uint64
Bfree uint64 Bfree uint64
......
package splice package splice
import ( import (
"sync" "sync"
) )
...@@ -46,7 +47,6 @@ func (me *pairPool) used() int { ...@@ -46,7 +47,6 @@ func (me *pairPool) used() int {
return me.usedCount return me.usedCount
} }
func (me *pairPool) get() (p *Pair, err error) { func (me *pairPool) get() (p *Pair, err error) {
me.Lock() me.Lock()
defer me.Unlock() defer me.Unlock()
...@@ -58,7 +58,7 @@ func (me *pairPool) get() (p *Pair, err error) { ...@@ -58,7 +58,7 @@ func (me *pairPool) get() (p *Pair, err error) {
me.unused = me.unused[:l-1] me.unused = me.unused[:l-1]
return p, nil return p, nil
} }
return newSplicePair() return newSplicePair()
} }
......
...@@ -12,9 +12,8 @@ import ( ...@@ -12,9 +12,8 @@ import (
var _ = log.Println var _ = log.Println
var maxPipeSize int var maxPipeSize int
var resizable bool var resizable bool
func Resizable() bool { func Resizable() bool {
return resizable return resizable
...@@ -86,4 +85,3 @@ func newSplicePair() (p *Pair, err error) { ...@@ -86,4 +85,3 @@ func newSplicePair() (p *Pair, err error) {
} }
return p, nil return p, nil
} }
...@@ -9,7 +9,7 @@ func TestPairSize(t *testing.T) { ...@@ -9,7 +9,7 @@ func TestPairSize(t *testing.T) {
p, _ := Get() p, _ := Get()
defer Done(p) defer Done(p)
p.MaxGrow() p.MaxGrow()
b := make([]byte, p.Cap() + 100) b := make([]byte, p.Cap()+100)
for i := range b { for i := range b {
b[i] = byte(i) b[i] = byte(i)
} }
...@@ -24,9 +24,5 @@ func TestPairSize(t *testing.T) { ...@@ -24,9 +24,5 @@ func TestPairSize(t *testing.T) {
if err == nil { if err == nil {
t.Fatalf("should give error on exceeding capacity") t.Fatalf("should give error on exceeding capacity")
} }
}
}
...@@ -424,7 +424,7 @@ func (fs *AutoUnionFs) OpenDir(name string, context *fuse.Context) (stream []fus ...@@ -424,7 +424,7 @@ func (fs *AutoUnionFs) OpenDir(name string, context *fuse.Context) (stream []fus
fs.lock.RLock() fs.lock.RLock()
defer fs.lock.RUnlock() defer fs.lock.RUnlock()
stream = make( []fuse.DirEntry, 0, len(fs.knownFileSystems)+5) stream = make([]fuse.DirEntry, 0, len(fs.knownFileSystems)+5)
if name == _CONFIG { if name == _CONFIG {
for k := range fs.knownFileSystems { for k := range fs.knownFileSystems {
stream = append(stream, fuse.DirEntry{ stream = append(stream, fuse.DirEntry{
...@@ -439,10 +439,10 @@ func (fs *AutoUnionFs) OpenDir(name string, context *fuse.Context) (stream []fus ...@@ -439,10 +439,10 @@ func (fs *AutoUnionFs) OpenDir(name string, context *fuse.Context) (stream []fus
Name: _CONFIG, Name: _CONFIG,
Mode: uint32(fuse.S_IFDIR | 0755), Mode: uint32(fuse.S_IFDIR | 0755),
}, },
fuse.DirEntry{ fuse.DirEntry{
Name: _STATUS, Name: _STATUS,
Mode: uint32(fuse.S_IFDIR | 0755), Mode: uint32(fuse.S_IFDIR | 0755),
}) })
} }
return stream, status return stream, status
} }
......
...@@ -49,7 +49,7 @@ func readDir(fs fuse.FileSystem, name string) *dirResponse { ...@@ -49,7 +49,7 @@ func readDir(fs fuse.FileSystem, name string) *dirResponse {
if !code.Ok() { if !code.Ok() {
return r return r
} }
r.entries = origStream r.entries = origStream
return r return r
} }
......
...@@ -11,7 +11,7 @@ import ( ...@@ -11,7 +11,7 @@ import (
"syscall" "syscall"
"testing" "testing"
"time" "time"
"github.com/hanwen/go-fuse/fuse" "github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/raw" "github.com/hanwen/go-fuse/raw"
) )
......
...@@ -89,9 +89,9 @@ func (n *memNode) Deletable() bool { ...@@ -89,9 +89,9 @@ func (n *memNode) Deletable() bool {
return false return false
} }
func (n *memNode) GetAttr(out *fuse.Attr, file fuse.File, context *fuse.Context) (fuse.Status) { func (n *memNode) GetAttr(out *fuse.Attr, file fuse.File, context *fuse.Context) fuse.Status {
if n.Inode().IsDir() { if n.Inode().IsDir() {
out.Mode= fuse.S_IFDIR | 0777 out.Mode = fuse.S_IFDIR | 0777
return fuse.OK return fuse.OK
} }
n.file.Stat(out) n.file.Stat(out)
......
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