fuse

package
v0.0.0-...-82cd6e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2012 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FUSE_ROOT_ID = 1

	FUSE_UNKNOWN_INO = 0xffffffff

	CUSE_UNRESTRICTED_IOCTL = (1 << 0)

	FUSE_LK_FLOCK = (1 << 0)

	FUSE_IOCTL_MAX_IOV = 256

	FUSE_POLL_SCHEDULE_NOTIFY = (1 << 0)

	CUSE_INIT_INFO_MAX = 4096

	S_IFDIR = syscall.S_IFDIR
	S_IFREG = syscall.S_IFREG
	S_IFLNK = syscall.S_IFLNK
	S_IFIFO = syscall.S_IFIFO

	CUSE_INIT = 4096

	O_ANYWRITE = uint32(os.O_WRONLY | os.O_RDWR | os.O_APPEND | os.O_CREATE | os.O_TRUNC)
)
View Source
const (
	OK      = Status(0)
	EACCES  = Status(syscall.EACCES)
	EBUSY   = Status(syscall.EBUSY)
	EINVAL  = Status(syscall.EINVAL)
	EIO     = Status(syscall.EIO)
	ENOENT  = Status(syscall.ENOENT)
	ENOSYS  = Status(syscall.ENOSYS)
	ENODATA = Status(syscall.ENODATA)
	ENOTDIR = Status(syscall.ENOTDIR)
	EPERM   = Status(syscall.EPERM)
	ERANGE  = Status(syscall.ERANGE)
	EXDEV   = Status(syscall.EXDEV)
	EBADF   = Status(syscall.EBADF)
	ENODEV  = Status(syscall.ENODEV)
	EROFS   = Status(syscall.EROFS)
)
View Source
const (
	NOTIFY_POLL        = -1
	NOTIFY_INVAL_INODE = -2
	NOTIFY_INVAL_ENTRY = -3
	NOTIFY_CODE_MAX    = -4
)
View Source
const (
	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)
)
View Source
const (
	// OpenOut.Flags
	FOPEN_DIRECT_IO   = (1 << 0)
	FOPEN_KEEP_CACHE  = (1 << 1)
	FOPEN_NONSEEKABLE = (1 << 2)
)
View Source
const (
	WRITE_CACHE     = (1 << 0)
	WRITE_LOCKOWNER = (1 << 1)
)
View Source
const (
	X_OK = 1
	W_OK = 2
	R_OK = 4
	F_OK = 0
)

For AccessIn.Mask.

View Source
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)
)

To be set in InitIn/InitOut.Flags.

View Source
const (
	FUSE_IOCTL_COMPAT       = (1 << 0)
	FUSE_IOCTL_UNRESTRICTED = (1 << 1)
	FUSE_IOCTL_RETRY        = (1 << 2)
)
View Source
const AT_FDCWD = -100
View Source
const (
	// Mask for GetAttrIn.Flags. If set, GetAttrIn has a file handle set.
	FUSE_GETATTR_FH = (1 << 0)
)
View Source
const (
	// The kernel caps writes at 128k.
	MAX_KERNEL_WRITE = 128 * 1024
)
View Source
const PAGESIZE = 4096
View Source
const (
	READ_LOCKOWNER = (1 << 1)
)
View Source
const RELEASE_FLUSH = (1 << 0)

Variables

This section is empty.

Functions

func CheckSuccess

func CheckSuccess(e error)

func GetXAttr

func GetXAttr(path string, attr string, dest []byte) (value []byte, errno int)

func Linkat

func Linkat(fd1 int, n1 string, fd2 int, n2 string) int

func ListXAttr

func ListXAttr(path string) (attributes []string, errno int)

func ModeToType

func ModeToType(mode uint32) uint32

func MountNodeFileSystem

func MountNodeFileSystem(mountpoint string, nodeFs NodeFileSystem, opts *FileSystemOptions) (*MountState, *FileSystemConnector, error)

func Removexattr

func Removexattr(path string, attr string) (errno int)

func ReverseJoin

func ReverseJoin(rev_components []string, sep string) string

func Setxattr

func Setxattr(path string, attr string, data []byte, flags int) (errno int)

func ToStatT

func ToStatT(f os.FileInfo) *syscall.Stat_t

func VerboseTest

func VerboseTest() bool

func Version

func Version() string

func Writev

func Writev(fd int, packet [][]byte) (n int, err error)

Types

type AccessIn

type AccessIn struct {
	Mask    uint32
	Padding uint32
}

func (*AccessIn) String

func (me *AccessIn) String() string

type Attr

type Attr struct {
	Ino       uint64
	Size      uint64
	Blocks    uint64
	Atime     uint64
	Mtime     uint64
	Ctime     uint64
	Atimensec uint32
	Mtimensec uint32
	Ctimensec uint32
	Mode      uint32
	Nlink     uint32
	Owner
	Rdev    uint32
	Blksize uint32
	Padding uint32
}

func ToAttr

func ToAttr(f os.FileInfo) *Attr

func (*Attr) AccessTime

func (a *Attr) AccessTime() time.Time

func (*Attr) Atimens

func (a *Attr) Atimens() int64

func (*Attr) ChangeTime

func (a *Attr) ChangeTime() time.Time

func (*Attr) Ctimens

func (a *Attr) Ctimens() int64

func (*Attr) FromStat

func (a *Attr) FromStat(s *syscall.Stat_t)

func (*Attr) IsBlock

func (me *Attr) IsBlock() bool

IsBlock reports whether the FileInfo describes a block special file.

func (*Attr) IsChar

func (me *Attr) IsChar() bool

IsChar reports whether the FileInfo describes a character special file.

func (*Attr) IsDir

func (me *Attr) IsDir() bool

IsDir reports whether the FileInfo describes a directory.

func (*Attr) IsFifo

func (me *Attr) IsFifo() bool

func (*Attr) IsRegular

func (me *Attr) IsRegular() bool

IsRegular reports whether the FileInfo describes a regular file.

func (*Attr) IsSocket

func (me *Attr) IsSocket() bool

IsSocket reports whether the FileInfo describes a socket.

func (me *Attr) IsSymlink() bool

IsSymlink reports whether the FileInfo describes a symbolic link.

func (*Attr) ModTime

func (a *Attr) ModTime() time.Time

func (*Attr) Mtimens

func (a *Attr) Mtimens() int64

func (*Attr) SetNs

func (a *Attr) SetNs(atimens int64, mtimens int64, ctimens int64)

func (*Attr) SetTimes

func (a *Attr) SetTimes(access *time.Time, mod *time.Time, chstatus *time.Time)

func (*Attr) String

func (me *Attr) String() string

type AttrOut

type AttrOut struct {
	AttrValid     uint64
	AttrValidNsec uint32
	Dummy         uint32
	Attr
}

func (*AttrOut) String

func (me *AttrOut) String() string

type BmapIn

type BmapIn struct {
	Block     uint64
	Blocksize uint32
	Padding   uint32
}

type BmapOut

type BmapOut struct {
	Block uint64
}

type BufferPool

type BufferPool interface {
	AllocBuffer(size uint32) []byte
	FreeBuffer(slice []byte)
	String() string
}

type BufferPoolImpl

type BufferPoolImpl struct {
	// contains filtered or unexported fields
}

BufferPool implements a pool of buffers that returns slices with capacity of a multiple of PAGESIZE, which have possibly been used, and may contain random contents.

func NewBufferPool

func NewBufferPool() *BufferPoolImpl

func (*BufferPoolImpl) AllocBuffer

func (me *BufferPoolImpl) AllocBuffer(size uint32) []byte

AllocBuffer creates a buffer of at least the given size. After use, it should be deallocated with FreeBuffer().

func (*BufferPoolImpl) FreeBuffer

func (me *BufferPoolImpl) FreeBuffer(slice []byte)

FreeBuffer takes back a buffer if it was allocated through AllocBuffer. It is not an error to call FreeBuffer() on a slice obtained elsewhere.

func (*BufferPoolImpl) String

func (me *BufferPoolImpl) String() string

type Context

type Context struct {
	Owner
	Pid uint32
}

type CreateIn

type CreateIn struct {
	Flags   uint32
	Mode    uint32
	Umask   uint32
	Padding uint32
}

func (*CreateIn) String

func (me *CreateIn) String() string

type CreateOut

type CreateOut struct {
	EntryOut
	OpenOut
}

func (*CreateOut) String

func (me *CreateOut) String() string

type CuseInitIn

type CuseInitIn struct {
	Major  uint32
	Minor  uint32
	Unused uint32
	Flags  uint32
}

type CuseInitOut

type CuseInitOut struct {
	Major    uint32
	Minor    uint32
	Unused   uint32
	Flags    uint32
	MaxRead  uint32
	MaxWrite uint32
	DevMajor uint32
	DevMinor uint32
	Spare    [10]uint32
}

type DataFile

type DataFile struct {
	DefaultFile
	// contains filtered or unexported fields
}

DataFile is for implementing read-only filesystems. This assumes we already have the data in memory.

func NewDataFile

func NewDataFile(data []byte) *DataFile

func (*DataFile) GetAttr

func (me *DataFile) GetAttr() (*Attr, Status)

func (*DataFile) Read

func (me *DataFile) Read(input *ReadIn, bp BufferPool) ([]byte, Status)

func (*DataFile) String

func (me *DataFile) String() string

type DefaultFile

type DefaultFile struct{}

DefaultFile returns ENOSYS for every operation.

func (*DefaultFile) Chmod

func (me *DefaultFile) Chmod(perms uint32) Status

func (*DefaultFile) Chown

func (me *DefaultFile) Chown(uid uint32, gid uint32) Status

func (*DefaultFile) Flush

func (me *DefaultFile) Flush() Status

func (*DefaultFile) Fsync

func (me *DefaultFile) Fsync(*FsyncIn) (code Status)

func (*DefaultFile) GetAttr

func (me *DefaultFile) GetAttr() (*Attr, Status)

func (*DefaultFile) InnerFile

func (me *DefaultFile) InnerFile() File

func (*DefaultFile) Ioctl

func (me *DefaultFile) Ioctl(input *IoctlIn) (output *IoctlOut, data []byte, code Status)

func (*DefaultFile) Read

func (me *DefaultFile) Read(*ReadIn, BufferPool) ([]byte, Status)

func (*DefaultFile) Release

func (me *DefaultFile) Release()

func (*DefaultFile) SetInode

func (me *DefaultFile) SetInode(*Inode)

func (*DefaultFile) String

func (me *DefaultFile) String() string

func (*DefaultFile) Truncate

func (me *DefaultFile) Truncate(size uint64) Status

func (*DefaultFile) Utimens

func (me *DefaultFile) Utimens(atimeNs int64, mtimeNs int64) Status

func (*DefaultFile) Write

func (me *DefaultFile) Write(*WriteIn, []byte) (uint32, Status)

type DefaultFileSystem

type DefaultFileSystem struct{}

DefaultFileSystem implements a FileSystem that returns ENOSYS for every operation.

func (*DefaultFileSystem) Access

func (me *DefaultFileSystem) Access(name string, mode uint32, context *Context) (code Status)

func (*DefaultFileSystem) Chmod

func (me *DefaultFileSystem) Chmod(name string, mode uint32, context *Context) (code Status)

func (*DefaultFileSystem) Chown

func (me *DefaultFileSystem) Chown(name string, uid uint32, gid uint32, context *Context) (code Status)

func (*DefaultFileSystem) Create

func (me *DefaultFileSystem) Create(name string, flags uint32, mode uint32, context *Context) (file File, code Status)

func (*DefaultFileSystem) GetAttr

func (me *DefaultFileSystem) GetAttr(name string, context *Context) (*Attr, Status)

DefaultFileSystem

func (*DefaultFileSystem) GetXAttr

func (me *DefaultFileSystem) GetXAttr(name string, attr string, context *Context) ([]byte, Status)
func (me *DefaultFileSystem) Link(oldName string, newName string, context *Context) (code Status)

func (*DefaultFileSystem) ListXAttr

func (me *DefaultFileSystem) ListXAttr(name string, context *Context) ([]string, Status)

func (*DefaultFileSystem) Mkdir

func (me *DefaultFileSystem) Mkdir(name string, mode uint32, context *Context) Status

func (*DefaultFileSystem) Mknod

func (me *DefaultFileSystem) Mknod(name string, mode uint32, dev uint32, context *Context) Status

func (*DefaultFileSystem) OnMount

func (me *DefaultFileSystem) OnMount(nodeFs *PathNodeFs)

func (*DefaultFileSystem) OnUnmount

func (me *DefaultFileSystem) OnUnmount()

func (*DefaultFileSystem) Open

func (me *DefaultFileSystem) Open(name string, flags uint32, context *Context) (file File, code Status)

func (*DefaultFileSystem) OpenDir

func (me *DefaultFileSystem) OpenDir(name string, context *Context) (stream chan DirEntry, status Status)
func (me *DefaultFileSystem) Readlink(name string, context *Context) (string, Status)

func (*DefaultFileSystem) RemoveXAttr

func (me *DefaultFileSystem) RemoveXAttr(name string, attr string, context *Context) Status

func (*DefaultFileSystem) Rename

func (me *DefaultFileSystem) Rename(oldName string, newName string, context *Context) (code Status)

func (*DefaultFileSystem) Rmdir

func (me *DefaultFileSystem) Rmdir(name string, context *Context) (code Status)

func (*DefaultFileSystem) SetXAttr

func (me *DefaultFileSystem) SetXAttr(name string, attr string, data []byte, flags int, context *Context) Status

func (*DefaultFileSystem) StatFs

func (me *DefaultFileSystem) StatFs(name string) *StatfsOut

func (*DefaultFileSystem) String

func (me *DefaultFileSystem) String() string
func (me *DefaultFileSystem) Symlink(value string, linkName string, context *Context) (code Status)

func (*DefaultFileSystem) Truncate

func (me *DefaultFileSystem) Truncate(name string, offset uint64, context *Context) (code Status)
func (me *DefaultFileSystem) Unlink(name string, context *Context) (code Status)

func (*DefaultFileSystem) Utimens

func (me *DefaultFileSystem) Utimens(name string, AtimeNs int64, CtimeNs int64, context *Context) (code Status)

type DefaultFsNode

type DefaultFsNode struct {
	// contains filtered or unexported fields
}

func (*DefaultFsNode) Access

func (me *DefaultFsNode) Access(mode uint32, context *Context) (code Status)

func (*DefaultFsNode) Chmod

func (me *DefaultFsNode) Chmod(file File, perms uint32, context *Context) (code Status)

func (*DefaultFsNode) Chown

func (me *DefaultFsNode) Chown(file File, uid uint32, gid uint32, context *Context) (code Status)

func (*DefaultFsNode) Create

func (me *DefaultFsNode) Create(name string, flags uint32, mode uint32, context *Context) (file File, fi *Attr, newNode FsNode, code Status)

func (*DefaultFsNode) Deletable

func (me *DefaultFsNode) Deletable() bool

func (*DefaultFsNode) Flush

func (me *DefaultFsNode) Flush(file File, openFlags uint32, context *Context) (code Status)

func (*DefaultFsNode) GetAttr

func (me *DefaultFsNode) GetAttr(file File, context *Context) (fi *Attr, code Status)

func (*DefaultFsNode) GetXAttr

func (me *DefaultFsNode) GetXAttr(attribute string, context *Context) (data []byte, code Status)

func (*DefaultFsNode) Inode

func (me *DefaultFsNode) Inode() *Inode
func (me *DefaultFsNode) Link(name string, existing FsNode, context *Context) (fi *Attr, newNode FsNode, code Status)

func (*DefaultFsNode) ListXAttr

func (me *DefaultFsNode) ListXAttr(context *Context) (attrs []string, code Status)

func (*DefaultFsNode) Lookup

func (me *DefaultFsNode) Lookup(name string, context *Context) (fi *Attr, node FsNode, code Status)

func (*DefaultFsNode) Mkdir

func (me *DefaultFsNode) Mkdir(name string, mode uint32, context *Context) (fi *Attr, newNode FsNode, code Status)

func (*DefaultFsNode) Mknod

func (me *DefaultFsNode) Mknod(name string, mode uint32, dev uint32, context *Context) (fi *Attr, newNode FsNode, code Status)

func (*DefaultFsNode) OnForget

func (me *DefaultFsNode) OnForget()

func (*DefaultFsNode) Open

func (me *DefaultFsNode) Open(flags uint32, context *Context) (file File, code Status)

func (*DefaultFsNode) OpenDir

func (me *DefaultFsNode) OpenDir(context *Context) (chan DirEntry, Status)
func (me *DefaultFsNode) Readlink(c *Context) ([]byte, Status)

func (*DefaultFsNode) RemoveXAttr

func (me *DefaultFsNode) RemoveXAttr(attr string, context *Context) Status

func (*DefaultFsNode) Rename

func (me *DefaultFsNode) Rename(oldName string, newParent FsNode, newName string, context *Context) (code Status)

func (*DefaultFsNode) Rmdir

func (me *DefaultFsNode) Rmdir(name string, context *Context) (code Status)

func (*DefaultFsNode) SetInode

func (me *DefaultFsNode) SetInode(node *Inode)

func (*DefaultFsNode) SetXAttr

func (me *DefaultFsNode) SetXAttr(attr string, data []byte, flags int, context *Context) Status

func (*DefaultFsNode) StatFs

func (me *DefaultFsNode) StatFs() *StatfsOut
func (me *DefaultFsNode) Symlink(name string, content string, context *Context) (fi *Attr, newNode FsNode, code Status)

func (*DefaultFsNode) Truncate

func (me *DefaultFsNode) Truncate(file File, size uint64, context *Context) (code Status)
func (me *DefaultFsNode) Unlink(name string, context *Context) (code Status)

func (*DefaultFsNode) Utimens

func (me *DefaultFsNode) Utimens(file File, atime int64, mtime int64, context *Context) (code Status)

type DefaultNodeFileSystem

type DefaultNodeFileSystem struct {
}

func (*DefaultNodeFileSystem) OnMount

func (me *DefaultNodeFileSystem) OnMount(conn *FileSystemConnector)

func (*DefaultNodeFileSystem) OnUnmount

func (me *DefaultNodeFileSystem) OnUnmount()

func (*DefaultNodeFileSystem) Root

func (me *DefaultNodeFileSystem) Root() FsNode

func (*DefaultNodeFileSystem) String

func (me *DefaultNodeFileSystem) String() string

type DefaultRawFileSystem

type DefaultRawFileSystem struct{}

DefaultRawFileSystem returns ENOSYS for every operation.

func (*DefaultRawFileSystem) Access

func (me *DefaultRawFileSystem) Access(header *InHeader, input *AccessIn) (code Status)

func (*DefaultRawFileSystem) Bmap

func (me *DefaultRawFileSystem) Bmap(header *InHeader, input *BmapIn) (out *BmapOut, code Status)

func (*DefaultRawFileSystem) Create

func (me *DefaultRawFileSystem) Create(header *InHeader, input *CreateIn, name string) (flags uint32, handle uint64, out *EntryOut, code Status)

func (*DefaultRawFileSystem) Flush

func (me *DefaultRawFileSystem) Flush(header *InHeader, input *FlushIn) Status

func (*DefaultRawFileSystem) Forget

func (me *DefaultRawFileSystem) Forget(h *InHeader, input *ForgetIn)

func (*DefaultRawFileSystem) Fsync

func (me *DefaultRawFileSystem) Fsync(header *InHeader, input *FsyncIn) (code Status)

func (*DefaultRawFileSystem) FsyncDir

func (me *DefaultRawFileSystem) FsyncDir(header *InHeader, input *FsyncIn) (code Status)

func (*DefaultRawFileSystem) GetAttr

func (me *DefaultRawFileSystem) GetAttr(header *InHeader, input *GetAttrIn) (out *AttrOut, code Status)

func (*DefaultRawFileSystem) GetXAttrData

func (me *DefaultRawFileSystem) GetXAttrData(header *InHeader, attr string) (data []byte, code Status)

func (*DefaultRawFileSystem) GetXAttrSize

func (me *DefaultRawFileSystem) GetXAttrSize(header *InHeader, attr string) (size int, code Status)

func (*DefaultRawFileSystem) Init

func (me *DefaultRawFileSystem) Init(init *RawFsInit)

func (*DefaultRawFileSystem) Ioctl

func (me *DefaultRawFileSystem) Ioctl(header *InHeader, input *IoctlIn) (output *IoctlOut, data []byte, code Status)
func (me *DefaultRawFileSystem) Link(header *InHeader, input *LinkIn, name string) (out *EntryOut, code Status)

func (*DefaultRawFileSystem) ListXAttr

func (me *DefaultRawFileSystem) ListXAttr(header *InHeader) (data []byte, code Status)

func (*DefaultRawFileSystem) Lookup

func (me *DefaultRawFileSystem) Lookup(h *InHeader, name string) (out *EntryOut, code Status)

func (*DefaultRawFileSystem) Mkdir

func (me *DefaultRawFileSystem) Mkdir(header *InHeader, input *MkdirIn, name string) (out *EntryOut, code Status)

func (*DefaultRawFileSystem) Mknod

func (me *DefaultRawFileSystem) Mknod(header *InHeader, input *MknodIn, name string) (out *EntryOut, code Status)

func (*DefaultRawFileSystem) Open

func (me *DefaultRawFileSystem) Open(header *InHeader, input *OpenIn) (flags uint32, handle uint64, status Status)

func (*DefaultRawFileSystem) OpenDir

func (me *DefaultRawFileSystem) OpenDir(header *InHeader, input *OpenIn) (flags uint32, handle uint64, status Status)

func (*DefaultRawFileSystem) Poll

func (me *DefaultRawFileSystem) Poll(header *InHeader, input *PollIn) (out *PollOut, code Status)

func (*DefaultRawFileSystem) Read

func (me *DefaultRawFileSystem) Read(header *InHeader, input *ReadIn, bp BufferPool) ([]byte, Status)

func (*DefaultRawFileSystem) ReadDir

func (me *DefaultRawFileSystem) ReadDir(header *InHeader, input *ReadIn) (*DirEntryList, Status)
func (me *DefaultRawFileSystem) Readlink(header *InHeader) (out []byte, code Status)

func (*DefaultRawFileSystem) Release

func (me *DefaultRawFileSystem) Release(header *InHeader, input *ReleaseIn)

func (*DefaultRawFileSystem) ReleaseDir

func (me *DefaultRawFileSystem) ReleaseDir(header *InHeader, input *ReleaseIn)

func (*DefaultRawFileSystem) RemoveXAttr

func (me *DefaultRawFileSystem) RemoveXAttr(header *InHeader, attr string) Status

func (*DefaultRawFileSystem) Rename

func (me *DefaultRawFileSystem) Rename(header *InHeader, input *RenameIn, oldName string, newName string) (code Status)

func (*DefaultRawFileSystem) Rmdir

func (me *DefaultRawFileSystem) Rmdir(header *InHeader, name string) (code Status)

func (*DefaultRawFileSystem) SetAttr

func (me *DefaultRawFileSystem) SetAttr(header *InHeader, input *SetAttrIn) (out *AttrOut, code Status)

func (*DefaultRawFileSystem) SetXAttr

func (me *DefaultRawFileSystem) SetXAttr(header *InHeader, input *SetXAttrIn, attr string, data []byte) Status

func (*DefaultRawFileSystem) StatFs

func (me *DefaultRawFileSystem) StatFs(h *InHeader) *StatfsOut
func (me *DefaultRawFileSystem) Symlink(header *InHeader, pointedTo string, linkName string) (out *EntryOut, code Status)
func (me *DefaultRawFileSystem) Unlink(header *InHeader, name string) (code Status)

func (*DefaultRawFileSystem) Write

func (me *DefaultRawFileSystem) Write(header *InHeader, input *WriteIn, data []byte) (written uint32, code Status)

type DevNullFile

type DevNullFile struct {
	DefaultFile
}

DevNullFile accepts any write, and always returns EOF.

func NewDevNullFile

func NewDevNullFile() *DevNullFile

func (*DevNullFile) Flush

func (me *DevNullFile) Flush() Status

func (*DevNullFile) Fsync

func (me *DevNullFile) Fsync(*FsyncIn) (code Status)

func (*DevNullFile) Read

func (me *DevNullFile) Read(input *ReadIn, bp BufferPool) ([]byte, Status)

func (*DevNullFile) String

func (me *DevNullFile) String() string

func (*DevNullFile) Truncate

func (me *DevNullFile) Truncate(size uint64) (code Status)

func (*DevNullFile) Write

func (me *DevNullFile) Write(input *WriteIn, content []byte) (uint32, Status)

type DirEntry

type DirEntry struct {
	Mode uint32
	Name string
}

For FileSystemConnector. The connector determines inodes.

type DirEntryList

type DirEntryList struct {
	// contains filtered or unexported fields
}

func NewDirEntryList

func NewDirEntryList(max int, off *uint64) *DirEntryList

func (*DirEntryList) Add

func (me *DirEntryList) Add(name []byte, inode uint64, mode uint32) bool

func (*DirEntryList) AddDirEntry

func (me *DirEntryList) AddDirEntry(e DirEntry) bool

func (*DirEntryList) AddString

func (me *DirEntryList) AddString(name string, inode uint64, mode uint32) bool

func (*DirEntryList) Bytes

func (me *DirEntryList) Bytes() []byte

type Dirent

type Dirent struct {
	Ino     uint64
	Off     uint64
	NameLen uint32
	Typ     uint32
}

type EntryOut

type EntryOut struct {
	NodeId         uint64
	Generation     uint64
	EntryValid     uint64
	AttrValid      uint64
	EntryValidNsec uint32
	AttrValidNsec  uint32
	Attr
}

func (*EntryOut) String

func (me *EntryOut) String() string

type File

type File interface {
	// Called upon registering the filehandle in the inode.
	SetInode(*Inode)

	// The String method is for debug printing.
	String() string

	// Wrappers around other File implementations, should return
	// the inner file here.
	InnerFile() File

	Read(*ReadIn, BufferPool) ([]byte, Status)
	Write(*WriteIn, []byte) (written uint32, code Status)
	Flush() Status
	Release()
	Fsync(*FsyncIn) (code Status)

	// The methods below may be called on closed files, due to
	// concurrency.  In that case, you should return EBADF.
	Truncate(size uint64) Status
	GetAttr() (*Attr, Status)
	Chown(uid uint32, gid uint32) Status
	Chmod(perms uint32) Status
	Utimens(atimeNs int64, mtimeNs int64) Status
}

A File object should be returned from FileSystem.Open and FileSystem.Create. Include DefaultFile into the struct to inherit a default null implementation.

TODO - should File be thread safe? TODO - should we pass a *Context argument?

type FileLock

type FileLock struct {
	Start uint64
	End   uint64
	Typ   uint32
	Pid   uint32
}

type FileMode

type FileMode uint32

func (FileMode) IsBlock

func (me FileMode) IsBlock() bool

IsBlock reports whether the FileInfo describes a block special file.

func (FileMode) IsChar

func (me FileMode) IsChar() bool

IsChar reports whether the FileInfo describes a character special file.

func (FileMode) IsDir

func (me FileMode) IsDir() bool

IsDir reports whether the FileInfo describes a directory.

func (FileMode) IsFifo

func (me FileMode) IsFifo() bool

func (FileMode) IsRegular

func (me FileMode) IsRegular() bool

IsRegular reports whether the FileInfo describes a regular file.

func (FileMode) IsSocket

func (me FileMode) IsSocket() bool

IsSocket reports whether the FileInfo describes a socket.

func (me FileMode) IsSymlink() bool

IsSymlink reports whether the FileInfo describes a symbolic link.

func (FileMode) String

func (me FileMode) String() string

type FileSystem

type FileSystem interface {
	// Used for pretty printing.
	String() string

	// Attributes.  This function is the main entry point, through
	// which FUSE discovers which files and directories exist.
	//
	// If the filesystem wants to implement hard-links, it should
	// return consistent non-zero FileInfo.Ino data.  Using
	// hardlinks incurs a performance hit.
	GetAttr(name string, context *Context) (*Attr, Status)

	// These should update the file's ctime too.
	Chmod(name string, mode uint32, context *Context) (code Status)
	Chown(name string, uid uint32, gid uint32, context *Context) (code Status)
	Utimens(name string, AtimeNs int64, MtimeNs int64, context *Context) (code Status)

	Truncate(name string, size uint64, context *Context) (code Status)

	Access(name string, mode uint32, context *Context) (code Status)

	// Tree structure
	Link(oldName string, newName string, context *Context) (code Status)
	Mkdir(name string, mode uint32, context *Context) Status
	Mknod(name string, mode uint32, dev uint32, context *Context) Status
	Rename(oldName string, newName string, context *Context) (code Status)
	Rmdir(name string, context *Context) (code Status)
	Unlink(name string, context *Context) (code Status)

	// Extended attributes.
	GetXAttr(name string, attribute string, context *Context) (data []byte, code Status)
	ListXAttr(name string, context *Context) (attributes []string, code Status)
	RemoveXAttr(name string, attr string, context *Context) Status
	SetXAttr(name string, attr string, data []byte, flags int, context *Context) Status

	// Called after mount.
	OnMount(nodeFs *PathNodeFs)
	OnUnmount()

	// File handling.  If opening for writing, the file's mtime
	// should be updated too.
	Open(name string, flags uint32, context *Context) (file File, code Status)
	Create(name string, flags uint32, mode uint32, context *Context) (file File, code Status)

	// Directory handling
	OpenDir(name string, context *Context) (stream chan DirEntry, code Status)

	// Symlinks.
	Symlink(value string, linkName string, context *Context) (code Status)
	Readlink(name string, context *Context) (string, Status)

	StatFs(name string) *StatfsOut
}

A filesystem API that uses paths rather than inodes. A minimal file system should have at least a functional GetAttr method. Typically, each call happens in its own goroutine, so take care to make the file system thread-safe.

Include DefaultFileSystem to provide a default null implementation of required methods.

type FileSystemConnector

type FileSystemConnector struct {
	DefaultRawFileSystem

	Debug bool
	// contains filtered or unexported fields
}

FilesystemConnector is a raw FUSE filesystem that manages in-process mounts and inodes. Its job is twofold:

* It translates between the raw kernel interface (padded structs of int32 and int64) and the more abstract Go-ish NodeFileSystem interface.

* It manages mounting and unmounting of NodeFileSystems into the directory hierarchy

To achieve this, the connector only needs a pointer to the root node.

func NewFileSystemConnector

func NewFileSystemConnector(nodeFs NodeFileSystem, opts *FileSystemOptions) (me *FileSystemConnector)

func (*FileSystemConnector) Access

func (me *FileSystemConnector) Access(header *InHeader, input *AccessIn) (code Status)

func (*FileSystemConnector) Create

func (me *FileSystemConnector) Create(header *InHeader, input *CreateIn, name string) (flags uint32, h uint64, out *EntryOut, code Status)

func (*FileSystemConnector) EntryNotify

func (me *FileSystemConnector) EntryNotify(dir *Inode, name string) Status

func (*FileSystemConnector) FileNotify

func (me *FileSystemConnector) FileNotify(node *Inode, off int64, length int64) Status

func (*FileSystemConnector) Flush

func (me *FileSystemConnector) Flush(header *InHeader, input *FlushIn) Status

func (*FileSystemConnector) Forget

func (me *FileSystemConnector) Forget(h *InHeader, input *ForgetIn)

func (*FileSystemConnector) GetAttr

func (me *FileSystemConnector) GetAttr(header *InHeader, input *GetAttrIn) (out *AttrOut, code Status)

func (*FileSystemConnector) GetXAttrData

func (me *FileSystemConnector) GetXAttrData(header *InHeader, attribute string) (data []byte, code Status)

func (*FileSystemConnector) GetXAttrSize

func (me *FileSystemConnector) GetXAttrSize(header *InHeader, attribute string) (sz int, code Status)

func (*FileSystemConnector) Init

func (me *FileSystemConnector) Init(fsInit *RawFsInit)
func (me *FileSystemConnector) Link(header *InHeader, input *LinkIn, name string) (out *EntryOut, code Status)

func (*FileSystemConnector) ListXAttr

func (me *FileSystemConnector) ListXAttr(header *InHeader) (data []byte, code Status)

func (*FileSystemConnector) Lookup

func (me *FileSystemConnector) Lookup(header *InHeader, name string) (out *EntryOut, code Status)

func (*FileSystemConnector) LookupNode

func (me *FileSystemConnector) LookupNode(parent *Inode, path string) *Inode

func (*FileSystemConnector) Mkdir

func (me *FileSystemConnector) Mkdir(header *InHeader, input *MkdirIn, name string) (out *EntryOut, code Status)

func (*FileSystemConnector) Mknod

func (me *FileSystemConnector) Mknod(header *InHeader, input *MknodIn, name string) (out *EntryOut, code Status)

func (*FileSystemConnector) Mount

func (me *FileSystemConnector) Mount(parent *Inode, name string, nodeFs NodeFileSystem, opts *FileSystemOptions) Status

Mount() generates a synthetic directory node, and mounts the file system there. If opts is nil, the mount options of the root file system are inherited. The encompassing filesystem should pretend the mount point does not exist. If it does, it will generate an Inode with the same, which will cause Mount() to return EBUSY.

Return values:

ENOENT: the directory containing the mount point does not exist.

EBUSY: the intended mount point already exists.

func (*FileSystemConnector) MountRoot

func (me *FileSystemConnector) MountRoot(nodeFs NodeFileSystem, opts *FileSystemOptions)

func (*FileSystemConnector) Node

func (me *FileSystemConnector) Node(parent *Inode, fullPath string) (*Inode, []string)

Finds a node within the currently known inodes, returns the last known node and the remaining unknown path components. If parent is nil, start from FUSE mountpoint.

func (*FileSystemConnector) Open

func (me *FileSystemConnector) Open(header *InHeader, input *OpenIn) (flags uint32, handle uint64, status Status)

func (*FileSystemConnector) OpenDir

func (me *FileSystemConnector) OpenDir(header *InHeader, input *OpenIn) (flags uint32, handle uint64, code Status)

func (*FileSystemConnector) Read

func (me *FileSystemConnector) Read(header *InHeader, input *ReadIn, bp BufferPool) ([]byte, Status)

func (*FileSystemConnector) ReadDir

func (me *FileSystemConnector) ReadDir(header *InHeader, input *ReadIn) (*DirEntryList, Status)
func (me *FileSystemConnector) Readlink(header *InHeader) (out []byte, code Status)

func (*FileSystemConnector) Release

func (me *FileSystemConnector) Release(header *InHeader, input *ReleaseIn)

func (*FileSystemConnector) ReleaseDir

func (me *FileSystemConnector) ReleaseDir(header *InHeader, input *ReleaseIn)

func (*FileSystemConnector) RemoveXAttr

func (me *FileSystemConnector) RemoveXAttr(header *InHeader, attr string) Status

func (*FileSystemConnector) Rename

func (me *FileSystemConnector) Rename(header *InHeader, input *RenameIn, oldName string, newName string) (code Status)

func (*FileSystemConnector) Rmdir

func (me *FileSystemConnector) Rmdir(header *InHeader, name string) (code Status)

func (*FileSystemConnector) SetAttr

func (me *FileSystemConnector) SetAttr(header *InHeader, input *SetAttrIn) (out *AttrOut, code Status)

func (*FileSystemConnector) SetXAttr

func (me *FileSystemConnector) SetXAttr(header *InHeader, input *SetXAttrIn, attr string, data []byte) Status

func (*FileSystemConnector) StatFs

func (me *FileSystemConnector) StatFs(header *InHeader) *StatfsOut
func (me *FileSystemConnector) Symlink(header *InHeader, pointedTo string, linkName string) (out *EntryOut, code Status)
func (me *FileSystemConnector) Unlink(header *InHeader, name string) (code Status)

func (*FileSystemConnector) Unmount

func (me *FileSystemConnector) Unmount(node *Inode) Status

Unmount() tries to unmount the given inode.

Returns the following error codes:

EINVAL: path does not exist, or is not a mount point.

EBUSY: there are open files, or submounts below this node.

func (*FileSystemConnector) Write

func (me *FileSystemConnector) Write(header *InHeader, input *WriteIn, data []byte) (written uint32, code Status)

type FileSystemOptions

type FileSystemOptions struct {
	EntryTimeout    time.Duration
	AttrTimeout     time.Duration
	NegativeTimeout time.Duration

	// If set, replace all uids with given UID.
	// NewFileSystemOptions() will set this to the daemon's
	// uid/gid.
	*Owner

	// If set, use a more portable, but slower inode number
	// generation scheme.  This will make inode numbers (exported
	// back to callers) stay within int32, which is necessary for
	// making stat() succeed in 32-bit programs.
	PortableInodes bool
}

MountOptions contains time out options for a (Node)FileSystem. The default copied from libfuse and set in NewMountOptions() is (1s,1s,0s).

func NewFileSystemOptions

func NewFileSystemOptions() *FileSystemOptions

type FlushIn

type FlushIn struct {
	Fh        uint64
	Unused    uint32
	Padding   uint32
	LockOwner uint64
}

func (*FlushIn) String

func (me *FlushIn) String() string

type ForgetIn

type ForgetIn struct {
	Nlookup uint64
}

type FsNode

type FsNode interface {
	// The following are called by the FileSystemConnector
	Inode() *Inode
	SetInode(node *Inode)

	Lookup(name string, context *Context) (fi *Attr, node FsNode, code Status)

	// Deletable() should return true if this inode may be
	// discarded from the children list. This will be called from
	// within the treeLock critical section, so you cannot look at
	// other inodes.
	Deletable() bool

	// OnForget is called when the reference to this inode is
	// dropped from the tree.
	OnForget()

	// Misc.
	Access(mode uint32, context *Context) (code Status)
	Readlink(c *Context) ([]byte, Status)

	// Namespace operations
	Mknod(name string, mode uint32, dev uint32, context *Context) (fi *Attr, newNode FsNode, code Status)
	Mkdir(name string, mode uint32, context *Context) (fi *Attr, newNode FsNode, code Status)
	Unlink(name string, context *Context) (code Status)
	Rmdir(name string, context *Context) (code Status)
	Symlink(name string, content string, context *Context) (fi *Attr, newNode FsNode, code Status)
	Rename(oldName string, newParent FsNode, newName string, context *Context) (code Status)
	Link(name string, existing FsNode, context *Context) (fi *Attr, newNode FsNode, code Status)

	// Files
	Create(name string, flags uint32, mode uint32, context *Context) (file File, fi *Attr, newNode FsNode, code Status)
	Open(flags uint32, context *Context) (file File, code Status)
	OpenDir(context *Context) (chan DirEntry, Status)

	// XAttrs
	GetXAttr(attribute string, context *Context) (data []byte, code Status)
	RemoveXAttr(attr string, context *Context) Status
	SetXAttr(attr string, data []byte, flags int, context *Context) Status
	ListXAttr(context *Context) (attrs []string, code Status)

	// Attributes
	GetAttr(file File, context *Context) (fi *Attr, code Status)
	Chmod(file File, perms uint32, context *Context) (code Status)
	Chown(file File, uid uint32, gid uint32, context *Context) (code Status)
	Truncate(file File, size uint64, context *Context) (code Status)
	Utimens(file File, atime int64, mtime int64, context *Context) (code Status)

	StatFs() *StatfsOut
}

type FsyncIn

type FsyncIn struct {
	Fh         uint64
	FsyncFlags uint32
	Padding    uint32
}

type GcBufferPool

type GcBufferPool struct {
}

func NewGcBufferPool

func NewGcBufferPool() *GcBufferPool

NewGcBufferPool is just a fallback to the standard allocation routines.

func (*GcBufferPool) AllocBuffer

func (me *GcBufferPool) AllocBuffer(size uint32) []byte

func (*GcBufferPool) FreeBuffer

func (me *GcBufferPool) FreeBuffer(slice []byte)

type GetAttrIn

type GetAttrIn struct {
	Flags uint32
	Dummy uint32
	Fh    uint64
}

func (*GetAttrIn) String

func (me *GetAttrIn) String() string

type GetXAttrIn

type GetXAttrIn struct {
	Size    uint32
	Padding uint32
}

type GetXAttrOut

type GetXAttrOut struct {
	Size    uint32
	Padding uint32
}

type HandleMap

type HandleMap interface {
	Register(obj *Handled, asInt interface{}) uint64
	Count() int
	Decode(uint64) *Handled
	Forget(uint64) *Handled
	Has(uint64) bool
}

HandleMap translates objects in Go space to 64-bit handles that can be given out to -say- the linux kernel. It uses the free bits on x64_64 (16+3) to do an extra sanity check on the data. (Thanks to Russ Cox for this suggestion). In addition, it stores the object in a map, so the Go runtime will not garbage collect it.

The 32 bits version of this is a threadsafe wrapper around a map.

To use it, include Handled as first member of the structure you wish to export.

This structure is thread-safe.

func NewHandleMap

func NewHandleMap(portable bool) (hm HandleMap)

NewHandleMap creates a new HandleMap. If verify is given, we use remaining bits in the handle to store sanity check bits.

type Handled

type Handled struct {
	// contains filtered or unexported fields
}

type InHeader

type InHeader struct {
	Length uint32

	Unique uint64
	NodeId uint64
	Context
	Padding uint32
	// contains filtered or unexported fields
}

func (InHeader) String

func (op InHeader) String() string

type InitIn

type InitIn struct {
	Major        uint32
	Minor        uint32
	MaxReadAhead uint32
	Flags        uint32
}

func (*InitIn) String

func (me *InitIn) String() string

type InitOut

type InitOut struct {
	Major               uint32
	Minor               uint32
	MaxReadAhead        uint32
	Flags               uint32
	MaxBackground       uint16
	CongestionThreshold uint16
	MaxWrite            uint32
}

func (*InitOut) String

func (me *InitOut) String() string

type Inode

type Inode struct {
	// contains filtered or unexported fields
}

The inode reflects the kernel's idea of the inode. Inodes may be created automatically when the kernel does lookups inode, or by explicitly by calling Inode.CreateChild().

func (*Inode) AddChild

func (me *Inode) AddChild(name string, child *Inode)

func (*Inode) AnyFile

func (me *Inode) AnyFile() (file File)

Returns any open file, preferably a r/w one.

func (*Inode) Children

func (me *Inode) Children() (out map[string]*Inode)

func (*Inode) Files

func (me *Inode) Files(mask uint32) (files []WithFlags)

Files() returns an opens file that have bits in common with the give mask. Use mask==0 to return all files.

func (*Inode) FsChildren

func (me *Inode) FsChildren() (out map[string]*Inode)

FsChildren returns all the children from the same filesystem. It will skip mountpoints.

func (*Inode) FsNode

func (me *Inode) FsNode() FsNode

func (*Inode) GetChild

func (me *Inode) GetChild(name string) (child *Inode)

func (*Inode) IsDir

func (me *Inode) IsDir() bool

func (*Inode) New

func (me *Inode) New(isDir bool, fsi FsNode) *Inode

func (*Inode) RmChild

func (me *Inode) RmChild(name string) (ch *Inode)

type InterruptIn

type InterruptIn struct {
	Unique uint64
}

type IoctlIn

type IoctlIn struct {
	Fh      uint64
	Flags   uint32
	Cmd     uint32
	Arg     uint64
	InSize  uint32
	OutSize uint32
}

type IoctlOut

type IoctlOut struct {
	Result  int32
	Flags   uint32
	InIovs  uint32
	OutIovs uint32
}

type Kstatfs

type Kstatfs struct {
	Blocks  uint64
	Bfree   uint64
	Bavail  uint64
	Files   uint64
	Ffree   uint64
	Bsize   uint32
	NameLen uint32
	Frsize  uint32
	Padding uint32
	Spare   [6]uint32
}

func (*Kstatfs) String

func (me *Kstatfs) String() string

type LatencyArg

type LatencyArg struct {
	Name string
	Arg  string
	DtNs int64
}

type LatencyMap

type LatencyMap struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewLatencyMap

func NewLatencyMap() *LatencyMap

func (*LatencyMap) Add

func (me *LatencyMap) Add(name string, arg string, dtNs int64)

func (*LatencyMap) AddMany

func (me *LatencyMap) AddMany(args []LatencyArg)

func (*LatencyMap) Counts

func (me *LatencyMap) Counts() map[string]int

func (*LatencyMap) Latencies

func (me *LatencyMap) Latencies(unit float64) map[string]float64

Latencies returns a map. Use 1e-3 for unit to get ms results.

func (*LatencyMap) TopArgs

func (me *LatencyMap) TopArgs(name string) []string

type LinkIn

type LinkIn struct {
	Oldnodeid uint64
}

type LkIn

type LkIn struct {
	Fh      uint64
	Owner   uint64
	Lk      FileLock
	LkFlags uint32
	Padding uint32
}

type LkOut

type LkOut struct {
	Lk FileLock
}

type LockingFileSystem

type LockingFileSystem struct {
	// Should be public so people reusing can access the wrapped
	// FS.
	FileSystem
	// contains filtered or unexported fields
}

This is a wrapper that makes a FileSystem threadsafe by trivially locking all operations. For improved performance, you should probably invent do your own locking inside the file system.

func NewLockingFileSystem

func NewLockingFileSystem(pfs FileSystem) *LockingFileSystem

func (*LockingFileSystem) Access

func (me *LockingFileSystem) Access(name string, mode uint32, context *Context) (code Status)

func (*LockingFileSystem) Chmod

func (me *LockingFileSystem) Chmod(name string, mode uint32, context *Context) (code Status)

func (*LockingFileSystem) Chown

func (me *LockingFileSystem) Chown(name string, uid uint32, gid uint32, context *Context) (code Status)

func (*LockingFileSystem) Create

func (me *LockingFileSystem) Create(name string, flags uint32, mode uint32, context *Context) (file File, code Status)

func (*LockingFileSystem) GetAttr

func (me *LockingFileSystem) GetAttr(name string, context *Context) (*Attr, Status)

func (*LockingFileSystem) GetXAttr

func (me *LockingFileSystem) GetXAttr(name string, attr string, context *Context) ([]byte, Status)
func (me *LockingFileSystem) Link(oldName string, newName string, context *Context) (code Status)

func (*LockingFileSystem) ListXAttr

func (me *LockingFileSystem) ListXAttr(name string, context *Context) ([]string, Status)

func (*LockingFileSystem) Mkdir

func (me *LockingFileSystem) Mkdir(name string, mode uint32, context *Context) Status

func (*LockingFileSystem) Mknod

func (me *LockingFileSystem) Mknod(name string, mode uint32, dev uint32, context *Context) Status

func (*LockingFileSystem) OnMount

func (me *LockingFileSystem) OnMount(nodeFs *PathNodeFs)

func (*LockingFileSystem) OnUnmount

func (me *LockingFileSystem) OnUnmount()

func (*LockingFileSystem) Open

func (me *LockingFileSystem) Open(name string, flags uint32, context *Context) (file File, code Status)

func (*LockingFileSystem) OpenDir

func (me *LockingFileSystem) OpenDir(name string, context *Context) (stream chan DirEntry, status Status)
func (me *LockingFileSystem) Readlink(name string, context *Context) (string, Status)

func (*LockingFileSystem) RemoveXAttr

func (me *LockingFileSystem) RemoveXAttr(name string, attr string, context *Context) Status

func (*LockingFileSystem) Rename

func (me *LockingFileSystem) Rename(oldName string, newName string, context *Context) (code Status)

func (*LockingFileSystem) Rmdir

func (me *LockingFileSystem) Rmdir(name string, context *Context) (code Status)

func (*LockingFileSystem) SetXAttr

func (me *LockingFileSystem) SetXAttr(name string, attr string, data []byte, flags int, context *Context) Status
func (me *LockingFileSystem) Symlink(value string, linkName string, context *Context) (code Status)

func (*LockingFileSystem) Truncate

func (me *LockingFileSystem) Truncate(name string, offset uint64, context *Context) (code Status)
func (me *LockingFileSystem) Unlink(name string, context *Context) (code Status)

func (*LockingFileSystem) Utimens

func (me *LockingFileSystem) Utimens(name string, AtimeNs int64, CtimeNs int64, context *Context) (code Status)

type LockingRawFileSystem

type LockingRawFileSystem struct {
	RawFileSystem
	// contains filtered or unexported fields
}

func NewLockingRawFileSystem

func NewLockingRawFileSystem(rfs RawFileSystem) *LockingRawFileSystem

func (*LockingRawFileSystem) Access

func (me *LockingRawFileSystem) Access(header *InHeader, input *AccessIn) (code Status)

func (*LockingRawFileSystem) Create

func (me *LockingRawFileSystem) Create(header *InHeader, input *CreateIn, name string) (flags uint32, handle uint64, out *EntryOut, code Status)

func (*LockingRawFileSystem) Flush

func (me *LockingRawFileSystem) Flush(header *InHeader, input *FlushIn) Status

func (*LockingRawFileSystem) Forget

func (me *LockingRawFileSystem) Forget(h *InHeader, input *ForgetIn)

func (*LockingRawFileSystem) Fsync

func (me *LockingRawFileSystem) Fsync(header *InHeader, input *FsyncIn) (code Status)

func (*LockingRawFileSystem) FsyncDir

func (me *LockingRawFileSystem) FsyncDir(header *InHeader, input *FsyncIn) (code Status)

func (*LockingRawFileSystem) GetAttr

func (me *LockingRawFileSystem) GetAttr(header *InHeader, input *GetAttrIn) (out *AttrOut, code Status)

func (*LockingRawFileSystem) GetXAttrData

func (me *LockingRawFileSystem) GetXAttrData(header *InHeader, attr string) (data []byte, code Status)

func (*LockingRawFileSystem) GetXAttrSize

func (me *LockingRawFileSystem) GetXAttrSize(header *InHeader, attr string) (sz int, code Status)
func (me *LockingRawFileSystem) Link(header *InHeader, input *LinkIn, name string) (out *EntryOut, code Status)

func (*LockingRawFileSystem) ListXAttr

func (me *LockingRawFileSystem) ListXAttr(header *InHeader) (data []byte, code Status)

func (*LockingRawFileSystem) Lookup

func (me *LockingRawFileSystem) Lookup(h *InHeader, name string) (out *EntryOut, code Status)

func (*LockingRawFileSystem) Mkdir

func (me *LockingRawFileSystem) Mkdir(header *InHeader, input *MkdirIn, name string) (out *EntryOut, code Status)

func (*LockingRawFileSystem) Mknod

func (me *LockingRawFileSystem) Mknod(header *InHeader, input *MknodIn, name string) (out *EntryOut, code Status)

func (*LockingRawFileSystem) Open

func (me *LockingRawFileSystem) Open(header *InHeader, input *OpenIn) (flags uint32, handle uint64, status Status)

func (*LockingRawFileSystem) OpenDir

func (me *LockingRawFileSystem) OpenDir(header *InHeader, input *OpenIn) (flags uint32, h uint64, status Status)

func (*LockingRawFileSystem) Read

func (me *LockingRawFileSystem) Read(header *InHeader, input *ReadIn, bp BufferPool) ([]byte, Status)

func (*LockingRawFileSystem) ReadDir

func (me *LockingRawFileSystem) ReadDir(header *InHeader, input *ReadIn) (*DirEntryList, Status)
func (me *LockingRawFileSystem) Readlink(header *InHeader) (out []byte, code Status)

func (*LockingRawFileSystem) Release

func (me *LockingRawFileSystem) Release(header *InHeader, input *ReleaseIn)

func (*LockingRawFileSystem) ReleaseDir

func (me *LockingRawFileSystem) ReleaseDir(header *InHeader, h *ReleaseIn)

func (*LockingRawFileSystem) RemoveXAttr

func (me *LockingRawFileSystem) RemoveXAttr(header *InHeader, attr string) Status

func (*LockingRawFileSystem) Rename

func (me *LockingRawFileSystem) Rename(header *InHeader, input *RenameIn, oldName string, newName string) (code Status)

func (*LockingRawFileSystem) Rmdir

func (me *LockingRawFileSystem) Rmdir(header *InHeader, name string) (code Status)

func (*LockingRawFileSystem) SetAttr

func (me *LockingRawFileSystem) SetAttr(header *InHeader, input *SetAttrIn) (out *AttrOut, code Status)

func (*LockingRawFileSystem) SetXAttr

func (me *LockingRawFileSystem) SetXAttr(header *InHeader, input *SetXAttrIn, attr string, data []byte) Status
func (me *LockingRawFileSystem) Symlink(header *InHeader, pointedTo string, linkName string) (out *EntryOut, code Status)
func (me *LockingRawFileSystem) Unlink(header *InHeader, name string) (code Status)

func (*LockingRawFileSystem) Write

func (me *LockingRawFileSystem) Write(header *InHeader, input *WriteIn, data []byte) (written uint32, code Status)

type LoopbackFile

type LoopbackFile struct {
	File *os.File

	DefaultFile
}

LoopbackFile delegates all operations back to an underlying os.File.

func (*LoopbackFile) Chmod

func (me *LoopbackFile) Chmod(mode uint32) Status

func (*LoopbackFile) Chown

func (me *LoopbackFile) Chown(uid uint32, gid uint32) Status

func (*LoopbackFile) Fsync

func (me *LoopbackFile) Fsync(*FsyncIn) (code Status)

func (*LoopbackFile) GetAttr

func (me *LoopbackFile) GetAttr() (*Attr, Status)

func (*LoopbackFile) Read

func (me *LoopbackFile) Read(input *ReadIn, buffers BufferPool) ([]byte, Status)

func (*LoopbackFile) Release

func (me *LoopbackFile) Release()

func (*LoopbackFile) String

func (me *LoopbackFile) String() string

func (*LoopbackFile) Truncate

func (me *LoopbackFile) Truncate(size uint64) Status

func (*LoopbackFile) Write

func (me *LoopbackFile) Write(input *WriteIn, data []byte) (uint32, Status)

type LoopbackFileSystem

type LoopbackFileSystem struct {
	Root string

	DefaultFileSystem
}

func NewLoopbackFileSystem

func NewLoopbackFileSystem(root string) (out *LoopbackFileSystem)

func (*LoopbackFileSystem) Access

func (me *LoopbackFileSystem) Access(name string, mode uint32, context *Context) (code Status)

func (*LoopbackFileSystem) Chmod

func (me *LoopbackFileSystem) Chmod(path string, mode uint32, context *Context) (code Status)

func (*LoopbackFileSystem) Chown

func (me *LoopbackFileSystem) Chown(path string, uid uint32, gid uint32, context *Context) (code Status)

func (*LoopbackFileSystem) Create

func (me *LoopbackFileSystem) Create(path string, flags uint32, mode uint32, context *Context) (fuseFile File, code Status)

func (*LoopbackFileSystem) GetAttr

func (me *LoopbackFileSystem) GetAttr(name string, context *Context) (a *Attr, code Status)

func (*LoopbackFileSystem) GetPath

func (me *LoopbackFileSystem) GetPath(relPath string) string

func (*LoopbackFileSystem) GetXAttr

func (me *LoopbackFileSystem) GetXAttr(name string, attr string, context *Context) ([]byte, Status)
func (me *LoopbackFileSystem) Link(orig string, newName string, context *Context) (code Status)

func (*LoopbackFileSystem) ListXAttr

func (me *LoopbackFileSystem) ListXAttr(name string, context *Context) ([]string, Status)

func (*LoopbackFileSystem) Mkdir

func (me *LoopbackFileSystem) Mkdir(path string, mode uint32, context *Context) (code Status)

func (*LoopbackFileSystem) Mknod

func (me *LoopbackFileSystem) Mknod(name string, mode uint32, dev uint32, context *Context) (code Status)

func (*LoopbackFileSystem) Open

func (me *LoopbackFileSystem) Open(name string, flags uint32, context *Context) (fuseFile File, status Status)

func (*LoopbackFileSystem) OpenDir

func (me *LoopbackFileSystem) OpenDir(name string, context *Context) (stream chan DirEntry, status Status)
func (me *LoopbackFileSystem) Readlink(name string, context *Context) (out string, code Status)

func (*LoopbackFileSystem) RemoveXAttr

func (me *LoopbackFileSystem) RemoveXAttr(name string, attr string, context *Context) Status

func (*LoopbackFileSystem) Rename

func (me *LoopbackFileSystem) Rename(oldPath string, newPath string, context *Context) (code Status)

func (*LoopbackFileSystem) Rmdir

func (me *LoopbackFileSystem) Rmdir(name string, context *Context) (code Status)

func (*LoopbackFileSystem) StatFs

func (me *LoopbackFileSystem) StatFs(name string) *StatfsOut

func (*LoopbackFileSystem) String

func (me *LoopbackFileSystem) String() string
func (me *LoopbackFileSystem) Symlink(pointedTo string, linkName string, context *Context) (code Status)

func (*LoopbackFileSystem) Truncate

func (me *LoopbackFileSystem) Truncate(path string, offset uint64, context *Context) (code Status)
func (me *LoopbackFileSystem) Unlink(name string, context *Context) (code Status)

Don't use os.Remove, it removes twice (unlink followed by rmdir).

func (*LoopbackFileSystem) Utimens

func (me *LoopbackFileSystem) Utimens(path string, AtimeNs int64, MtimeNs int64, context *Context) (code Status)

type MemNodeFs

type MemNodeFs struct {
	DefaultNodeFileSystem
	// contains filtered or unexported fields
}

func NewMemNodeFs

func NewMemNodeFs(prefix string) *MemNodeFs

func (*MemNodeFs) Filename

func (me *MemNodeFs) Filename(n *Inode) string

func (*MemNodeFs) Root

func (me *MemNodeFs) Root() FsNode

func (*MemNodeFs) String

func (me *MemNodeFs) String() string

type MkdirIn

type MkdirIn struct {
	Mode  uint32
	Umask uint32
}

func (*MkdirIn) String

func (me *MkdirIn) String() string

type MknodIn

type MknodIn struct {
	Mode    uint32
	Rdev    uint32
	Umask   uint32
	Padding uint32
}

func (*MknodIn) String

func (me *MknodIn) String() string

type MountOptions

type MountOptions struct {
	AllowOther bool

	// Options are passed as -o string to fusermount.
	Options []string

	// Default is _DEFAULT_BACKGROUND_TASKS, 12.  This numbers
	// controls the allowed number of requests that relate to
	// async I/O.  Concurrency for synchronous I/O is not limited.
	MaxBackground int

	// Write size to use.  If 0, use default. This number is
	// capped at the kernel maximum.
	MaxWrite int
}

type MountState

type MountState struct {

	// Dump debug info onto stdout.
	Debug bool
	// contains filtered or unexported fields
}

MountState contains the logic for reading from the FUSE device and translating it to RawFileSystem interface calls.

func NewMountState

func NewMountState(fs RawFileSystem) *MountState

func (*MountState) BufferPoolStats

func (me *MountState) BufferPoolStats() string

func (*MountState) KernelSettings

func (me *MountState) KernelSettings() InitIn

func (*MountState) Latencies

func (me *MountState) Latencies() map[string]float64

func (*MountState) Loop

func (me *MountState) Loop()

Loop initiates the FUSE loop. Normally, callers should run Loop() and wait for it to exit, but tests will want to run this in a goroutine.

Each filesystem operation executes in a separate goroutine.

func (*MountState) Mount

func (me *MountState) Mount(mountPoint string, opts *MountOptions) error

Mount filesystem on mountPoint.

func (*MountState) MountPoint

func (me *MountState) MountPoint() string

func (*MountState) OperationCounts

func (me *MountState) OperationCounts() map[string]int

func (*MountState) SetRecordStatistics

func (me *MountState) SetRecordStatistics(record bool)

func (*MountState) Unmount

func (me *MountState) Unmount() (err error)

type NodeFileSystem

type NodeFileSystem interface {
	OnUnmount()
	OnMount(conn *FileSystemConnector)
	Root() FsNode

	// Used for debug outputs
	String() string
}

NodeFileSystem is a high level API that resembles the kernel's idea of what an FS looks like. NodeFileSystems can have multiple hard-links to one file, for example. It is also suited if the data to represent fits in memory: you can construct FsNode at mount time, and the filesystem will be ready.

type NotifyCode

type NotifyCode int

type NotifyInvalEntryOut

type NotifyInvalEntryOut struct {
	Parent  uint64
	NameLen uint32
	Padding uint32
}

type NotifyInvalInodeOut

type NotifyInvalInodeOut struct {
	Ino    uint64
	Off    int64
	Length int64
}

type NotifyPollWakeupOut

type NotifyPollWakeupOut struct {
	Kh uint64
}

type OpenIn

type OpenIn struct {
	Flags  uint32
	Unused uint32
}

func (*OpenIn) String

func (me *OpenIn) String() string

type OpenOut

type OpenOut struct {
	Fh        uint64
	OpenFlags uint32
	Padding   uint32
}

func (*OpenOut) String

func (me *OpenOut) String() string

type OutHeader

type OutHeader struct {
	Length uint32
	Status Status
	Unique uint64
}

type Owner

type Owner struct {
	Uid uint32
	Gid uint32
}

func CurrentOwner

func CurrentOwner() *Owner

type PathNodeFs

type PathNodeFs struct {
	Debug bool
	// contains filtered or unexported fields
}

PathNodeFs is the file system that can translate an inode back to a path. The path name is then used to call into an object that has the FileSystem interface.

Lookups (ie. FileSystem.GetAttr) may return a inode number in its return value. The inode number ("clientInode") is used to indicate linked files. The clientInode is never exported back to the kernel; it is only used to maintain a list of all names of an inode.

func NewPathNodeFs

func NewPathNodeFs(fs FileSystem, opts *PathNodeFsOptions) *PathNodeFs

func (*PathNodeFs) AllFiles

func (me *PathNodeFs) AllFiles(name string, mask uint32) []WithFlags

func (*PathNodeFs) EntryNotify

func (me *PathNodeFs) EntryNotify(dir string, name string) Status

func (*PathNodeFs) FileNotify

func (me *PathNodeFs) FileNotify(path string, off int64, length int64) Status

func (*PathNodeFs) ForgetClientInodes

func (me *PathNodeFs) ForgetClientInodes()

Forgets all known information on client inodes.

func (*PathNodeFs) LastNode

func (me *PathNodeFs) LastNode(name string) (*Inode, []string)

func (*PathNodeFs) LookupNode

func (me *PathNodeFs) LookupNode(name string) *Inode

Like node, but use Lookup to discover inodes we may not have yet.

func (*PathNodeFs) Mount

func (me *PathNodeFs) Mount(path string, nodeFs NodeFileSystem, opts *FileSystemOptions) Status

func (*PathNodeFs) Node

func (me *PathNodeFs) Node(name string) *Inode

func (*PathNodeFs) Notify

func (me *PathNodeFs) Notify(path string) Status

func (*PathNodeFs) OnMount

func (me *PathNodeFs) OnMount(conn *FileSystemConnector)

func (*PathNodeFs) OnUnmount

func (me *PathNodeFs) OnUnmount()

func (*PathNodeFs) Path

func (me *PathNodeFs) Path(node *Inode) string

func (*PathNodeFs) RereadClientInodes

func (me *PathNodeFs) RereadClientInodes()

Rereads all inode numbers for all known files.

func (*PathNodeFs) Root

func (me *PathNodeFs) Root() FsNode

func (*PathNodeFs) String

func (me *PathNodeFs) String() string

func (*PathNodeFs) Unmount

func (me *PathNodeFs) Unmount(path string) Status

func (*PathNodeFs) UnmountNode

func (me *PathNodeFs) UnmountNode(node *Inode) Status

type PathNodeFsOptions

type PathNodeFsOptions struct {
	// If ClientInodes is set, use Inode returned from GetAttr to
	// find hard-linked files.
	ClientInodes bool
}

type PollIn

type PollIn struct {
	Fh      uint64
	Kh      uint64
	Flags   uint32
	Padding uint32
}

type PollOut

type PollOut struct {
	Revents uint32
	Padding uint32
}

type PrefixFileSystem

type PrefixFileSystem struct {
	FileSystem
	Prefix string
}

PrefixFileSystem adds a path prefix to incoming calls.

func (*PrefixFileSystem) Access

func (me *PrefixFileSystem) Access(name string, mode uint32, context *Context) (code Status)

func (*PrefixFileSystem) Chmod

func (me *PrefixFileSystem) Chmod(name string, mode uint32, context *Context) (code Status)

func (*PrefixFileSystem) Chown

func (me *PrefixFileSystem) Chown(name string, uid uint32, gid uint32, context *Context) (code Status)

func (*PrefixFileSystem) Create

func (me *PrefixFileSystem) Create(name string, flags uint32, mode uint32, context *Context) (file File, code Status)

func (*PrefixFileSystem) GetAttr

func (me *PrefixFileSystem) GetAttr(name string, context *Context) (*Attr, Status)

func (*PrefixFileSystem) GetXAttr

func (me *PrefixFileSystem) GetXAttr(name string, attr string, context *Context) ([]byte, Status)
func (me *PrefixFileSystem) Link(oldName string, newName string, context *Context) (code Status)

func (*PrefixFileSystem) ListXAttr

func (me *PrefixFileSystem) ListXAttr(name string, context *Context) ([]string, Status)

func (*PrefixFileSystem) Mkdir

func (me *PrefixFileSystem) Mkdir(name string, mode uint32, context *Context) Status

func (*PrefixFileSystem) Mknod

func (me *PrefixFileSystem) Mknod(name string, mode uint32, dev uint32, context *Context) Status

func (*PrefixFileSystem) OnMount

func (me *PrefixFileSystem) OnMount(nodeFs *PathNodeFs)

func (*PrefixFileSystem) OnUnmount

func (me *PrefixFileSystem) OnUnmount()

func (*PrefixFileSystem) Open

func (me *PrefixFileSystem) Open(name string, flags uint32, context *Context) (file File, code Status)

func (*PrefixFileSystem) OpenDir

func (me *PrefixFileSystem) OpenDir(name string, context *Context) (stream chan DirEntry, status Status)
func (me *PrefixFileSystem) Readlink(name string, context *Context) (string, Status)

func (*PrefixFileSystem) RemoveXAttr

func (me *PrefixFileSystem) RemoveXAttr(name string, attr string, context *Context) Status

func (*PrefixFileSystem) Rename

func (me *PrefixFileSystem) Rename(oldName string, newName string, context *Context) (code Status)

func (*PrefixFileSystem) Rmdir

func (me *PrefixFileSystem) Rmdir(name string, context *Context) (code Status)

func (*PrefixFileSystem) SetXAttr

func (me *PrefixFileSystem) SetXAttr(name string, attr string, data []byte, flags int, context *Context) Status

func (*PrefixFileSystem) String

func (me *PrefixFileSystem) String() string
func (me *PrefixFileSystem) Symlink(value string, linkName string, context *Context) (code Status)

func (*PrefixFileSystem) Truncate

func (me *PrefixFileSystem) Truncate(name string, offset uint64, context *Context) (code Status)
func (me *PrefixFileSystem) Unlink(name string, context *Context) (code Status)

func (*PrefixFileSystem) Utimens

func (me *PrefixFileSystem) Utimens(name string, AtimeNs int64, CtimeNs int64, context *Context) (code Status)

type RawFileSystem

type RawFileSystem interface {
	Lookup(header *InHeader, name string) (out *EntryOut, status Status)
	Forget(header *InHeader, input *ForgetIn)

	// Attributes.
	GetAttr(header *InHeader, input *GetAttrIn) (out *AttrOut, code Status)
	SetAttr(header *InHeader, input *SetAttrIn) (out *AttrOut, code Status)

	// Modifying structure.
	Mknod(header *InHeader, input *MknodIn, name string) (out *EntryOut, code Status)
	Mkdir(header *InHeader, input *MkdirIn, name string) (out *EntryOut, code Status)
	Unlink(header *InHeader, name string) (code Status)
	Rmdir(header *InHeader, name string) (code Status)
	Rename(header *InHeader, input *RenameIn, oldName string, newName string) (code Status)
	Link(header *InHeader, input *LinkIn, filename string) (out *EntryOut, code Status)

	Symlink(header *InHeader, pointedTo string, linkName string) (out *EntryOut, code Status)
	Readlink(header *InHeader) (out []byte, code Status)
	Access(header *InHeader, input *AccessIn) (code Status)

	// Extended attributes.
	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(header *InHeader, input *SetXAttrIn, attr string, data []byte) Status
	RemoveXAttr(header *InHeader, attr string) (code Status)

	// File handling.
	Create(header *InHeader, input *CreateIn, name string) (flags uint32, handle uint64, out *EntryOut, code Status)
	Open(header *InHeader, input *OpenIn) (flags uint32, handle uint64, status Status)
	Read(*InHeader, *ReadIn, BufferPool) ([]byte, Status)

	Release(header *InHeader, input *ReleaseIn)
	Write(*InHeader, *WriteIn, []byte) (written uint32, code Status)
	Flush(header *InHeader, input *FlushIn) Status
	Fsync(*InHeader, *FsyncIn) (code Status)

	// Directory handling
	OpenDir(header *InHeader, input *OpenIn) (flags uint32, handle uint64, status Status)
	ReadDir(header *InHeader, input *ReadIn) (*DirEntryList, Status)
	ReleaseDir(header *InHeader, input *ReleaseIn)
	FsyncDir(header *InHeader, input *FsyncIn) (code Status)

	//
	Ioctl(header *InHeader, input *IoctlIn) (output *IoctlOut, data []byte, code Status)
	StatFs(header *InHeader) *StatfsOut

	// Provide callbacks for pushing notifications to the kernel.
	Init(params *RawFsInit)
}

RawFileSystem is an interface close to the FUSE wire protocol.

Unless you really know what you are doing, you should not implement this, but rather the FileSystem interface; the details of getting interactions with open files, renames, and threading right etc. are somewhat tricky and not very interesting.

Include DefaultRawFileSystem to inherit a null implementation.

type RawFsInit

type RawFsInit struct {
	InodeNotify func(*NotifyInvalInodeOut) Status
	EntryNotify func(parent uint64, name string) Status
}

Talk back to FUSE.

InodeNotify invalidates the information associated with the inode (ie. data cache, attributes, etc.)

EntryNotify should be used if the existence status of an entry changes, (ie. to notify of creation or deletion of the file).

Somewhat confusingly, InodeNotify for a file that stopped to exist will give the correct result for Lstat (ENOENT), but the kernel will still issue file Open() on the inode.

type ReadIn

type ReadIn struct {
	Fh        uint64
	Offset    uint64
	Size      uint32
	ReadFlags uint32
	LockOwner uint64
	Flags     uint32
	Padding   uint32
}

func (*ReadIn) String

func (me *ReadIn) String() string

type ReadOnlyFile

type ReadOnlyFile struct {
	File
}

ReadOnlyFile is a wrapper that denies writable operations

func (*ReadOnlyFile) Chmod

func (me *ReadOnlyFile) Chmod(mode uint32) Status

func (*ReadOnlyFile) Chown

func (me *ReadOnlyFile) Chown(uid uint32, gid uint32) Status

func (*ReadOnlyFile) Fsync

func (me *ReadOnlyFile) Fsync(*FsyncIn) (code Status)

func (*ReadOnlyFile) String

func (me *ReadOnlyFile) String() string

func (*ReadOnlyFile) Truncate

func (me *ReadOnlyFile) Truncate(size uint64) Status

func (*ReadOnlyFile) Write

func (me *ReadOnlyFile) Write(input *WriteIn, data []byte) (uint32, Status)

type ReadonlyFileSystem

type ReadonlyFileSystem struct {
	FileSystem
}

This is a wrapper that only exposes read-only operations.

func (*ReadonlyFileSystem) Access

func (me *ReadonlyFileSystem) Access(name string, mode uint32, context *Context) (code Status)

func (*ReadonlyFileSystem) Chmod

func (me *ReadonlyFileSystem) Chmod(name string, mode uint32, context *Context) (code Status)

func (*ReadonlyFileSystem) Chown

func (me *ReadonlyFileSystem) Chown(name string, uid uint32, gid uint32, context *Context) (code Status)

func (*ReadonlyFileSystem) Create

func (me *ReadonlyFileSystem) Create(name string, flags uint32, mode uint32, context *Context) (file File, code Status)

func (*ReadonlyFileSystem) GetAttr

func (me *ReadonlyFileSystem) GetAttr(name string, context *Context) (*Attr, Status)

func (*ReadonlyFileSystem) GetXAttr

func (me *ReadonlyFileSystem) GetXAttr(name string, attr string, context *Context) ([]byte, Status)
func (me *ReadonlyFileSystem) Link(oldName string, newName string, context *Context) (code Status)

func (*ReadonlyFileSystem) ListXAttr

func (me *ReadonlyFileSystem) ListXAttr(name string, context *Context) ([]string, Status)

func (*ReadonlyFileSystem) Mkdir

func (me *ReadonlyFileSystem) Mkdir(name string, mode uint32, context *Context) Status

func (*ReadonlyFileSystem) Mknod

func (me *ReadonlyFileSystem) Mknod(name string, mode uint32, dev uint32, context *Context) Status

func (*ReadonlyFileSystem) OnMount

func (me *ReadonlyFileSystem) OnMount(nodeFs *PathNodeFs)

func (*ReadonlyFileSystem) OnUnmount

func (me *ReadonlyFileSystem) OnUnmount()

func (*ReadonlyFileSystem) Open

func (me *ReadonlyFileSystem) Open(name string, flags uint32, context *Context) (file File, code Status)

func (*ReadonlyFileSystem) OpenDir

func (me *ReadonlyFileSystem) OpenDir(name string, context *Context) (stream chan DirEntry, status Status)
func (me *ReadonlyFileSystem) Readlink(name string, context *Context) (string, Status)

func (*ReadonlyFileSystem) RemoveXAttr

func (me *ReadonlyFileSystem) RemoveXAttr(name string, attr string, context *Context) Status

func (*ReadonlyFileSystem) Rename

func (me *ReadonlyFileSystem) Rename(oldName string, newName string, context *Context) (code Status)

func (*ReadonlyFileSystem) Rmdir

func (me *ReadonlyFileSystem) Rmdir(name string, context *Context) (code Status)

func (*ReadonlyFileSystem) SetXAttr

func (me *ReadonlyFileSystem) SetXAttr(name string, attr string, data []byte, flags int, context *Context) Status

func (*ReadonlyFileSystem) String

func (me *ReadonlyFileSystem) String() string
func (me *ReadonlyFileSystem) Symlink(value string, linkName string, context *Context) (code Status)

func (*ReadonlyFileSystem) Truncate

func (me *ReadonlyFileSystem) Truncate(name string, offset uint64, context *Context) (code Status)
func (me *ReadonlyFileSystem) Unlink(name string, context *Context) (code Status)

func (*ReadonlyFileSystem) Utimens

func (me *ReadonlyFileSystem) Utimens(name string, AtimeNs int64, CtimeNs int64, context *Context) (code Status)

type ReleaseIn

type ReleaseIn struct {
	Fh           uint64
	Flags        uint32
	ReleaseFlags uint32
	LockOwner    uint64
}

func (*ReleaseIn) String

func (me *ReleaseIn) String() string

type RenameIn

type RenameIn struct {
	Newdir uint64
}

type SetAttrIn

type SetAttrIn struct {
	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
}

func (*SetAttrIn) String

func (me *SetAttrIn) String() string

type SetXAttrIn

type SetXAttrIn struct {
	Size  uint32
	Flags uint32
}

type StatfsOut

type StatfsOut struct {
	Kstatfs
}

type Status

type Status int32

func CopyFile

func CopyFile(srcFs, destFs FileSystem, srcFile, destFile string, context *Context) Status

func ToStatus

func ToStatus(err error) Status

Convert error back to Errno based errors.

func (Status) Ok

func (code Status) Ok() bool

func (Status) String

func (code Status) String() string

type WithFlags

type WithFlags struct {
	File

	// For debugging.
	Description string

	// Put FOPEN_* flags here.
	FuseFlags uint32

	// O_RDWR, O_TRUNCATE, etc.
	OpenFlags uint32
}

Wrap a File return in this to set FUSE flags. Also used internally to store open file data.

func (*WithFlags) String

func (me *WithFlags) String() string

type WriteIn

type WriteIn struct {
	Fh         uint64
	Offset     uint64
	Size       uint32
	WriteFlags uint32
	LockOwner  uint64
	Flags      uint32
	Padding    uint32
}

type WriteOut

type WriteOut struct {
	Size    uint32
	Padding uint32
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL