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

fuse: move raw/ back into fuse/

parent 2f786397
......@@ -4,6 +4,7 @@
.nfs*
_*
6.out
#*
example/hello/hello
example/unionfs/unionfs
example/autounionfs/autounionfs
......
......@@ -4,7 +4,7 @@ set -eux
sh genversion.sh fuse/version.gen.go
for target in "clean" "install" ; do
for d in raw fuse fuse/pathfs fuse/test zipfs unionfs \
for d in fuse fuse/pathfs fuse/test zipfs unionfs \
example/hello example/loopback example/zipfs \
example/multizip example/unionfs example/memfs \
example/autounionfs ; \
......
......@@ -4,10 +4,6 @@
package fuse
import (
"github.com/hanwen/go-fuse/raw"
)
// Types for users to implement.
// The result of Read is an array of bytes, but for performance
......@@ -79,52 +75,52 @@ type RawFileSystem interface {
// If called, provide debug output through the log package.
SetDebug(debug bool)
Lookup(header *raw.InHeader, name string, out *raw.EntryOut) (status Status)
Lookup(header *InHeader, name string, out *EntryOut) (status Status)
Forget(nodeid, nlookup uint64)
// Attributes.
GetAttr(input *raw.GetAttrIn, out *raw.AttrOut) (code Status)
SetAttr(input *raw.SetAttrIn, out *raw.AttrOut) (code Status)
GetAttr(input *GetAttrIn, out *AttrOut) (code Status)
SetAttr(input *SetAttrIn, out *AttrOut) (code Status)
// Modifying structure.
Mknod(input *raw.MknodIn, name string, out *raw.EntryOut) (code Status)
Mkdir(input *raw.MkdirIn, name string, out *raw.EntryOut) (code Status)
Unlink(header *raw.InHeader, name string) (code Status)
Rmdir(header *raw.InHeader, name string) (code Status)
Rename(input *raw.RenameIn, oldName string, newName string) (code Status)
Link(input *raw.LinkIn, filename string, out *raw.EntryOut) (code Status)
Mknod(input *MknodIn, name string, out *EntryOut) (code Status)
Mkdir(input *MkdirIn, name string, out *EntryOut) (code Status)
Unlink(header *InHeader, name string) (code Status)
Rmdir(header *InHeader, name string) (code Status)
Rename(input *RenameIn, oldName string, newName string) (code Status)
Link(input *LinkIn, filename string, out *EntryOut) (code Status)
Symlink(header *raw.InHeader, pointedTo string, linkName string, out *raw.EntryOut) (code Status)
Readlink(header *raw.InHeader) (out []byte, code Status)
Access(input *raw.AccessIn) (code Status)
Symlink(header *InHeader, pointedTo string, linkName string, out *EntryOut) (code Status)
Readlink(header *InHeader) (out []byte, code Status)
Access(input *AccessIn) (code Status)
// Extended attributes.
GetXAttrSize(header *raw.InHeader, attr string) (sz int, code Status)
GetXAttrData(header *raw.InHeader, attr string) (data []byte, code Status)
ListXAttr(header *raw.InHeader) (attributes []byte, code Status)
SetXAttr(input *raw.SetXAttrIn, attr string, data []byte) Status
RemoveXAttr(header *raw.InHeader, attr string) (code Status)
GetXAttrSize(header *InHeader, attr string) (sz int, code Status)
GetXAttrData(header *InHeader, attr string) (data []byte, code Status)
ListXAttr(header *InHeader) (attributes []byte, code Status)
SetXAttr(input *SetXAttrIn, attr string, data []byte) Status
RemoveXAttr(header *InHeader, attr string) (code Status)
// File handling.
Create(input *raw.CreateIn, name string, out *raw.CreateOut) (code Status)
Open(input *raw.OpenIn, out *raw.OpenOut) (status Status)
Read(input *raw.ReadIn, buf []byte) (ReadResult, Status)
Create(input *CreateIn, name string, out *CreateOut) (code Status)
Open(input *OpenIn, out *OpenOut) (status Status)
Read(input *ReadIn, buf []byte) (ReadResult, Status)
Release(input *raw.ReleaseIn)
Write(input *raw.WriteIn, data []byte) (written uint32, code Status)
Flush(input *raw.FlushIn) Status
Fsync(input *raw.FsyncIn) (code Status)
Fallocate(input *raw.FallocateIn) (code Status)
Release(input *ReleaseIn)
Write(input *WriteIn, data []byte) (written uint32, code Status)
Flush(input *FlushIn) Status
Fsync(input *FsyncIn) (code Status)
Fallocate(input *FallocateIn) (code Status)
// Directory handling
OpenDir(input *raw.OpenIn, out *raw.OpenOut) (status Status)
ReadDir(input *raw.ReadIn, out *DirEntryList) Status
ReadDirPlus(input *raw.ReadIn, out *DirEntryList) Status
ReleaseDir(input *raw.ReleaseIn)
FsyncDir(input *raw.FsyncIn) (code Status)
OpenDir(input *OpenIn, out *OpenOut) (status Status)
ReadDir(input *ReadIn, out *DirEntryList) Status
ReadDirPlus(input *ReadIn, out *DirEntryList) Status
ReleaseDir(input *ReleaseIn)
FsyncDir(input *FsyncIn) (code Status)
//
StatFs(input *raw.InHeader, out *raw.StatfsOut) (code Status)
StatFs(input *InHeader, out *StatfsOut) (code Status)
// This is called on processing the first request. The
// filesystem implementation can use the server argument to
......
package raw
package fuse
import (
"os"
......
package raw
package fuse
// arbitrary values
const syscall_O_LARGEFILE = 1 << 29
......
package raw
package fuse
import (
"syscall"
......
package fuse
import (
"github.com/hanwen/go-fuse/raw"
"os"
)
......@@ -24,127 +22,127 @@ func (fs *defaultRawFileSystem) String() string {
func (fs *defaultRawFileSystem) SetDebug(dbg bool) {
}
func (fs *defaultRawFileSystem) StatFs(header *raw.InHeader, out *raw.StatfsOut) Status {
func (fs *defaultRawFileSystem) StatFs(header *InHeader, out *StatfsOut) Status {
return ENOSYS
}
func (fs *defaultRawFileSystem) Lookup(header *raw.InHeader, name string, out *raw.EntryOut) (code Status) {
func (fs *defaultRawFileSystem) Lookup(header *InHeader, name string, out *EntryOut) (code Status) {
return ENOSYS
}
func (fs *defaultRawFileSystem) Forget(nodeID, nlookup uint64) {
}
func (fs *defaultRawFileSystem) GetAttr(input *raw.GetAttrIn, out *raw.AttrOut) (code Status) {
func (fs *defaultRawFileSystem) GetAttr(input *GetAttrIn, out *AttrOut) (code Status) {
return ENOSYS
}
func (fs *defaultRawFileSystem) Open(input *raw.OpenIn, out *raw.OpenOut) (status Status) {
func (fs *defaultRawFileSystem) Open(input *OpenIn, out *OpenOut) (status Status) {
return OK
}
func (fs *defaultRawFileSystem) SetAttr(input *raw.SetAttrIn, out *raw.AttrOut) (code Status) {
func (fs *defaultRawFileSystem) SetAttr(input *SetAttrIn, out *AttrOut) (code Status) {
return ENOSYS
}
func (fs *defaultRawFileSystem) Readlink(header *raw.InHeader) (out []byte, code Status) {
func (fs *defaultRawFileSystem) Readlink(header *InHeader) (out []byte, code Status) {
return nil, ENOSYS
}
func (fs *defaultRawFileSystem) Mknod(input *raw.MknodIn, name string, out *raw.EntryOut) (code Status) {
func (fs *defaultRawFileSystem) Mknod(input *MknodIn, name string, out *EntryOut) (code Status) {
return ENOSYS
}
func (fs *defaultRawFileSystem) Mkdir(input *raw.MkdirIn, name string, out *raw.EntryOut) (code Status) {
func (fs *defaultRawFileSystem) Mkdir(input *MkdirIn, name string, out *EntryOut) (code Status) {
return ENOSYS
}
func (fs *defaultRawFileSystem) Unlink(header *raw.InHeader, name string) (code Status) {
func (fs *defaultRawFileSystem) Unlink(header *InHeader, name string) (code Status) {
return ENOSYS
}
func (fs *defaultRawFileSystem) Rmdir(header *raw.InHeader, name string) (code Status) {
func (fs *defaultRawFileSystem) Rmdir(header *InHeader, name string) (code Status) {
return ENOSYS
}
func (fs *defaultRawFileSystem) Symlink(header *raw.InHeader, pointedTo string, linkName string, out *raw.EntryOut) (code Status) {
func (fs *defaultRawFileSystem) Symlink(header *InHeader, pointedTo string, linkName string, out *EntryOut) (code Status) {
return ENOSYS
}
func (fs *defaultRawFileSystem) Rename(input *raw.RenameIn, oldName string, newName string) (code Status) {
func (fs *defaultRawFileSystem) Rename(input *RenameIn, oldName string, newName string) (code Status) {
return ENOSYS
}
func (fs *defaultRawFileSystem) Link(input *raw.LinkIn, name string, out *raw.EntryOut) (code Status) {
func (fs *defaultRawFileSystem) Link(input *LinkIn, name string, out *EntryOut) (code Status) {
return ENOSYS
}
func (fs *defaultRawFileSystem) GetXAttrSize(header *raw.InHeader, attr string) (size int, code Status) {
func (fs *defaultRawFileSystem) GetXAttrSize(header *InHeader, attr string) (size int, code Status) {
return 0, ENOSYS
}
func (fs *defaultRawFileSystem) GetXAttrData(header *raw.InHeader, attr string) (data []byte, code Status) {
func (fs *defaultRawFileSystem) GetXAttrData(header *InHeader, attr string) (data []byte, code Status) {
return nil, ENOSYS
}
func (fs *defaultRawFileSystem) SetXAttr(input *raw.SetXAttrIn, attr string, data []byte) Status {
func (fs *defaultRawFileSystem) SetXAttr(input *SetXAttrIn, attr string, data []byte) Status {
return ENOSYS
}
func (fs *defaultRawFileSystem) ListXAttr(header *raw.InHeader) (data []byte, code Status) {
func (fs *defaultRawFileSystem) ListXAttr(header *InHeader) (data []byte, code Status) {
return nil, ENOSYS
}
func (fs *defaultRawFileSystem) RemoveXAttr(header *raw.InHeader, attr string) Status {
func (fs *defaultRawFileSystem) RemoveXAttr(header *InHeader, attr string) Status {
return ENOSYS
}
func (fs *defaultRawFileSystem) Access(input *raw.AccessIn) (code Status) {
func (fs *defaultRawFileSystem) Access(input *AccessIn) (code Status) {
return ENOSYS
}
func (fs *defaultRawFileSystem) Create(input *raw.CreateIn, name string, out *raw.CreateOut) (code Status) {
func (fs *defaultRawFileSystem) Create(input *CreateIn, name string, out *CreateOut) (code Status) {
return ENOSYS
}
func (fs *defaultRawFileSystem) OpenDir(input *raw.OpenIn, out *raw.OpenOut) (status Status) {
func (fs *defaultRawFileSystem) OpenDir(input *OpenIn, out *OpenOut) (status Status) {
return ENOSYS
}
func (fs *defaultRawFileSystem) Read(input *raw.ReadIn, buf []byte) (ReadResult, Status) {
func (fs *defaultRawFileSystem) Read(input *ReadIn, buf []byte) (ReadResult, Status) {
return nil, ENOSYS
}
func (fs *defaultRawFileSystem) Release(input *raw.ReleaseIn) {
func (fs *defaultRawFileSystem) Release(input *ReleaseIn) {
}
func (fs *defaultRawFileSystem) Write(input *raw.WriteIn, data []byte) (written uint32, code Status) {
func (fs *defaultRawFileSystem) Write(input *WriteIn, data []byte) (written uint32, code Status) {
return 0, ENOSYS
}
func (fs *defaultRawFileSystem) Flush(input *raw.FlushIn) Status {
func (fs *defaultRawFileSystem) Flush(input *FlushIn) Status {
return OK
}
func (fs *defaultRawFileSystem) Fsync(input *raw.FsyncIn) (code Status) {
func (fs *defaultRawFileSystem) Fsync(input *FsyncIn) (code Status) {
return ENOSYS
}
func (fs *defaultRawFileSystem) ReadDir(input *raw.ReadIn, l *DirEntryList) Status {
func (fs *defaultRawFileSystem) ReadDir(input *ReadIn, l *DirEntryList) Status {
return ENOSYS
}
func (fs *defaultRawFileSystem) ReadDirPlus(input *raw.ReadIn, l *DirEntryList) Status {
func (fs *defaultRawFileSystem) ReadDirPlus(input *ReadIn, l *DirEntryList) Status {
return ENOSYS
}
func (fs *defaultRawFileSystem) ReleaseDir(input *raw.ReleaseIn) {
func (fs *defaultRawFileSystem) ReleaseDir(input *ReleaseIn) {
}
func (fs *defaultRawFileSystem) FsyncDir(input *raw.FsyncIn) (code Status) {
func (fs *defaultRawFileSystem) FsyncDir(input *FsyncIn) (code Status) {
return ENOSYS
}
func (fs *defaultRawFileSystem) Fallocate(in *raw.FallocateIn) (code Status) {
func (fs *defaultRawFileSystem) Fallocate(in *FallocateIn) (code Status) {
return ENOSYS
}
......@@ -5,13 +5,11 @@ package fuse
import (
"fmt"
"unsafe"
"github.com/hanwen/go-fuse/raw"
)
var eightPadding [8]byte
const direntSize = int(unsafe.Sizeof(raw.Dirent{}))
const direntSize = int(unsafe.Sizeof(Dirent{}))
// DirEntry is a type for PathFileSystem and NodeFileSystem to return
// directory contents in.
......@@ -45,7 +43,7 @@ func NewDirEntryList(data []byte, off uint64) *DirEntryList {
// AddDirEntry tries to add an entry, and reports whether it
// succeeded.
func (l *DirEntryList) AddDirEntry(e DirEntry) (bool, uint64) {
return l.Add(nil, e.Name, uint64(raw.FUSE_UNKNOWN_INO), e.Mode)
return l.Add(nil, e.Name, uint64(FUSE_UNKNOWN_INO), e.Mode)
}
// Add adds a direntry to the DirEntryList, returning whether it
......@@ -62,7 +60,7 @@ func (l *DirEntryList) Add(prefix []byte, name string, inode uint64, mode uint32
l.buf = l.buf[:newLen]
copy(l.buf[oldLen:], prefix)
oldLen += len(prefix)
dirent := (*raw.Dirent)(unsafe.Pointer(&l.buf[oldLen]))
dirent := (*Dirent)(unsafe.Pointer(&l.buf[oldLen]))
dirent.Off = l.offset + 1
dirent.Ino = inode
dirent.NameLen = uint32(len(name))
......@@ -82,13 +80,13 @@ func (l *DirEntryList) Add(prefix []byte, name string, inode uint64, mode uint32
// AddDirLookupEntry is used for ReadDirPlus. It serializes a DirEntry
// and its corresponding lookup. Pass a null EntryOut if the lookup
// data should be ignored.
func (l *DirEntryList) AddDirLookupEntry(e DirEntry, entryOut *raw.EntryOut) (bool, uint64) {
ino := uint64(raw.FUSE_UNKNOWN_INO)
func (l *DirEntryList) AddDirLookupEntry(e DirEntry, entryOut *EntryOut) (bool, uint64) {
ino := uint64(FUSE_UNKNOWN_INO)
if entryOut.Ino > 0 {
ino = entryOut.Ino
}
var lookup []byte
toSlice(&lookup, unsafe.Pointer(entryOut), unsafe.Sizeof(raw.EntryOut{}))
toSlice(&lookup, unsafe.Pointer(entryOut), unsafe.Sizeof(EntryOut{}))
return l.Add(lookup, e.Name, ino, e.Mode)
}
......
......@@ -3,8 +3,6 @@ package fuse
import (
"fmt"
"sync"
"github.com/hanwen/go-fuse/raw"
)
////////////////////////////////////////////////////////////////
......@@ -31,7 +29,7 @@ func (fs *lockingRawFileSystem) locked() func() {
return func() { fs.lock.Unlock() }
}
func (fs *lockingRawFileSystem) Lookup(header *raw.InHeader, name string, out *raw.EntryOut) (code Status) {
func (fs *lockingRawFileSystem) Lookup(header *InHeader, name string, out *EntryOut) (code Status) {
defer fs.locked()()
return fs.RawFS.Lookup(header, name, out)
}
......@@ -46,143 +44,143 @@ func (fs *lockingRawFileSystem) Forget(nodeID uint64, nlookup uint64) {
fs.RawFS.Forget(nodeID, nlookup)
}
func (fs *lockingRawFileSystem) GetAttr(input *raw.GetAttrIn, out *raw.AttrOut) (code Status) {
func (fs *lockingRawFileSystem) GetAttr(input *GetAttrIn, out *AttrOut) (code Status) {
defer fs.locked()()
return fs.RawFS.GetAttr(input, out)
}
func (fs *lockingRawFileSystem) Open(input *raw.OpenIn, out *raw.OpenOut) (status Status) {
func (fs *lockingRawFileSystem) Open(input *OpenIn, out *OpenOut) (status Status) {
defer fs.locked()()
return fs.RawFS.Open(input, out)
}
func (fs *lockingRawFileSystem) SetAttr(input *raw.SetAttrIn, out *raw.AttrOut) (code Status) {
func (fs *lockingRawFileSystem) SetAttr(input *SetAttrIn, out *AttrOut) (code Status) {
defer fs.locked()()
return fs.RawFS.SetAttr(input, out)
}
func (fs *lockingRawFileSystem) Readlink(header *raw.InHeader) (out []byte, code Status) {
func (fs *lockingRawFileSystem) Readlink(header *InHeader) (out []byte, code Status) {
defer fs.locked()()
return fs.RawFS.Readlink(header)
}
func (fs *lockingRawFileSystem) Mknod(input *raw.MknodIn, name string, out *raw.EntryOut) (code Status) {
func (fs *lockingRawFileSystem) Mknod(input *MknodIn, name string, out *EntryOut) (code Status) {
defer fs.locked()()
return fs.RawFS.Mknod(input, name, out)
}
func (fs *lockingRawFileSystem) Mkdir(input *raw.MkdirIn, name string, out *raw.EntryOut) (code Status) {
func (fs *lockingRawFileSystem) Mkdir(input *MkdirIn, name string, out *EntryOut) (code Status) {
defer fs.locked()()
return fs.RawFS.Mkdir(input, name, out)
}
func (fs *lockingRawFileSystem) Unlink(header *raw.InHeader, name string) (code Status) {
func (fs *lockingRawFileSystem) Unlink(header *InHeader, name string) (code Status) {
defer fs.locked()()
return fs.RawFS.Unlink(header, name)
}
func (fs *lockingRawFileSystem) Rmdir(header *raw.InHeader, name string) (code Status) {
func (fs *lockingRawFileSystem) Rmdir(header *InHeader, name string) (code Status) {
defer fs.locked()()
return fs.RawFS.Rmdir(header, name)
}
func (fs *lockingRawFileSystem) Symlink(header *raw.InHeader, pointedTo string, linkName string, out *raw.EntryOut) (code Status) {
func (fs *lockingRawFileSystem) Symlink(header *InHeader, pointedTo string, linkName string, out *EntryOut) (code Status) {
defer fs.locked()()
return fs.RawFS.Symlink(header, pointedTo, linkName, out)
}
func (fs *lockingRawFileSystem) Rename(input *raw.RenameIn, oldName string, newName string) (code Status) {
func (fs *lockingRawFileSystem) Rename(input *RenameIn, oldName string, newName string) (code Status) {
defer fs.locked()()
return fs.RawFS.Rename(input, oldName, newName)
}
func (fs *lockingRawFileSystem) Link(input *raw.LinkIn, name string, out *raw.EntryOut) (code Status) {
func (fs *lockingRawFileSystem) Link(input *LinkIn, name string, out *EntryOut) (code Status) {
defer fs.locked()()
return fs.RawFS.Link(input, name, out)
}
func (fs *lockingRawFileSystem) SetXAttr(input *raw.SetXAttrIn, attr string, data []byte) Status {
func (fs *lockingRawFileSystem) SetXAttr(input *SetXAttrIn, attr string, data []byte) Status {
defer fs.locked()()
return fs.RawFS.SetXAttr(input, attr, data)
}
func (fs *lockingRawFileSystem) GetXAttrData(header *raw.InHeader, attr string) (data []byte, code Status) {
func (fs *lockingRawFileSystem) GetXAttrData(header *InHeader, attr string) (data []byte, code Status) {
defer fs.locked()()
return fs.RawFS.GetXAttrData(header, attr)
}
func (fs *lockingRawFileSystem) GetXAttrSize(header *raw.InHeader, attr string) (sz int, code Status) {
func (fs *lockingRawFileSystem) GetXAttrSize(header *InHeader, attr string) (sz int, code Status) {
defer fs.locked()()
return fs.RawFS.GetXAttrSize(header, attr)
}
func (fs *lockingRawFileSystem) ListXAttr(header *raw.InHeader) (data []byte, code Status) {
func (fs *lockingRawFileSystem) ListXAttr(header *InHeader) (data []byte, code Status) {
defer fs.locked()()
return fs.RawFS.ListXAttr(header)
}
func (fs *lockingRawFileSystem) RemoveXAttr(header *raw.InHeader, attr string) Status {
func (fs *lockingRawFileSystem) RemoveXAttr(header *InHeader, attr string) Status {
defer fs.locked()()
return fs.RawFS.RemoveXAttr(header, attr)
}
func (fs *lockingRawFileSystem) Access(input *raw.AccessIn) (code Status) {
func (fs *lockingRawFileSystem) Access(input *AccessIn) (code Status) {
defer fs.locked()()
return fs.RawFS.Access(input)
}
func (fs *lockingRawFileSystem) Create(input *raw.CreateIn, name string, out *raw.CreateOut) (code Status) {
func (fs *lockingRawFileSystem) Create(input *CreateIn, name string, out *CreateOut) (code Status) {
defer fs.locked()()
return fs.RawFS.Create(input, name, out)
}
func (fs *lockingRawFileSystem) OpenDir(input *raw.OpenIn, out *raw.OpenOut) (status Status) {
func (fs *lockingRawFileSystem) OpenDir(input *OpenIn, out *OpenOut) (status Status) {
defer fs.locked()()
return fs.RawFS.OpenDir(input, out)
}
func (fs *lockingRawFileSystem) Release(input *raw.ReleaseIn) {
func (fs *lockingRawFileSystem) Release(input *ReleaseIn) {
defer fs.locked()()
fs.RawFS.Release(input)
}
func (fs *lockingRawFileSystem) ReleaseDir(input *raw.ReleaseIn) {
func (fs *lockingRawFileSystem) ReleaseDir(input *ReleaseIn) {
defer fs.locked()()
fs.RawFS.ReleaseDir(input)
}
func (fs *lockingRawFileSystem) Read(input *raw.ReadIn, buf []byte) (ReadResult, Status) {
func (fs *lockingRawFileSystem) Read(input *ReadIn, buf []byte) (ReadResult, Status) {
defer fs.locked()()
return fs.RawFS.Read(input, buf)
}
func (fs *lockingRawFileSystem) Write(input *raw.WriteIn, data []byte) (written uint32, code Status) {
func (fs *lockingRawFileSystem) Write(input *WriteIn, data []byte) (written uint32, code Status) {
defer fs.locked()()
return fs.RawFS.Write(input, data)
}
func (fs *lockingRawFileSystem) Flush(input *raw.FlushIn) Status {
func (fs *lockingRawFileSystem) Flush(input *FlushIn) Status {
defer fs.locked()()
return fs.RawFS.Flush(input)
}
func (fs *lockingRawFileSystem) Fsync(input *raw.FsyncIn) (code Status) {
func (fs *lockingRawFileSystem) Fsync(input *FsyncIn) (code Status) {
defer fs.locked()()
return fs.RawFS.Fsync(input)
}
func (fs *lockingRawFileSystem) ReadDir(input *raw.ReadIn, out *DirEntryList) Status {
func (fs *lockingRawFileSystem) ReadDir(input *ReadIn, out *DirEntryList) Status {
defer fs.locked()()
return fs.RawFS.ReadDir(input, out)
}
func (fs *lockingRawFileSystem) ReadDirPlus(input *raw.ReadIn, out *DirEntryList) Status {
func (fs *lockingRawFileSystem) ReadDirPlus(input *ReadIn, out *DirEntryList) Status {
defer fs.locked()()
return fs.RawFS.ReadDirPlus(input, out)
}
func (fs *lockingRawFileSystem) FsyncDir(input *raw.FsyncIn) (code Status) {
func (fs *lockingRawFileSystem) FsyncDir(input *FsyncIn) (code Status) {
defer fs.locked()()
return fs.RawFS.FsyncDir(input)
}
......@@ -192,12 +190,12 @@ func (fs *lockingRawFileSystem) Init(s *Server) {
fs.RawFS.Init(s)
}
func (fs *lockingRawFileSystem) StatFs(header *raw.InHeader, out *raw.StatfsOut) (code Status) {
func (fs *lockingRawFileSystem) StatFs(header *InHeader, out *StatfsOut) (code Status) {
defer fs.locked()()
return fs.RawFS.StatFs(header, out)
}
func (fs *lockingRawFileSystem) Fallocate(in *raw.FallocateIn) (code Status) {
func (fs *lockingRawFileSystem) Fallocate(in *FallocateIn) (code Status) {
defer fs.locked()()
return fs.RawFS.Fallocate(in)
}
......
......@@ -4,11 +4,8 @@ import (
"time"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/raw"
)
type StatfsOut raw.StatfsOut
// FileSystem is a high level API that resembles the kernel's idea
// of what an FS looks like. FileSystems can have multiple
// hard-links to one file, for example. It is also suited if the data
......@@ -92,7 +89,7 @@ type Node interface {
Utimens(file File, atime *time.Time, mtime *time.Time, context *fuse.Context) (code fuse.Status)
Fallocate(file File, off uint64, size uint64, mode uint32, context *fuse.Context) (code fuse.Status)
StatFs() *StatfsOut
StatFs() *fuse.StatfsOut
}
// A File object should be returned from FileSystem.Open and
......
......@@ -4,7 +4,6 @@ import (
"time"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/raw"
)
type defaultFile struct{}
......@@ -66,7 +65,7 @@ func (f *defaultFile) Chmod(perms uint32) fuse.Status {
return fuse.ENOSYS
}
func (f *defaultFile) Ioctl(input *raw.IoctlIn) (output *raw.IoctlOut, data []byte, code fuse.Status) {
func (f *defaultFile) Ioctl(input *fuse.IoctlIn) (output *fuse.IoctlOut, data []byte, code fuse.Status) {
return nil, nil, fuse.ENOSYS
}
......
......@@ -43,7 +43,7 @@ type defaultNode struct {
inode *Inode
}
func (n *defaultNode) StatFs() *StatfsOut {
func (n *defaultNode) StatFs() *fuse.StatfsOut {
return nil
}
......
......@@ -4,7 +4,6 @@ import (
"log"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/raw"
)
type connectorDir struct {
......@@ -12,10 +11,10 @@ type connectorDir struct {
stream []fuse.DirEntry
lastOffset uint64
rawFS fuse.RawFileSystem
lookups []raw.EntryOut
lookups []fuse.EntryOut
}
func (d *connectorDir) ReadDir(input *raw.ReadIn, out *fuse.DirEntryList) (code fuse.Status) {
func (d *connectorDir) ReadDir(input *fuse.ReadIn, out *fuse.DirEntryList) (code fuse.Status) {
if d.stream == nil {
return fuse.OK
}
......@@ -43,7 +42,7 @@ func (d *connectorDir) ReadDir(input *raw.ReadIn, out *fuse.DirEntryList) (code
return fuse.OK
}
func (d *connectorDir) ReadDirPlus(input *raw.ReadIn, out *fuse.DirEntryList) (code fuse.Status) {
func (d *connectorDir) ReadDirPlus(input *fuse.ReadIn, out *fuse.DirEntryList) (code fuse.Status) {
if d.stream == nil {
return fuse.OK
}
......@@ -58,7 +57,7 @@ func (d *connectorDir) ReadDirPlus(input *raw.ReadIn, out *fuse.DirEntryList) (c
}
if d.lookups == nil {
d.lookups = make([]raw.EntryOut, len(d.stream))
d.lookups = make([]fuse.EntryOut, len(d.stream))
for i, n := range d.stream {
if n.Name == "." || n.Name == ".." {
continue
......@@ -66,7 +65,7 @@ func (d *connectorDir) ReadDirPlus(input *raw.ReadIn, out *fuse.DirEntryList) (c
// We ignore the return value
code := d.rawFS.Lookup(&input.InHeader, n.Name, &d.lookups[i])
if !code.Ok() {
d.lookups[i] = raw.EntryOut{}
d.lookups[i] = fuse.EntryOut{}
}
}
}
......@@ -88,6 +87,6 @@ func (d *connectorDir) ReadDirPlus(input *raw.ReadIn, out *fuse.DirEntryList) (c
}
type rawDir interface {
ReadDir(out *fuse.DirEntryList, input *raw.ReadIn, c *fuse.Context) fuse.Status
ReadDirPlus(out *fuse.DirEntryList, input *raw.ReadIn, c *fuse.Context) fuse.Status
ReadDir(out *fuse.DirEntryList, input *fuse.ReadIn, c *fuse.Context) fuse.Status
ReadDirPlus(out *fuse.DirEntryList, input *fuse.ReadIn, c *fuse.Context) fuse.Status
}
......@@ -13,7 +13,6 @@ import (
"unsafe"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/raw"
)
// Tests should set to true.
......@@ -100,7 +99,7 @@ func (c *FileSystemConnector) verify() {
root.verify(c.rootNode.mountPoint)
}
func (c *rawBridge) childLookup(out *raw.EntryOut, fsi Node) {
func (c *rawBridge) childLookup(out *fuse.EntryOut, fsi Node) {
n := fsi.Inode()
fsi.GetAttr((*fuse.Attr)(&out.Attr), nil, nil)
n.mount.fillEntry(out)
......@@ -114,7 +113,7 @@ func (c *rawBridge) childLookup(out *raw.EntryOut, fsi Node) {
}
func (c *rawBridge) toInode(nodeid uint64) *Inode {
if nodeid == raw.FUSE_ROOT_ID {
if nodeid == fuse.FUSE_ROOT_ID {
return c.rootNode
}
i := (*Inode)(unsafe.Pointer(c.inodeMap.Decode(nodeid)))
......@@ -130,7 +129,7 @@ func (c *FileSystemConnector) lookupUpdate(node *Inode) (id uint64) {
// Must run outside treeLock.
func (c *FileSystemConnector) forgetUpdate(nodeID uint64, forgetCount int) {
if nodeID == raw.FUSE_ROOT_ID {
if nodeID == fuse.FUSE_ROOT_ID {
c.nodeFs.OnUnmount()
// We never got a lookup for root, so don't try to
......@@ -333,7 +332,7 @@ func (c *FileSystemConnector) Unmount(node *Inode) fuse.Status {
parentId := c.inodeMap.Handle(&parentNode.handled)
if parentNode == c.rootNode {
// TODO - test coverage. Currently covered by zipfs/multizip_test.go
parentId = raw.FUSE_ROOT_ID
parentId = fuse.FUSE_ROOT_ID
}
// We have to wait until the kernel has forgotten the
......@@ -369,7 +368,7 @@ func (c *FileSystemConnector) Unmount(node *Inode) fuse.Status {
func (c *FileSystemConnector) FileNotify(node *Inode, off int64, length int64) fuse.Status {
var nId uint64
if node == c.rootNode {
nId = raw.FUSE_ROOT_ID
nId = fuse.FUSE_ROOT_ID
} else {
nId = c.inodeMap.Handle(&node.handled)
}
......@@ -386,7 +385,7 @@ func (c *FileSystemConnector) FileNotify(node *Inode, off int64, length int64) f
func (c *FileSystemConnector) EntryNotify(node *Inode, name string) fuse.Status {
var nId uint64
if node == c.rootNode {
nId = raw.FUSE_ROOT_ID
nId = fuse.FUSE_ROOT_ID
} else {
nId = c.inodeMap.Handle(&node.handled)
}
......@@ -403,7 +402,7 @@ func (c *FileSystemConnector) DeleteNotify(dir *Inode, child *Inode, name string
var nId uint64
if dir == c.rootNode {
nId = raw.FUSE_ROOT_ID
nId = fuse.FUSE_ROOT_ID
} else {
nId = c.inodeMap.Handle(&dir.handled)
}
......
......@@ -6,7 +6,6 @@ import (
"unsafe"
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/raw"
)
var _ = log.Println
......@@ -59,13 +58,13 @@ func (m *fileSystemMount) mountName() string {
return ""
}
func (m *fileSystemMount) setOwner(attr *raw.Attr) {
func (m *fileSystemMount) setOwner(attr *fuse.Attr) {
if m.options.Owner != nil {
attr.Owner = *(*raw.Owner)(m.options.Owner)
attr.Owner = *(*fuse.Owner)(m.options.Owner)
}
}
func (m *fileSystemMount) fillEntry(out *raw.EntryOut) {
func (m *fileSystemMount) fillEntry(out *fuse.EntryOut) {
splitDuration(m.options.EntryTimeout, &out.EntryValid, &out.EntryValidNsec)
splitDuration(m.options.AttrTimeout, &out.AttrValid, &out.AttrValidNsec)
m.setOwner(&out.Attr)
......@@ -74,7 +73,7 @@ func (m *fileSystemMount) fillEntry(out *raw.EntryOut) {
}
}
func (m *fileSystemMount) fillAttr(out *raw.AttrOut, nodeId uint64) {
func (m *fileSystemMount) fillAttr(out *fuse.AttrOut, nodeId uint64) {
splitDuration(m.options.AttrTimeout, &out.AttrValid, &out.AttrValidNsec)
m.setOwner(&out.Attr)
out.Ino = nodeId
......@@ -140,7 +139,7 @@ func (m *fileSystemMount) registerFileHandle(node *Inode, dir *connectorDir, f F
}
// Creates a return entry for a non-existent path.
func (m *fileSystemMount) negativeEntry(out *raw.EntryOut) bool {
func (m *fileSystemMount) negativeEntry(out *fuse.EntryOut) bool {
if m.options.NegativeTimeout > 0.0 {
out.NodeId = 0
splitDuration(m.options.NegativeTimeout, &out.EntryValid, &out.EntryValidNsec)
......
This diff is collapsed.
......@@ -2,11 +2,12 @@ package nodefs
import (
"fmt"
"github.com/hanwen/go-fuse/raw"
"github.com/hanwen/go-fuse/fuse"
)
func (me *WithFlags) String() string {
return fmt.Sprintf("File %s (%s) %s %s",
me.File, me.Description, raw.FlagString(raw.OpenFlagNames, int64(me.OpenFlags), "O_RDONLY"),
raw.FlagString(raw.FuseOpenFlagNames, int64(me.FuseFlags), ""))
me.File, me.Description, fuse.FlagString(fuse.OpenFlagNames, int64(me.OpenFlags), "O_RDONLY"),
fuse.FlagString(fuse.FuseOpenFlagNames, int64(me.FuseFlags), ""))
}
package nodefs
import "flag"
// VerboseTest returns true if the testing framework is run with -v.
func VerboseTest() bool {
flag := flag.Lookup("test.v")
return flag != nil && flag.Value.String() == "true"
}
This diff is collapsed.
package pathfs
import "flag"
// VerboseTest returns true if the testing framework is run with -v.
func VerboseTest() bool {
flag := flag.Lookup("test.v")
return flag != nil && flag.Value.String() == "true"
}
package raw
package fuse
import (
"fmt"
......
package raw
package fuse
import (
"fmt"
......
package raw
package fuse
import (
"fmt"
......
......@@ -7,18 +7,16 @@ import (
"strings"
"time"
"unsafe"
"github.com/hanwen/go-fuse/raw"
)
var sizeOfOutHeader = unsafe.Sizeof(raw.OutHeader{})
var sizeOfOutHeader = unsafe.Sizeof(OutHeader{})
var zeroOutBuf [outputHeaderSize]byte
type request struct {
inputBuf []byte
// These split up inputBuf.
inHeader *raw.InHeader // generic header
inHeader *InHeader // generic header
inData unsafe.Pointer // per op data
arg []byte // flat data.
......@@ -75,7 +73,7 @@ func (r *request) clear() {
func (r *request) InputDebug() string {
val := " "
if r.handler.DecodeIn != nil {
val = fmt.Sprintf(" data: %v ", raw.Print(r.handler.DecodeIn(r.inData)))
val = fmt.Sprintf(" data: %v ", Print(r.handler.DecodeIn(r.inData)))
}
names := ""
......@@ -94,7 +92,7 @@ func (r *request) InputDebug() string {
func (r *request) OutputDebug() string {
var dataStr string
if r.handler.DecodeOut != nil && r.outData != nil {
dataStr = raw.Print(r.handler.DecodeOut(r.outData))
dataStr = Print(r.handler.DecodeOut(r.outData))
}
max := 1024
......@@ -134,13 +132,13 @@ func (r *request) setInput(input []byte) bool {
}
func (r *request) parse() {
inHSize := int(unsafe.Sizeof(raw.InHeader{}))
inHSize := int(unsafe.Sizeof(InHeader{}))
if len(r.inputBuf) < inHSize {
log.Printf("Short read for input header: %v", r.inputBuf)
return
}
r.inHeader = (*raw.InHeader)(unsafe.Pointer(&r.inputBuf[0]))
r.inHeader = (*InHeader)(unsafe.Pointer(&r.inputBuf[0]))
r.arg = r.inputBuf[:]
r.handler = getHandler(r.inHeader.Opcode)
......@@ -190,9 +188,9 @@ func (r *request) serializeHeader(dataSize int) (header []byte) {
dataLength = 0
}
sizeOfOutHeader := unsafe.Sizeof(raw.OutHeader{})
sizeOfOutHeader := unsafe.Sizeof(OutHeader{})
header = r.outBuf[:sizeOfOutHeader+dataLength]
o := (*raw.OutHeader)(unsafe.Pointer(&header[0]))
o := (*OutHeader)(unsafe.Pointer(&header[0]))
o.Unique = r.inHeader.Unique
o.Status = int32(-r.status)
o.Length = uint32(
......
......@@ -10,8 +10,6 @@ import (
"syscall"
"time"
"unsafe"
"github.com/hanwen/go-fuse/raw"
)
const (
......@@ -43,7 +41,7 @@ type Server struct {
readPool [][]byte
reqReaders int
outstandingReadBufs int
kernelSettings raw.InitIn
kernelSettings InitIn
canSplice bool
loops sync.WaitGroup
......@@ -56,7 +54,7 @@ func (ms *Server) SetDebug(dbg bool) {
// KernelSettings returns the Init message from the kernel, so
// filesystems can adapt to availability of features of the kernel
// driver.
func (ms *Server) KernelSettings() raw.InitIn {
func (ms *Server) KernelSettings() InitIn {
ms.reqMu.Lock()
s := ms.kernelSettings
ms.reqMu.Unlock()
......@@ -381,17 +379,17 @@ func (ms *Server) write(req *request) Status {
// InodeNotify invalidates the information associated with the inode
// (ie. data cache, attributes, etc.)
func (ms *Server) InodeNotify(node uint64, off int64, length int64) Status {
entry := &raw.NotifyInvalInodeOut{
entry := &NotifyInvalInodeOut{
Ino: node,
Off: off,
Length: length,
}
req := request{
inHeader: &raw.InHeader{
inHeader: &InHeader{
Opcode: _OP_NOTIFY_INODE,
},
handler: operationHandlers[_OP_NOTIFY_INODE],
status: raw.NOTIFY_INVAL_INODE,
status: NOTIFY_INVAL_INODE,
}
req.outData = unsafe.Pointer(entry)
......@@ -416,13 +414,13 @@ func (ms *Server) DeleteNotify(parent uint64, child uint64, name string) Status
}
req := request{
inHeader: &raw.InHeader{
inHeader: &InHeader{
Opcode: _OP_NOTIFY_DELETE,
},
handler: operationHandlers[_OP_NOTIFY_DELETE],
status: raw.NOTIFY_INVAL_DELETE,
status: NOTIFY_INVAL_DELETE,
}
entry := &raw.NotifyInvalDeleteOut{
entry := &NotifyInvalDeleteOut{
Parent: parent,
Child: child,
NameLen: uint32(len(name)),
......@@ -451,13 +449,13 @@ func (ms *Server) DeleteNotify(parent uint64, child uint64, name string) Status
// within a directory changes.
func (ms *Server) EntryNotify(parent uint64, name string) Status {
req := request{
inHeader: &raw.InHeader{
inHeader: &InHeader{
Opcode: _OP_NOTIFY_ENTRY,
},
handler: operationHandlers[_OP_NOTIFY_ENTRY],
status: raw.NOTIFY_INVAL_ENTRY,
status: NOTIFY_INVAL_ENTRY,
}
entry := &raw.NotifyInvalEntryOut{
entry := &NotifyInvalEntryOut{
Parent: parent,
NameLen: uint32(len(name)),
}
......
package test
import "flag"
// VerboseTest returns true if the testing framework is run with -v.
func VerboseTest() bool {
flag := flag.Lookup("test.v")
return flag != nil && flag.Value.String() == "true"
}
package fuse
import (
"github.com/hanwen/go-fuse/raw"
)
func (a *Attr) String() string {
return raw.Print((*raw.Attr)(a))
return Print((*Attr)(a))
}
package fuse
import (
"github.com/hanwen/go-fuse/raw"
"os"
"syscall"
)
const (
S_IFDIR = syscall.S_IFDIR
S_IFREG = syscall.S_IFREG
S_IFLNK = syscall.S_IFLNK
S_IFIFO = syscall.S_IFIFO
O_ANYWRITE = uint32(os.O_WRONLY | os.O_RDWR | os.O_APPEND | os.O_CREATE | os.O_TRUNC)
)
const PAGESIZE = 4096
const (
......@@ -42,9 +31,412 @@ const (
EROFS = Status(syscall.EROFS)
)
type Attr raw.Attr
type ForgetIn struct {
InHeader
Nlookup uint64
}
type ForgetOne struct {
NodeId uint64
Nlookup uint64
}
type BatchForgetIn struct {
InHeader
Count uint32
Dummy uint32
}
type MkdirIn struct {
InHeader
Mode uint32
Umask uint32
}
type RenameIn struct {
InHeader
Newdir uint64
}
type LinkIn struct {
InHeader
Oldnodeid uint64
}
type MknodIn struct {
InHeader
Mode uint32
Rdev uint32
Umask uint32
Padding uint32
}
type Owner struct {
Uid uint32
Gid uint32
}
const ( // SetAttrIn.Valid
FATTR_MODE = (1 << 0)
FATTR_UID = (1 << 1)
FATTR_GID = (1 << 2)
FATTR_SIZE = (1 << 3)
FATTR_ATIME = (1 << 4)
FATTR_MTIME = (1 << 5)
FATTR_FH = (1 << 6)
FATTR_ATIME_NOW = (1 << 7)
FATTR_MTIME_NOW = (1 << 8)
FATTR_LOCKOWNER = (1 << 9)
)
type SetAttrInCommon struct {
InHeader
Valid uint32
Padding uint32
Fh uint64
Size uint64
LockOwner uint64
Atime uint64
Mtime uint64
Unused2 uint64
Atimensec uint32
Mtimensec uint32
Unused3 uint32
Mode uint32
Unused4 uint32
Owner
Unused5 uint32
}
const RELEASE_FLUSH = (1 << 0)
type ReleaseIn struct {
InHeader
Fh uint64
Flags uint32
ReleaseFlags uint32
LockOwner uint64
}
type OpenIn struct {
InHeader
Flags uint32
Unused uint32
}
const (
// OpenOut.Flags
FOPEN_DIRECT_IO = (1 << 0)
FOPEN_KEEP_CACHE = (1 << 1)
FOPEN_NONSEEKABLE = (1 << 2)
)
type OpenOut struct {
Fh uint64
OpenFlags uint32
Padding uint32
}
// To be set in InitIn/InitOut.Flags.
const (
CAP_ASYNC_READ = (1 << 0)
CAP_POSIX_LOCKS = (1 << 1)
CAP_FILE_OPS = (1 << 2)
CAP_ATOMIC_O_TRUNC = (1 << 3)
CAP_EXPORT_SUPPORT = (1 << 4)
CAP_BIG_WRITES = (1 << 5)
CAP_DONT_MASK = (1 << 6)
CAP_SPLICE_WRITE = (1 << 7)
CAP_SPLICE_MOVE = (1 << 8)
CAP_SPLICE_READ = (1 << 9)
CAP_FLOCK_LOCKS = (1 << 10)
CAP_IOCTL_DIR = (1 << 11)
CAP_AUTO_INVAL_DATA = (1 << 12)
CAP_READDIRPLUS = (1 << 13)
CAP_READDIRPLUS_AUTO = (1 << 14)
)
type InitIn struct {
InHeader
Major uint32
Minor uint32
MaxReadAhead uint32
Flags uint32
}
type InitOut struct {
Major uint32
Minor uint32
MaxReadAhead uint32
Flags uint32
MaxBackground uint16
CongestionThreshold uint16
MaxWrite uint32
}
type CuseInitIn struct {
InHeader
Major uint32
Minor uint32
Unused uint32
Flags uint32
}
type CuseInitOut struct {
Major uint32
Minor uint32
Unused uint32
Flags uint32
MaxRead uint32
MaxWrite uint32
DevMajor uint32
DevMinor uint32
Spare [10]uint32
}
type InterruptIn struct {
InHeader
Unique uint64
}
type BmapIn struct {
InHeader
Block uint64
Blocksize uint32
Padding uint32
}
type BmapOut struct {
Block uint64
}
const (
FUSE_IOCTL_COMPAT = (1 << 0)
FUSE_IOCTL_UNRESTRICTED = (1 << 1)
FUSE_IOCTL_RETRY = (1 << 2)
)
type IoctlIn struct {
InHeader
Fh uint64
Flags uint32
Cmd uint32
Arg uint64
InSize uint32
OutSize uint32
}
type Owner raw.Owner
type IoctlOut struct {
Result int32
Flags uint32
InIovs uint32
OutIovs uint32
}
type PollIn struct {
InHeader
Fh uint64
Kh uint64
Flags uint32
Padding uint32
}
type PollOut struct {
Revents uint32
Padding uint32
}
type NotifyPollWakeupOut struct {
Kh uint64
}
type WriteOut struct {
Size uint32
Padding uint32
}
type SetXAttrIn struct {
InHeader
Size uint32
Flags uint32
}
type GetXAttrIn struct {
InHeader
Size uint32
Padding uint32
}
type GetXAttrOut struct {
Size uint32
Padding uint32
}
type FileLock struct {
Start uint64
End uint64
Typ uint32
Pid uint32
}
type LkIn struct {
InHeader
Fh uint64
Owner uint64
Lk FileLock
LkFlags uint32
Padding uint32
}
type LkOut struct {
Lk FileLock
}
// For AccessIn.Mask.
const (
X_OK = 1
W_OK = 2
R_OK = 4
F_OK = 0
)
type AccessIn struct {
InHeader
Mask uint32
Padding uint32
}
type FsyncIn struct {
InHeader
Fh uint64
FsyncFlags uint32
Padding uint32
}
type OutHeader struct {
Length uint32
Status int32
Unique uint64
}
type CreateIn struct {
InHeader
Flags uint32
Mode uint32
Umask uint32
Padding uint32
}
type NotifyInvalInodeOut struct {
Ino uint64
Off int64
Length int64
}
type NotifyInvalEntryOut struct {
Parent uint64
NameLen uint32
Padding uint32
}
type NotifyInvalDeleteOut struct {
Parent uint64
Child uint64
NameLen uint32
Padding uint32
}
const (
NOTIFY_POLL = -1
NOTIFY_INVAL_INODE = -2
NOTIFY_INVAL_ENTRY = -3
NOTIFY_STORE = -4
NOTIFY_RETRIEVE = -5
NOTIFY_INVAL_DELETE = -6
NOTIFY_CODE_MAX = -6
)
type FlushIn struct {
InHeader
Fh uint64
Unused uint32
Padding uint32
LockOwner uint64
}
type EntryOut struct {
NodeId uint64
Generation uint64
EntryValid uint64
AttrValid uint64
EntryValidNsec uint32
AttrValidNsec uint32
Attr
}
type AttrOut struct {
AttrValid uint64
AttrValidNsec uint32
Dummy uint32
Attr
}
type CreateOut struct {
EntryOut
OpenOut
}
type Context struct {
Owner
Pid uint32
}
type InHeader struct {
Length uint32
Opcode int32
Unique uint64
NodeId uint64
Context
Padding uint32
}
type StatfsOut struct {
Blocks uint64
Bfree uint64
Bavail uint64
Files uint64
Ffree uint64
Bsize uint32
NameLen uint32
Frsize uint32
Padding uint32
Spare [6]uint32
}
type Dirent struct {
Ino uint64
Off uint64
NameLen uint32
Typ uint32
}
const (
READ_LOCKOWNER = (1 << 1)
)
const (
WRITE_CACHE = (1 << 0)
WRITE_LOCKOWNER = (1 << 1)
)
// Context contains assorted per-request data
type Context raw.Context
type FallocateIn struct {
InHeader
Fh uint64
Offset uint64
Length uint64
Mode uint32
Padding uint32
}
package raw
package fuse
type Attr struct {
Ino uint64
......
package raw
package fuse
type Attr struct {
Ino uint64
......
// The raw package contains types and constants used for the FUSE wire
// protocol.
package raw
type ForgetIn struct {
InHeader
Nlookup uint64
}
type ForgetOne struct {
NodeId uint64
Nlookup uint64
}
type BatchForgetIn struct {
InHeader
Count uint32
Dummy uint32
}
type MkdirIn struct {
InHeader
Mode uint32
Umask uint32
}
type RenameIn struct {
InHeader
Newdir uint64
}
type LinkIn struct {
InHeader
Oldnodeid uint64
}
type MknodIn struct {
InHeader
Mode uint32
Rdev uint32
Umask uint32
Padding uint32
}
type Owner struct {
Uid uint32
Gid uint32
}
const ( // SetAttrIn.Valid
FATTR_MODE = (1 << 0)
FATTR_UID = (1 << 1)
FATTR_GID = (1 << 2)
FATTR_SIZE = (1 << 3)
FATTR_ATIME = (1 << 4)
FATTR_MTIME = (1 << 5)
FATTR_FH = (1 << 6)
FATTR_ATIME_NOW = (1 << 7)
FATTR_MTIME_NOW = (1 << 8)
FATTR_LOCKOWNER = (1 << 9)
)
type SetAttrInCommon struct {
InHeader
Valid uint32
Padding uint32
Fh uint64
Size uint64
LockOwner uint64
Atime uint64
Mtime uint64
Unused2 uint64
Atimensec uint32
Mtimensec uint32
Unused3 uint32
Mode uint32
Unused4 uint32
Owner
Unused5 uint32
}
const RELEASE_FLUSH = (1 << 0)
type ReleaseIn struct {
InHeader
Fh uint64
Flags uint32
ReleaseFlags uint32
LockOwner uint64
}
type OpenIn struct {
InHeader
Flags uint32
Unused uint32
}
const (
// OpenOut.Flags
FOPEN_DIRECT_IO = (1 << 0)
FOPEN_KEEP_CACHE = (1 << 1)
FOPEN_NONSEEKABLE = (1 << 2)
)
type OpenOut struct {
Fh uint64
OpenFlags uint32
Padding uint32
}
// To be set in InitIn/InitOut.Flags.
const (
CAP_ASYNC_READ = (1 << 0)
CAP_POSIX_LOCKS = (1 << 1)
CAP_FILE_OPS = (1 << 2)
CAP_ATOMIC_O_TRUNC = (1 << 3)
CAP_EXPORT_SUPPORT = (1 << 4)
CAP_BIG_WRITES = (1 << 5)
CAP_DONT_MASK = (1 << 6)
CAP_SPLICE_WRITE = (1 << 7)
CAP_SPLICE_MOVE = (1 << 8)
CAP_SPLICE_READ = (1 << 9)
CAP_FLOCK_LOCKS = (1 << 10)
CAP_IOCTL_DIR = (1 << 11)
CAP_AUTO_INVAL_DATA = (1 << 12)
CAP_READDIRPLUS = (1 << 13)
CAP_READDIRPLUS_AUTO = (1 << 14)
)
type InitIn struct {
InHeader
Major uint32
Minor uint32
MaxReadAhead uint32
Flags uint32
}
type InitOut struct {
Major uint32
Minor uint32
MaxReadAhead uint32
Flags uint32
MaxBackground uint16
CongestionThreshold uint16
MaxWrite uint32
}
type CuseInitIn struct {
InHeader
Major uint32
Minor uint32
Unused uint32
Flags uint32
}
type CuseInitOut struct {
Major uint32
Minor uint32
Unused uint32
Flags uint32
MaxRead uint32
MaxWrite uint32
DevMajor uint32
DevMinor uint32
Spare [10]uint32
}
type InterruptIn struct {
InHeader
Unique uint64
}
type BmapIn struct {
InHeader
Block uint64
Blocksize uint32
Padding uint32
}
type BmapOut struct {
Block uint64
}
const (
FUSE_IOCTL_COMPAT = (1 << 0)
FUSE_IOCTL_UNRESTRICTED = (1 << 1)
FUSE_IOCTL_RETRY = (1 << 2)
)
type IoctlIn struct {
InHeader
Fh uint64
Flags uint32
Cmd uint32
Arg uint64
InSize uint32
OutSize uint32
}
type IoctlOut struct {
Result int32
Flags uint32
InIovs uint32
OutIovs uint32
}
type PollIn struct {
InHeader
Fh uint64
Kh uint64
Flags uint32
Padding uint32
}
type PollOut struct {
Revents uint32
Padding uint32
}
type NotifyPollWakeupOut struct {
Kh uint64
}
type WriteOut struct {
Size uint32
Padding uint32
}
type SetXAttrIn struct {
InHeader
Size uint32
Flags uint32
}
type GetXAttrIn struct {
InHeader
Size uint32
Padding uint32
}
type GetXAttrOut struct {
Size uint32
Padding uint32
}
type FileLock struct {
Start uint64
End uint64
Typ uint32
Pid uint32
}
type LkIn struct {
InHeader
Fh uint64
Owner uint64
Lk FileLock
LkFlags uint32
Padding uint32
}
type LkOut struct {
Lk FileLock
}
// For AccessIn.Mask.
const (
X_OK = 1
W_OK = 2
R_OK = 4
F_OK = 0
)
type AccessIn struct {
InHeader
Mask uint32
Padding uint32
}
type FsyncIn struct {
InHeader
Fh uint64
FsyncFlags uint32
Padding uint32
}
type OutHeader struct {
Length uint32
Status int32
Unique uint64
}
type CreateIn struct {
InHeader
Flags uint32
Mode uint32
Umask uint32
Padding uint32
}
type NotifyInvalInodeOut struct {
Ino uint64
Off int64
Length int64
}
type NotifyInvalEntryOut struct {
Parent uint64
NameLen uint32
Padding uint32
}
type NotifyInvalDeleteOut struct {
Parent uint64
Child uint64
NameLen uint32
Padding uint32
}
const (
NOTIFY_POLL = -1
NOTIFY_INVAL_INODE = -2
NOTIFY_INVAL_ENTRY = -3
NOTIFY_STORE = -4
NOTIFY_RETRIEVE = -5
NOTIFY_INVAL_DELETE = -6
NOTIFY_CODE_MAX = -6
)
type FlushIn struct {
InHeader
Fh uint64
Unused uint32
Padding uint32
LockOwner uint64
}
type EntryOut struct {
NodeId uint64
Generation uint64
EntryValid uint64
AttrValid uint64
EntryValidNsec uint32
AttrValidNsec uint32
Attr
}
type AttrOut struct {
AttrValid uint64
AttrValidNsec uint32
Dummy uint32
Attr
}
type CreateOut struct {
EntryOut
OpenOut
}
type Context struct {
Owner
Pid uint32
}
type InHeader struct {
Length uint32
Opcode int32
Unique uint64
NodeId uint64
Context
Padding uint32
}
type StatfsOut struct {
Blocks uint64
Bfree uint64
Bavail uint64
Files uint64
Ffree uint64
Bsize uint32
NameLen uint32
Frsize uint32
Padding uint32
Spare [6]uint32
}
type Dirent struct {
Ino uint64
Off uint64
NameLen uint32
Typ uint32
}
const (
READ_LOCKOWNER = (1 << 1)
)
const (
WRITE_CACHE = (1 << 0)
WRITE_LOCKOWNER = (1 << 1)
)
type FallocateIn struct {
InHeader
Fh uint64
Offset uint64
Length uint64
Mode uint32
Padding uint32
}
package unionfs
import "flag"
// VerboseTest returns true if the testing framework is run with -v.
func VerboseTest() bool {
flag := flag.Lookup("test.v")
return flag != nil && flag.Value.String() == "true"
}
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