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

Drop Fuse from all identifier names.

parent 6dbddc38
...@@ -39,7 +39,7 @@ func main() { ...@@ -39,7 +39,7 @@ func main() {
fmt.Printf("Mounting...\n") fmt.Printf("Mounting...\n")
err := mountState.Mount(mountpoint) err := mountState.Mount(mountpoint)
if err != nil { if err != nil {
fmt.Printf("MountFuse fail: %v\n", err) fmt.Printf("Mount fail: %v\n", err)
os.Exit(1) os.Exit(1)
} }
fmt.Printf("Mounted!\n") fmt.Printf("Mounted!\n")
......
...@@ -62,7 +62,7 @@ func main() { ...@@ -62,7 +62,7 @@ func main() {
mountPoint := flag.Arg(0) mountPoint := flag.Arg(0)
err := state.Mount(mountPoint) err := state.Mount(mountPoint)
if err != nil { if err != nil {
fmt.Printf("MountFuse fail: %v\n", err) fmt.Printf("Mount fail: %v\n", err)
os.Exit(1) os.Exit(1)
} }
......
...@@ -36,7 +36,7 @@ func main() { ...@@ -36,7 +36,7 @@ func main() {
fmt.Printf("Mounting...\n") fmt.Printf("Mounting...\n")
err := mountState.Mount(mountpoint) err := mountState.Mount(mountpoint)
if err != nil { if err != nil {
fmt.Printf("MountFuse fail: %v\n", err) fmt.Printf("Mount fail: %v\n", err)
os.Exit(1) os.Exit(1)
} }
fmt.Printf("Mounted!\n") fmt.Printf("Mounted!\n")
......
...@@ -5,7 +5,7 @@ package fuse ...@@ -5,7 +5,7 @@ package fuse
type ReadOnlyFile struct { type ReadOnlyFile struct {
data []byte data []byte
DefaultFuseFile DefaultFile
} }
func NewReadOnlyFile(data []byte) *ReadOnlyFile { func NewReadOnlyFile(data []byte) *ReadOnlyFile {
......
...@@ -6,155 +6,155 @@ import ( ...@@ -6,155 +6,155 @@ import (
var _ = log.Println var _ = log.Println
func (me *DefaultRawFuseFileSystem) Init(h *InHeader, input *InitIn) (*InitOut, Status) { func (me *DefaultRawFileSystem) Init(h *InHeader, input *InitIn) (*InitOut, Status) {
return new(InitOut), OK return new(InitOut), OK
} }
func (me *DefaultRawFuseFileSystem) Destroy(h *InHeader, input *InitIn) { func (me *DefaultRawFileSystem) Destroy(h *InHeader, input *InitIn) {
} }
func (me *DefaultRawFuseFileSystem) Lookup(h *InHeader, name string) (out *EntryOut, code Status) { func (me *DefaultRawFileSystem) Lookup(h *InHeader, name string) (out *EntryOut, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Forget(h *InHeader, input *ForgetIn) { func (me *DefaultRawFileSystem) Forget(h *InHeader, input *ForgetIn) {
} }
func (me *DefaultRawFuseFileSystem) GetAttr(header *InHeader, input *GetAttrIn) (out *AttrOut, code Status) { func (me *DefaultRawFileSystem) GetAttr(header *InHeader, input *GetAttrIn) (out *AttrOut, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Open(header *InHeader, input *OpenIn) (flags uint32, handle uint64, status Status) { func (me *DefaultRawFileSystem) Open(header *InHeader, input *OpenIn) (flags uint32, handle uint64, status Status) {
return 0, 0, OK return 0, 0, OK
} }
func (me *DefaultRawFuseFileSystem) SetAttr(header *InHeader, input *SetAttrIn) (out *AttrOut, code Status) { func (me *DefaultRawFileSystem) SetAttr(header *InHeader, input *SetAttrIn) (out *AttrOut, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Readlink(header *InHeader) (out []byte, code Status) { func (me *DefaultRawFileSystem) Readlink(header *InHeader) (out []byte, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Mknod(header *InHeader, input *MknodIn, name string) (out *EntryOut, code Status) { func (me *DefaultRawFileSystem) Mknod(header *InHeader, input *MknodIn, name string) (out *EntryOut, code Status) {
return new(EntryOut), ENOSYS return new(EntryOut), ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Mkdir(header *InHeader, input *MkdirIn, name string) (out *EntryOut, code Status) { func (me *DefaultRawFileSystem) Mkdir(header *InHeader, input *MkdirIn, name string) (out *EntryOut, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Unlink(header *InHeader, name string) (code Status) { func (me *DefaultRawFileSystem) Unlink(header *InHeader, name string) (code Status) {
return ENOSYS return ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Rmdir(header *InHeader, name string) (code Status) { func (me *DefaultRawFileSystem) Rmdir(header *InHeader, name string) (code Status) {
return ENOSYS return ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Symlink(header *InHeader, pointedTo string, linkName string) (out *EntryOut, code Status) { func (me *DefaultRawFileSystem) Symlink(header *InHeader, pointedTo string, linkName string) (out *EntryOut, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Rename(header *InHeader, input *RenameIn, oldName string, newName string) (code Status) { func (me *DefaultRawFileSystem) Rename(header *InHeader, input *RenameIn, oldName string, newName string) (code Status) {
return ENOSYS return ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Link(header *InHeader, input *LinkIn, name string) (out *EntryOut, code Status) { func (me *DefaultRawFileSystem) Link(header *InHeader, input *LinkIn, name string) (out *EntryOut, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) GetXAttr(header *InHeader, attr string) (data []byte, code Status) { func (me *DefaultRawFileSystem) GetXAttr(header *InHeader, attr string) (data []byte, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) SetXAttr(header *InHeader, input *SetXAttrIn, attr string, data []byte) Status { func (me *DefaultRawFileSystem) SetXAttr(header *InHeader, input *SetXAttrIn, attr string, data []byte) Status {
return ENOSYS return ENOSYS
} }
func (me *DefaultRawFuseFileSystem) ListXAttr(header *InHeader) (data []byte, code Status) { func (me *DefaultRawFileSystem) ListXAttr(header *InHeader) (data []byte, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) RemoveXAttr(header *InHeader, attr string) Status { func (me *DefaultRawFileSystem) RemoveXAttr(header *InHeader, attr string) Status {
return ENOSYS return ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Access(header *InHeader, input *AccessIn) (code Status) { func (me *DefaultRawFileSystem) Access(header *InHeader, input *AccessIn) (code Status) {
return ENOSYS return ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Create(header *InHeader, input *CreateIn, name string) (flags uint32, handle uint64, out *EntryOut, code Status) { func (me *DefaultRawFileSystem) Create(header *InHeader, input *CreateIn, name string) (flags uint32, handle uint64, out *EntryOut, code Status) {
return 0, 0, nil, ENOSYS return 0, 0, nil, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Bmap(header *InHeader, input *BmapIn) (out *BmapOut, code Status) { func (me *DefaultRawFileSystem) Bmap(header *InHeader, input *BmapIn) (out *BmapOut, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Ioctl(header *InHeader, input *IoctlIn) (out *IoctlOut, code Status) { func (me *DefaultRawFileSystem) Ioctl(header *InHeader, input *IoctlIn) (out *IoctlOut, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Poll(header *InHeader, input *PollIn) (out *PollOut, code Status) { func (me *DefaultRawFileSystem) Poll(header *InHeader, input *PollIn) (out *PollOut, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) OpenDir(header *InHeader, input *OpenIn) (flags uint32, handle uint64, status Status) { func (me *DefaultRawFileSystem) OpenDir(header *InHeader, input *OpenIn) (flags uint32, handle uint64, status Status) {
return 0, 0, ENOSYS return 0, 0, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Read(*ReadIn, *BufferPool) ([]byte, Status) { func (me *DefaultRawFileSystem) Read(*ReadIn, *BufferPool) ([]byte, Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Release(header *InHeader, input *ReleaseIn) { func (me *DefaultRawFileSystem) Release(header *InHeader, input *ReleaseIn) {
} }
func (me *DefaultRawFuseFileSystem) Write(input *WriteIn, data []byte) (written uint32, code Status) { func (me *DefaultRawFileSystem) Write(input *WriteIn, data []byte) (written uint32, code Status) {
return 0, ENOSYS return 0, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) Flush(input *FlushIn) Status { func (me *DefaultRawFileSystem) Flush(input *FlushIn) Status {
return OK return OK
} }
func (me *DefaultRawFuseFileSystem) Fsync(input *FsyncIn) (code Status) { func (me *DefaultRawFileSystem) Fsync(input *FsyncIn) (code Status) {
return ENOSYS return ENOSYS
} }
func (me *DefaultRawFuseFileSystem) ReadDir(header *InHeader, input *ReadIn) (*DirEntryList, Status) { func (me *DefaultRawFileSystem) ReadDir(header *InHeader, input *ReadIn) (*DirEntryList, Status) {
return nil, ENOSYS return nil, ENOSYS
} }
func (me *DefaultRawFuseFileSystem) ReleaseDir(header *InHeader, input *ReleaseIn) { func (me *DefaultRawFileSystem) ReleaseDir(header *InHeader, input *ReleaseIn) {
} }
func (me *DefaultRawFuseFileSystem) FsyncDir(header *InHeader, input *FsyncIn) (code Status) { func (me *DefaultRawFileSystem) FsyncDir(header *InHeader, input *FsyncIn) (code Status) {
return ENOSYS return ENOSYS
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// DefaultFuseFile // DefaultFile
func (me *DefaultFuseFile) Read(*ReadIn, *BufferPool) ([]byte, Status) { func (me *DefaultFile) Read(*ReadIn, *BufferPool) ([]byte, Status) {
return []byte(""), ENOSYS return []byte(""), ENOSYS
} }
func (me *DefaultFuseFile) Write(*WriteIn, []byte) (uint32, Status) { func (me *DefaultFile) Write(*WriteIn, []byte) (uint32, Status) {
return 0, ENOSYS return 0, ENOSYS
} }
func (me *DefaultFuseFile) Flush() Status { func (me *DefaultFile) Flush() Status {
return ENOSYS return ENOSYS
} }
func (me *DefaultFuseFile) Release() { func (me *DefaultFile) Release() {
} }
func (me *DefaultFuseFile) Fsync(*FsyncIn) (code Status) { func (me *DefaultFile) Fsync(*FsyncIn) (code Status) {
return ENOSYS return ENOSYS
} }
...@@ -225,7 +225,7 @@ func (me *DefaultPathFileSystem) Truncate(name string, offset uint64) (code Stat ...@@ -225,7 +225,7 @@ func (me *DefaultPathFileSystem) Truncate(name string, offset uint64) (code Stat
return ENOSYS return ENOSYS
} }
func (me *DefaultPathFileSystem) Open(name string, flags uint32) (file FuseFile, code Status) { func (me *DefaultPathFileSystem) Open(name string, flags uint32) (file File, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
...@@ -244,7 +244,7 @@ func (me *DefaultPathFileSystem) Access(name string, mode uint32) (code Status) ...@@ -244,7 +244,7 @@ func (me *DefaultPathFileSystem) Access(name string, mode uint32) (code Status)
return ENOSYS return ENOSYS
} }
func (me *DefaultPathFileSystem) Create(name string, flags uint32, mode uint32) (file FuseFile, code Status) { func (me *DefaultPathFileSystem) Create(name string, flags uint32, mode uint32) (file File, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
......
...@@ -10,7 +10,7 @@ import ( ...@@ -10,7 +10,7 @@ import (
func TestRawFs(t *testing.T) { func TestRawFs(t *testing.T) {
var iface RawFileSystem var iface RawFileSystem
iface = new(DefaultRawFuseFileSystem) iface = new(DefaultRawFileSystem)
iface = new(WrappingRawFileSystem) iface = new(WrappingRawFileSystem)
iface = new(TimingRawFileSystem) iface = new(TimingRawFileSystem)
...@@ -27,7 +27,7 @@ func TestPathFs(t *testing.T) { ...@@ -27,7 +27,7 @@ func TestPathFs(t *testing.T) {
} }
func TestDummyFile(t *testing.T) { func TestDummyFile(t *testing.T) {
d := new(DefaultFuseFile) d := new(DefaultFile)
var filePtr FuseFile = d var filePtr File = d
_ = filePtr _ = filePtr
} }
...@@ -2,7 +2,7 @@ package fuse ...@@ -2,7 +2,7 @@ package fuse
// A FUSE file that accepts any write, and always returns EOF. // A FUSE file that accepts any write, and always returns EOF.
type DevNullFile struct { type DevNullFile struct {
DefaultFuseFile DefaultFile
} }
func NewDevNullFile() *DevNullFile { func NewDevNullFile() *DevNullFile {
......
...@@ -65,12 +65,12 @@ func (me *DirEntryList) Bytes() []byte { ...@@ -65,12 +65,12 @@ func (me *DirEntryList) Bytes() []byte {
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
type FuseDir struct { type Dir struct {
stream chan DirEntry stream chan DirEntry
leftOver DirEntry leftOver DirEntry
} }
func (me *FuseDir) inode(name string) uint64 { func (me *Dir) inode(name string) uint64 {
// We could also return // We could also return
// me.connector.lookupUpdate(me.parentIno, name).NodeId but it // me.connector.lookupUpdate(me.parentIno, name).NodeId but it
// appears FUSE will issue a LOOKUP afterwards for the entry // appears FUSE will issue a LOOKUP afterwards for the entry
...@@ -78,7 +78,7 @@ func (me *FuseDir) inode(name string) uint64 { ...@@ -78,7 +78,7 @@ func (me *FuseDir) inode(name string) uint64 {
return FUSE_UNKNOWN_INO return FUSE_UNKNOWN_INO
} }
func (me *FuseDir) ReadDir(input *ReadIn) (*DirEntryList, Status) { func (me *Dir) ReadDir(input *ReadIn) (*DirEntryList, Status) {
if me.stream == nil { if me.stream == nil {
return nil, OK return nil, OK
} }
...@@ -112,7 +112,7 @@ func (me *FuseDir) ReadDir(input *ReadIn) (*DirEntryList, Status) { ...@@ -112,7 +112,7 @@ func (me *FuseDir) ReadDir(input *ReadIn) (*DirEntryList, Status) {
} }
// Read everything so we make goroutines exit. // Read everything so we make goroutines exit.
func (me *FuseDir) Release() { func (me *Dir) Release() {
for ok := true; ok && me.stream != nil; { for ok := true; ok && me.stream != nil; {
_, ok = <-me.stream _, ok = <-me.stream
if !ok { if !ok {
......
...@@ -193,7 +193,7 @@ func (me *MountState) Stats() string { ...@@ -193,7 +193,7 @@ func (me *MountState) Stats() string {
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// Logic for the control loop. // Logic for the control loop.
func (me *MountState) newFuseRequest() *fuseRequest { func (me *MountState) newRequest() *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)
...@@ -209,7 +209,7 @@ func (me *MountState) readRequest(req *fuseRequest) os.Error { ...@@ -209,7 +209,7 @@ func (me *MountState) readRequest(req *fuseRequest) os.Error {
return err return err
} }
func (me *MountState) discardFuseRequest(req *fuseRequest) { func (me *MountState) discardRequest(req *fuseRequest) {
endNs := time.Nanoseconds() endNs := time.Nanoseconds()
dt := endNs - req.startNs dt := endNs - req.startNs
...@@ -236,7 +236,7 @@ func (me *MountState) discardFuseRequest(req *fuseRequest) { ...@@ -236,7 +236,7 @@ func (me *MountState) discardFuseRequest(req *fuseRequest) {
func (me *MountState) loop() { func (me *MountState) loop() {
// See fuse_kern_chan_receive() // See fuse_kern_chan_receive()
for { for {
req := me.newFuseRequest() req := me.newRequest()
err := me.readRequest(req) err := me.readRequest(req)
if err != nil { if err != nil {
...@@ -244,7 +244,7 @@ func (me *MountState) loop() { ...@@ -244,7 +244,7 @@ func (me *MountState) loop() {
// Retry. // Retry.
if errNo == syscall.ENOENT { if errNo == syscall.ENOENT {
me.discardFuseRequest(req) me.discardRequest(req)
continue continue
} }
...@@ -273,7 +273,7 @@ func (me *MountState) loop() { ...@@ -273,7 +273,7 @@ func (me *MountState) loop() {
} }
func (me *MountState) handle(req *fuseRequest) { func (me *MountState) handle(req *fuseRequest) {
defer me.discardFuseRequest(req) defer me.discardRequest(req)
req.dispatchNs = time.Nanoseconds() req.dispatchNs = time.Nanoseconds()
inHSize := unsafe.Sizeof(InHeader{}) inHSize := unsafe.Sizeof(InHeader{})
...@@ -339,7 +339,7 @@ func (me *MountState) dispatch(req *fuseRequest) { ...@@ -339,7 +339,7 @@ func (me *MountState) dispatch(req *fuseRequest) {
// Follow ordering of fuse_lowlevel.h. // Follow ordering of fuse_lowlevel.h.
switch h.Opcode { switch h.Opcode {
case FUSE_INIT: case FUSE_INIT:
req.data, status = initFuse(me, h, (*InitIn)(inData)) req.data, status = me.init(h, (*InitIn)(inData))
case FUSE_DESTROY: case FUSE_DESTROY:
fs.Destroy(h, (*InitIn)(inData)) fs.Destroy(h, (*InitIn)(inData))
case FUSE_LOOKUP: case FUSE_LOOKUP:
...@@ -496,8 +496,8 @@ func serialize(req *fuseRequest, debug bool) { ...@@ -496,8 +496,8 @@ func serialize(req *fuseRequest, debug bool) {
} }
} }
func initFuse(state *MountState, h *InHeader, input *InitIn) (unsafe.Pointer, Status) { func (me *MountState) init(h *InHeader, input *InitIn) (unsafe.Pointer, Status) {
out, initStatus := state.fileSystem.Init(h, input) out, initStatus := me.fileSystem.Init(h, input)
if initStatus != OK { if initStatus != OK {
return nil, initStatus return nil, initStatus
} }
......
...@@ -92,7 +92,7 @@ func (me *LockingPathFileSystem) Truncate(name string, offset uint64) (code Stat ...@@ -92,7 +92,7 @@ func (me *LockingPathFileSystem) Truncate(name string, offset uint64) (code Stat
return me.Original.Truncate(name, offset) return me.Original.Truncate(name, offset)
} }
func (me *LockingPathFileSystem) Open(name string, flags uint32) (file FuseFile, code Status) { func (me *LockingPathFileSystem) Open(name string, flags uint32) (file File, code Status) {
return me.Original.Open(name, flags) return me.Original.Open(name, flags)
} }
...@@ -120,7 +120,7 @@ func (me *LockingPathFileSystem) Access(name string, mode uint32) (code Status) ...@@ -120,7 +120,7 @@ func (me *LockingPathFileSystem) Access(name string, mode uint32) (code Status)
return me.Original.Access(name, mode) return me.Original.Access(name, mode)
} }
func (me *LockingPathFileSystem) Create(name string, flags uint32, mode uint32) (file FuseFile, code Status) { func (me *LockingPathFileSystem) Create(name string, flags uint32, mode uint32) (file File, code Status) {
me.lock.Lock() me.lock.Lock()
defer me.lock.Unlock() defer me.lock.Unlock()
return me.Original.Create(name, flags, mode) return me.Original.Create(name, flags, mode)
......
...@@ -77,7 +77,7 @@ func (me *LoopbackFileSystem) OpenDir(name string) (stream chan DirEntry, status ...@@ -77,7 +77,7 @@ func (me *LoopbackFileSystem) OpenDir(name string) (stream chan DirEntry, status
return output, OK return output, OK
} }
func (me *LoopbackFileSystem) Open(name string, flags uint32) (fuseFile FuseFile, status Status) { func (me *LoopbackFileSystem) Open(name string, flags uint32) (fuseFile File, status Status) {
f, err := os.OpenFile(me.GetPath(name), int(flags), 0) f, err := os.OpenFile(me.GetPath(name), int(flags), 0)
if err != nil { if err != nil {
return nil, OsErrorToErrno(err) return nil, OsErrorToErrno(err)
...@@ -141,7 +141,7 @@ func (me *LoopbackFileSystem) Access(name string, mode uint32) (code Status) { ...@@ -141,7 +141,7 @@ func (me *LoopbackFileSystem) Access(name string, mode uint32) (code Status) {
return Status(syscall.Access(me.GetPath(name), mode)) return Status(syscall.Access(me.GetPath(name), mode))
} }
func (me *LoopbackFileSystem) Create(path string, flags uint32, mode uint32) (fuseFile FuseFile, code Status) { func (me *LoopbackFileSystem) Create(path string, flags uint32, mode uint32) (fuseFile File, code Status) {
f, err := os.OpenFile(me.GetPath(path), int(flags)|os.O_CREATE, mode) f, err := os.OpenFile(me.GetPath(path), int(flags)|os.O_CREATE, mode)
return &LoopbackFile{file: f}, OsErrorToErrno(err) return &LoopbackFile{file: f}, OsErrorToErrno(err)
} }
...@@ -175,7 +175,7 @@ func (me *LoopbackFileSystem) FillOptions(options *PathFileSystemConnectorOption ...@@ -175,7 +175,7 @@ func (me *LoopbackFileSystem) FillOptions(options *PathFileSystemConnectorOption
type LoopbackFile struct { type LoopbackFile struct {
file *os.File file *os.File
DefaultFuseFile DefaultFile
} }
func (me *LoopbackFile) Read(input *ReadIn, buffers *BufferPool) ([]byte, Status) { func (me *LoopbackFile) Read(input *ReadIn, buffers *BufferPool) ([]byte, Status) {
......
...@@ -122,7 +122,7 @@ func (me *testCase) testOpenUnreadable() { ...@@ -122,7 +122,7 @@ func (me *testCase) testOpenUnreadable() {
} }
} }
func (me *testCase) testReadThroughFuse() { func (me *testCase) testReadThrough() {
me.writeOrigFile() me.writeOrigFile()
fmt.Println("Testing chmod.") fmt.Println("Testing chmod.")
...@@ -167,7 +167,7 @@ func (me *testCase) testRemove() { ...@@ -167,7 +167,7 @@ func (me *testCase) testRemove() {
} }
} }
func (me *testCase) testWriteThroughFuse() { func (me *testCase) testWriteThrough() {
// Create (for write), write. // Create (for write), write.
me.tester.Log("Testing create.") me.tester.Log("Testing create.")
f, err := os.OpenFile(me.mountFile, os.O_WRONLY|os.O_CREATE, 0644) f, err := os.OpenFile(me.mountFile, os.O_WRONLY|os.O_CREATE, 0644)
...@@ -562,7 +562,7 @@ func TestMount(t *testing.T) { ...@@ -562,7 +562,7 @@ func TestMount(t *testing.T) {
ts.testOverwriteRename() ts.testOverwriteRename()
ts.testDelRename() ts.testDelRename()
ts.testOpenUnreadable() ts.testOpenUnreadable()
ts.testReadThroughFuse() ts.testReadThrough()
ts.testRemove() ts.testRemove()
ts.testMkdirRmdir() ts.testMkdirRmdir()
ts.testLink() ts.testLink()
......
...@@ -12,7 +12,7 @@ type PathFileSystemDebug struct { ...@@ -12,7 +12,7 @@ type PathFileSystemDebug struct {
WrappingPathFileSystem WrappingPathFileSystem
} }
func (me *PathFileSystemDebug) Open(path string, flags uint32) (fuseFile FuseFile, status Status) { func (me *PathFileSystemDebug) Open(path string, flags uint32) (fuseFile File, status Status) {
if path == ".debug" && me.Connector != nil { if path == ".debug" && me.Connector != nil {
return NewReadOnlyFile([]byte(me.Connector.DebugString())), OK return NewReadOnlyFile([]byte(me.Connector.DebugString())), OK
} }
......
...@@ -146,7 +146,7 @@ type PathFileSystemConnectorOptions struct { ...@@ -146,7 +146,7 @@ type PathFileSystemConnectorOptions struct {
} }
type PathFileSystemConnector struct { type PathFileSystemConnector struct {
DefaultRawFuseFileSystem DefaultRawFileSystem
options PathFileSystemConnectorOptions options PathFileSystemConnectorOptions
Debug bool Debug bool
...@@ -207,16 +207,16 @@ func (me *PathFileSystemConnector) registerFile(node *inode, f interface{}) uint ...@@ -207,16 +207,16 @@ func (me *PathFileSystemConnector) registerFile(node *inode, f interface{}) uint
return h return h
} }
func (me *PathFileSystemConnector) getDir(h uint64) RawFuseDir { func (me *PathFileSystemConnector) getDir(h uint64) RawDir {
me.fileLock.RLock() me.fileLock.RLock()
defer me.fileLock.RUnlock() defer me.fileLock.RUnlock()
return me.openFiles[h].(RawFuseDir) return me.openFiles[h].(RawDir)
} }
func (me *PathFileSystemConnector) getFile(h uint64) FuseFile { func (me *PathFileSystemConnector) getFile(h uint64) File {
me.fileLock.RLock() me.fileLock.RLock()
defer me.fileLock.RUnlock() defer me.fileLock.RUnlock()
return me.openFiles[h].(FuseFile) return me.openFiles[h].(File)
} }
func (me *PathFileSystemConnector) verify() { func (me *PathFileSystemConnector) verify() {
...@@ -583,7 +583,7 @@ func (me *PathFileSystemConnector) OpenDir(header *InHeader, input *OpenIn) (fla ...@@ -583,7 +583,7 @@ func (me *PathFileSystemConnector) OpenDir(header *InHeader, input *OpenIn) (fla
return 0, 0, err return 0, 0, err
} }
de := new(FuseDir) de := new(Dir)
de.stream = stream de.stream = stream
h := me.registerFile(node, de) h := me.registerFile(node, de)
...@@ -797,14 +797,14 @@ func (me *PathFileSystemConnector) Create(header *InHeader, input *CreateIn, nam ...@@ -797,14 +797,14 @@ func (me *PathFileSystemConnector) Create(header *InHeader, input *CreateIn, nam
func (me *PathFileSystemConnector) Release(header *InHeader, input *ReleaseIn) { func (me *PathFileSystemConnector) Release(header *InHeader, input *ReleaseIn) {
node := me.getInodeData(header.NodeId) node := me.getInodeData(header.NodeId)
f := me.unregisterFile(node, input.Fh).(FuseFile) f := me.unregisterFile(node, input.Fh).(File)
f.Release() f.Release()
me.considerDropInode(node) me.considerDropInode(node)
} }
func (me *PathFileSystemConnector) ReleaseDir(header *InHeader, input *ReleaseIn) { func (me *PathFileSystemConnector) ReleaseDir(header *InHeader, input *ReleaseIn) {
node := me.getInodeData(header.NodeId) node := me.getInodeData(header.NodeId)
d := me.unregisterFile(node, input.Fh).(RawFuseDir) d := me.unregisterFile(node, input.Fh).(RawDir)
d.Release() d.Release()
me.considerDropInode(node) me.considerDropInode(node)
} }
...@@ -863,7 +863,7 @@ func (me *PathFileSystemConnector) ListXAttr(header *InHeader) (data []byte, cod ...@@ -863,7 +863,7 @@ func (me *PathFileSystemConnector) ListXAttr(header *InHeader) (data []byte, cod
} }
func (me *PathFileSystemConnector) Write(input *WriteIn, data []byte) (written uint32, code Status) { func (me *PathFileSystemConnector) Write(input *WriteIn, data []byte) (written uint32, code Status) {
f := me.getFile(input.Fh).(FuseFile) f := me.getFile(input.Fh).(File)
return f.Write(input, data) return f.Write(input, data)
} }
......
...@@ -166,7 +166,7 @@ func (me *TimingPathFileSystem) Truncate(name string, offset uint64) (code Statu ...@@ -166,7 +166,7 @@ func (me *TimingPathFileSystem) Truncate(name string, offset uint64) (code Statu
return me.Original.Truncate(name, offset) return me.Original.Truncate(name, offset)
} }
func (me *TimingPathFileSystem) Open(name string, flags uint32) (file FuseFile, code Status) { func (me *TimingPathFileSystem) Open(name string, flags uint32) (file File, code Status) {
defer me.startTimer("Open", name)() defer me.startTimer("Open", name)()
return me.Original.Open(name, flags) return me.Original.Open(name, flags)
} }
...@@ -191,7 +191,7 @@ func (me *TimingPathFileSystem) Access(name string, mode uint32) (code Status) { ...@@ -191,7 +191,7 @@ func (me *TimingPathFileSystem) Access(name string, mode uint32) (code Status) {
return me.Original.Access(name, mode) return me.Original.Access(name, mode)
} }
func (me *TimingPathFileSystem) Create(name string, flags uint32, mode uint32) (file FuseFile, code Status) { func (me *TimingPathFileSystem) Create(name string, flags uint32, mode uint32) (file File, code Status) {
defer me.startTimer("Create", name)() defer me.startTimer("Create", name)()
return me.Original.Create(name, flags, mode) return me.Original.Create(name, flags, mode)
} }
......
...@@ -547,7 +547,7 @@ type RawFileSystem interface { ...@@ -547,7 +547,7 @@ type RawFileSystem interface {
FsyncDir(header *InHeader, input *FsyncIn) (code Status) FsyncDir(header *InHeader, input *FsyncIn) (code Status)
} }
type FuseFile interface { type File interface {
Read(*ReadIn, *BufferPool) ([]byte, Status) Read(*ReadIn, *BufferPool) ([]byte, Status)
// u32 <-> u64 ? // u32 <-> u64 ?
Write(*WriteIn, []byte) (written uint32, code Status) Write(*WriteIn, []byte) (written uint32, code Status)
...@@ -556,7 +556,7 @@ type FuseFile interface { ...@@ -556,7 +556,7 @@ type FuseFile interface {
Fsync(*FsyncIn) (code Status) Fsync(*FsyncIn) (code Status)
} }
type RawFuseDir interface { type RawDir interface {
ReadDir(input *ReadIn) (*DirEntryList, Status) ReadDir(input *ReadIn) (*DirEntryList, Status)
Release() Release()
} }
...@@ -574,7 +574,7 @@ type PathFileSystem interface { ...@@ -574,7 +574,7 @@ type PathFileSystem interface {
Chmod(name string, mode uint32) (code Status) Chmod(name string, mode uint32) (code Status)
Chown(name string, uid uint32, gid uint32) (code Status) Chown(name string, uid uint32, gid uint32) (code Status)
Truncate(name string, offset uint64) (code Status) Truncate(name string, offset uint64) (code Status)
Open(name string, flags uint32) (file FuseFile, code Status) Open(name string, flags uint32) (file File, code Status)
GetXAttr(name string, attribute string) (data []byte, code Status) GetXAttr(name string, attribute string) (data []byte, code Status)
SetXAttr(name string, attr string, data []byte, flags int) Status SetXAttr(name string, attr string, data []byte, flags int) Status
...@@ -590,7 +590,7 @@ type PathFileSystem interface { ...@@ -590,7 +590,7 @@ type PathFileSystem interface {
Unmount() Unmount()
Access(name string, mode uint32) (code Status) Access(name string, mode uint32) (code Status)
Create(name string, flags uint32, mode uint32) (file FuseFile, code Status) Create(name string, flags uint32, mode uint32) (file File, code Status)
Utimens(name string, AtimeNs uint64, CtimeNs uint64) (code Status) Utimens(name string, AtimeNs uint64, CtimeNs uint64) (code Status)
// unimplemented: poll, ioctl, bmap. // unimplemented: poll, ioctl, bmap.
...@@ -600,5 +600,5 @@ type PathFileSystem interface { ...@@ -600,5 +600,5 @@ type PathFileSystem interface {
// implementations. // implementations.
type DefaultPathFileSystem struct{} type DefaultPathFileSystem struct{}
type DefaultFuseFile struct{} type DefaultFile struct{}
type DefaultRawFuseFileSystem struct{} type DefaultRawFileSystem struct{}
...@@ -54,7 +54,7 @@ func (me *WrappingPathFileSystem) Truncate(name string, offset uint64) (code Sta ...@@ -54,7 +54,7 @@ func (me *WrappingPathFileSystem) Truncate(name string, offset uint64) (code Sta
return me.Original.Truncate(name, offset) return me.Original.Truncate(name, offset)
} }
func (me *WrappingPathFileSystem) Open(name string, flags uint32) (file FuseFile, code Status) { func (me *WrappingPathFileSystem) Open(name string, flags uint32) (file File, code Status) {
return me.Original.Open(name, flags) return me.Original.Open(name, flags)
} }
...@@ -74,7 +74,7 @@ func (me *WrappingPathFileSystem) Access(name string, mode uint32) (code Status) ...@@ -74,7 +74,7 @@ func (me *WrappingPathFileSystem) Access(name string, mode uint32) (code Status)
return me.Original.Access(name, mode) return me.Original.Access(name, mode)
} }
func (me *WrappingPathFileSystem) Create(name string, flags uint32, mode uint32) (file FuseFile, code Status) { func (me *WrappingPathFileSystem) Create(name string, flags uint32, mode uint32) (file File, code Status) {
return me.Original.Create(name, flags, mode) return me.Original.Create(name, flags, mode)
} }
......
...@@ -287,7 +287,7 @@ func (me *UnionFs) Readlink(name string) (out string, code fuse.Status) { ...@@ -287,7 +287,7 @@ func (me *UnionFs) Readlink(name string) (out string, code fuse.Status) {
return "", fuse.ENOENT return "", fuse.ENOENT
} }
func (me *UnionFs) Create(name string, flags uint32, mode uint32) (fuseFile fuse.FuseFile, code fuse.Status) { func (me *UnionFs) Create(name string, flags uint32, mode uint32) (fuseFile fuse.File, code fuse.Status) {
// TODO(hanwen) - we should check that the name is not a // TODO(hanwen) - we should check that the name is not a
// directory in another branch. // directory in another branch.
writable := me.fileSystems[0] writable := me.fileSystems[0]
...@@ -406,7 +406,7 @@ func (me *UnionFs) OpenDir(directory string) (stream chan fuse.DirEntry, status ...@@ -406,7 +406,7 @@ func (me *UnionFs) OpenDir(directory string) (stream chan fuse.DirEntry, status
return stream, fuse.OK return stream, fuse.OK
} }
func (me *UnionFs) Open(name string, flags uint32) (fuseFile fuse.FuseFile, status fuse.Status) { func (me *UnionFs) Open(name string, flags uint32) (fuseFile fuse.File, status fuse.Status) {
branch := me.getBranch(name) branch := me.getBranch(name)
if flags&fuse.O_ANYWRITE != 0 && branch > 0 { if flags&fuse.O_ANYWRITE != 0 && branch > 0 {
err := me.Promote(name, me.branches[branch]) err := me.Promote(name, me.branches[branch])
......
...@@ -31,7 +31,7 @@ type zipCreateFile struct { ...@@ -31,7 +31,7 @@ type zipCreateFile struct {
Basename string Basename string
zfs *MultiZipFs zfs *MultiZipFs
fuse.DefaultFuseFile fuse.DefaultFile
} }
func (me *zipCreateFile) Write(input *fuse.WriteIn, nameBytes []byte) (uint32, fuse.Status) { func (me *zipCreateFile) Write(input *fuse.WriteIn, nameBytes []byte) (uint32, fuse.Status) {
...@@ -184,7 +184,7 @@ func (me *MultiZipFs) Unlink(name string) (code fuse.Status) { ...@@ -184,7 +184,7 @@ func (me *MultiZipFs) Unlink(name string) (code fuse.Status) {
return fuse.EPERM return fuse.EPERM
} }
func (me *MultiZipFs) Open(name string, flags uint32) (file fuse.FuseFile, code fuse.Status) { func (me *MultiZipFs) Open(name string, flags uint32) (file fuse.File, code fuse.Status) {
if 0 != flags&uint32(fuse.O_ANYWRITE) { if 0 != flags&uint32(fuse.O_ANYWRITE) {
return nil, fuse.EPERM return nil, fuse.EPERM
} }
...@@ -205,7 +205,7 @@ func (me *MultiZipFs) Open(name string, flags uint32) (file fuse.FuseFile, code ...@@ -205,7 +205,7 @@ func (me *MultiZipFs) Open(name string, flags uint32) (file fuse.FuseFile, code
return nil, fuse.ENOENT return nil, fuse.ENOENT
} }
func (me *MultiZipFs) Create(name string, flags uint32, mode uint32) (file fuse.FuseFile, code fuse.Status) { func (me *MultiZipFs) Create(name string, flags uint32, mode uint32) (file fuse.File, code fuse.Status) {
dir, base := filepath.Split(name) dir, base := filepath.Split(name)
if dir != CONFIG_PREFIX { if dir != CONFIG_PREFIX {
return nil, fuse.EPERM return nil, fuse.EPERM
......
...@@ -135,7 +135,7 @@ func (me *ZipArchiveFileSystem) GetAttr(name string) (*fuse.Attr, fuse.Status) { ...@@ -135,7 +135,7 @@ func (me *ZipArchiveFileSystem) GetAttr(name string) (*fuse.Attr, fuse.Status) {
return a, fuse.OK return a, fuse.OK
} }
func (me *ZipArchiveFileSystem) Open(name string, flags uint32) (file fuse.FuseFile, code fuse.Status) { func (me *ZipArchiveFileSystem) Open(name string, flags uint32) (file fuse.File, code fuse.Status) {
if flags&fuse.O_ANYWRITE != 0 { if flags&fuse.O_ANYWRITE != 0 {
return nil, fuse.EPERM return nil, fuse.EPERM
} }
...@@ -180,10 +180,10 @@ func (me *ZipArchiveFileSystem) OpenDir(name string) (stream chan fuse.DirEntry, ...@@ -180,10 +180,10 @@ func (me *ZipArchiveFileSystem) OpenDir(name string) (stream chan fuse.DirEntry,
type ZipFile struct { type ZipFile struct {
data []byte data []byte
fuse.DefaultFuseFile fuse.DefaultFile
} }
func NewZipFile(f *zip.File) fuse.FuseFile { func NewZipFile(f *zip.File) fuse.File {
data := make([]byte, f.UncompressedSize) data := make([]byte, f.UncompressedSize)
rc, err := f.Open() rc, err := f.Open()
if err != nil { if err != nil {
......
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