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

Rename RawFuseFile to FuseFile.

parent ca24733f
...@@ -240,7 +240,7 @@ func (me *DefaultPathFilesystem) Truncate(name string, offset uint64) (code Stat ...@@ -240,7 +240,7 @@ func (me *DefaultPathFilesystem) Truncate(name string, offset uint64) (code Stat
return ENOSYS return ENOSYS
} }
func (me *DefaultPathFilesystem) Open(name string, flags uint32) (file RawFuseFile, code Status) { func (me *DefaultPathFilesystem) Open(name string, flags uint32) (file FuseFile, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
...@@ -259,7 +259,7 @@ func (me *DefaultPathFilesystem) Access(name string, mode uint32) (code Status) ...@@ -259,7 +259,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 RawFuseFile, code Status) { func (me *DefaultPathFilesystem) Create(name string, flags uint32, mode uint32) (file FuseFile, code Status) {
return nil, ENOSYS return nil, ENOSYS
} }
......
...@@ -28,6 +28,6 @@ func TestPathFs(t *testing.T) { ...@@ -28,6 +28,6 @@ func TestPathFs(t *testing.T) {
func TestDummyFile(t *testing.T) { func TestDummyFile(t *testing.T) {
d := new(DefaultFuseFile) d := new(DefaultFuseFile)
var filePtr RawFuseFile = d var filePtr FuseFile = d
_ = filePtr _ = filePtr
} }
...@@ -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 RawFuseFile, code Status) { func (me *LockingPathFilesystem) Open(name string, flags uint32) (file FuseFile, 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 RawFuseFile, code Status) { func (me *LockingPathFilesystem) Create(name string, flags uint32, mode uint32) (file FuseFile, 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 RawFuseFile, status Status) { func (me *LoopbackFileSystem) Open(name string, flags uint32) (fuseFile FuseFile, 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, OsErrorToFuseError(err) return nil, OsErrorToFuseError(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 RawFuseFile, code Status) { func (me *LoopbackFileSystem) Create(path string, flags uint32, mode uint32) (fuseFile FuseFile, 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}, OsErrorToFuseError(err) return &LoopbackFile{file: f}, OsErrorToFuseError(err)
} }
......
...@@ -191,10 +191,10 @@ func (me *PathFileSystemConnector) getDir(h uint64) RawFuseDir { ...@@ -191,10 +191,10 @@ func (me *PathFileSystemConnector) getDir(h uint64) RawFuseDir {
return me.openFiles[h].(RawFuseDir) return me.openFiles[h].(RawFuseDir)
} }
func (me *PathFileSystemConnector) getFile(h uint64) RawFuseFile { func (me *PathFileSystemConnector) getFile(h uint64) FuseFile {
me.fileLock.RLock() me.fileLock.RLock()
defer me.fileLock.RUnlock() defer me.fileLock.RUnlock()
return me.openFiles[h].(RawFuseFile) return me.openFiles[h].(FuseFile)
} }
func (me *PathFileSystemConnector) verify() { func (me *PathFileSystemConnector) verify() {
...@@ -748,7 +748,7 @@ func (me *PathFileSystemConnector) Create(header *InHeader, input *CreateIn, nam ...@@ -748,7 +748,7 @@ 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.GetPath(header.NodeId) _, _, node := me.GetPath(header.NodeId)
f := me.unregisterFile(node, input.Fh).(RawFuseFile) f := me.unregisterFile(node, input.Fh).(FuseFile)
f.Release() f.Release()
} }
...@@ -812,7 +812,7 @@ func (me *PathFileSystemConnector) ListXAttr(header *InHeader) (data []byte, cod ...@@ -812,7 +812,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).(RawFuseFile) f := me.getFile(input.Fh).(FuseFile)
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 RawFuseFile, code Status) { func (me *TimingPathFilesystem) Open(name string, flags uint32) (file FuseFile, 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 RawFuseFile, code Status) { func (me *TimingPathFilesystem) Create(name string, flags uint32, mode uint32) (file FuseFile, 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)
} }
......
...@@ -544,7 +544,7 @@ type RawFileSystem interface { ...@@ -544,7 +544,7 @@ type RawFileSystem interface {
FsyncDir(header *InHeader, input *FsyncIn) (code Status) FsyncDir(header *InHeader, input *FsyncIn) (code Status)
} }
type RawFuseFile interface { type FuseFile 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)
...@@ -571,7 +571,7 @@ type PathFilesystem interface { ...@@ -571,7 +571,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 RawFuseFile, code Status) Open(name string, flags uint32) (file FuseFile, 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
...@@ -587,7 +587,7 @@ type PathFilesystem interface { ...@@ -587,7 +587,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 RawFuseFile, code Status) Create(name string, flags uint32, mode uint32) (file FuseFile, 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.
......
...@@ -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 RawFuseFile, code Status) { func (me *WrappingPathFilesystem) Open(name string, flags uint32) (file FuseFile, 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 RawFuseFile, code Status) { func (me *WrappingPathFilesystem) Create(name string, flags uint32, mode uint32) (file FuseFile, 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.RawFuseFile, code fuse.Status) { func (me *UnionFs) Create(name string, flags uint32, mode uint32) (fuseFile fuse.FuseFile, 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.RawFuseFile, status fuse.Status) { func (me *UnionFs) Open(name string, flags uint32) (fuseFile fuse.FuseFile, 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])
......
...@@ -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.RawFuseFile, code fuse.Status) { func (me *MultiZipFs) Open(name string, flags uint32) (file fuse.FuseFile, 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.RawFuseFile, co ...@@ -205,7 +205,7 @@ func (me *MultiZipFs) Open(name string, flags uint32) (file fuse.RawFuseFile, co
return nil, fuse.ENOENT return nil, fuse.ENOENT
} }
func (me *MultiZipFs) Create(name string, flags uint32, mode uint32) (file fuse.RawFuseFile, code fuse.Status) { func (me *MultiZipFs) Create(name string, flags uint32, mode uint32) (file fuse.FuseFile, 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 *ZipFileFuse) GetAttr(name string) (*fuse.Attr, fuse.Status) { ...@@ -135,7 +135,7 @@ func (me *ZipFileFuse) GetAttr(name string) (*fuse.Attr, fuse.Status) {
return a, fuse.OK return a, fuse.OK
} }
func (me *ZipFileFuse) Open(name string, flags uint32) (file fuse.RawFuseFile, code fuse.Status) { func (me *ZipFileFuse) Open(name string, flags uint32) (file fuse.FuseFile, code fuse.Status) {
if flags&fuse.O_ANYWRITE != 0 { if flags&fuse.O_ANYWRITE != 0 {
return nil, fuse.EPERM return nil, fuse.EPERM
} }
...@@ -183,7 +183,7 @@ type ZipFile struct { ...@@ -183,7 +183,7 @@ type ZipFile struct {
fuse.DefaultFuseFile fuse.DefaultFuseFile
} }
func NewZipFile(f *zip.File) fuse.RawFuseFile { func NewZipFile(f *zip.File) fuse.FuseFile {
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