Documentation ¶
Overview ¶
Types and functions that make it easier to work with package fuse.
Index ¶
- func NewFileSystemServer(fs FileSystem) fuse.Server
- func WriteDirent(buf []byte, d Dirent) (n int)
- type Dirent
- type DirentType
- type FileSystem
- type NotImplementedFileSystem
- func (fs *NotImplementedFileSystem) CreateFile(ctx context.Context, op *fuseops.CreateFileOp) error
- func (fs *NotImplementedFileSystem) CreateLink(ctx context.Context, op *fuseops.CreateLinkOp) error
- func (fs *NotImplementedFileSystem) CreateSymlink(ctx context.Context, op *fuseops.CreateSymlinkOp) error
- func (fs *NotImplementedFileSystem) Destroy()
- func (fs *NotImplementedFileSystem) Fallocate(ctx context.Context, op *fuseops.FallocateOp) error
- func (fs *NotImplementedFileSystem) FlushFile(ctx context.Context, op *fuseops.FlushFileOp) error
- func (fs *NotImplementedFileSystem) ForgetInode(ctx context.Context, op *fuseops.ForgetInodeOp) error
- func (fs *NotImplementedFileSystem) GetInodeAttributes(ctx context.Context, op *fuseops.GetInodeAttributesOp) error
- func (fs *NotImplementedFileSystem) GetXattr(ctx context.Context, op *fuseops.GetXattrOp) error
- func (fs *NotImplementedFileSystem) ListXattr(ctx context.Context, op *fuseops.ListXattrOp) error
- func (fs *NotImplementedFileSystem) LookUpInode(ctx context.Context, op *fuseops.LookUpInodeOp) error
- func (fs *NotImplementedFileSystem) MkDir(ctx context.Context, op *fuseops.MkDirOp) error
- func (fs *NotImplementedFileSystem) MkNode(ctx context.Context, op *fuseops.MkNodeOp) error
- func (fs *NotImplementedFileSystem) OpenDir(ctx context.Context, op *fuseops.OpenDirOp) error
- func (fs *NotImplementedFileSystem) OpenFile(ctx context.Context, op *fuseops.OpenFileOp) error
- func (fs *NotImplementedFileSystem) ReadDir(ctx context.Context, op *fuseops.ReadDirOp) error
- func (fs *NotImplementedFileSystem) ReadFile(ctx context.Context, op *fuseops.ReadFileOp) error
- func (fs *NotImplementedFileSystem) ReadSymlink(ctx context.Context, op *fuseops.ReadSymlinkOp) error
- func (fs *NotImplementedFileSystem) ReleaseDirHandle(ctx context.Context, op *fuseops.ReleaseDirHandleOp) error
- func (fs *NotImplementedFileSystem) ReleaseFileHandle(ctx context.Context, op *fuseops.ReleaseFileHandleOp) error
- func (fs *NotImplementedFileSystem) RemoveXattr(ctx context.Context, op *fuseops.RemoveXattrOp) error
- func (fs *NotImplementedFileSystem) Rename(ctx context.Context, op *fuseops.RenameOp) error
- func (fs *NotImplementedFileSystem) RmDir(ctx context.Context, op *fuseops.RmDirOp) error
- func (fs *NotImplementedFileSystem) SetInodeAttributes(ctx context.Context, op *fuseops.SetInodeAttributesOp) error
- func (fs *NotImplementedFileSystem) SetXattr(ctx context.Context, op *fuseops.SetXattrOp) error
- func (fs *NotImplementedFileSystem) StatFS(ctx context.Context, op *fuseops.StatFSOp) error
- func (fs *NotImplementedFileSystem) SyncFile(ctx context.Context, op *fuseops.SyncFileOp) error
- func (fs *NotImplementedFileSystem) Unlink(ctx context.Context, op *fuseops.UnlinkOp) error
- func (fs *NotImplementedFileSystem) WriteFile(ctx context.Context, op *fuseops.WriteFileOp) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFileSystemServer ¶
func NewFileSystemServer(fs FileSystem) fuse.Server
Create a fuse.Server that handles ops by calling the associated FileSystem method.Respond with the resulting error. Unsupported ops are responded to directly with ENOSYS.
Each call to a FileSystem method (except ForgetInode) is made on its own goroutine, and is free to block. ForgetInode may be called synchronously, and should not depend on calls to other methods being received concurrently.
(It is safe to naively process ops concurrently because the kernel guarantees to serialize operations that the user expects to happen in order, cf. http://goo.gl/jnkHPO, fuse-devel thread "Fuse guarantees on concurrent requests").
func WriteDirent ¶
Write the supplied directory entry intto the given buffer in the format expected in fuseops.ReadFileOp.Data, returning the number of bytes written. Return zero if the entry would not fit.
Types ¶
type Dirent ¶
type Dirent struct { // The (opaque) offset within the directory file of the entry following this // one. See notes on fuseops.ReadDirOp.Offset for details. Offset fuseops.DirOffset // The inode of the child file or directory, and its name within the parent. Inode fuseops.InodeID Name string // The type of the child. The zero value (DT_Unknown) is legal, but means // that the kernel will need to call GetAttr when the type is needed. Type DirentType }
A struct representing an entry within a directory file, describing a child. See notes on fuseops.ReadDirOp and on WriteDirent for details.
type DirentType ¶
type DirentType uint32
const ( DT_Unknown DirentType = 0 DT_Socket DirentType = syscall.DT_SOCK DT_Link DirentType = syscall.DT_LNK DT_File DirentType = syscall.DT_REG DT_Block DirentType = syscall.DT_BLK DT_Directory DirentType = syscall.DT_DIR DT_Char DirentType = syscall.DT_CHR DT_FIFO DirentType = syscall.DT_FIFO )
type FileSystem ¶
type FileSystem interface { StatFS(context.Context, *fuseops.StatFSOp) error LookUpInode(context.Context, *fuseops.LookUpInodeOp) error GetInodeAttributes(context.Context, *fuseops.GetInodeAttributesOp) error SetInodeAttributes(context.Context, *fuseops.SetInodeAttributesOp) error ForgetInode(context.Context, *fuseops.ForgetInodeOp) error MkDir(context.Context, *fuseops.MkDirOp) error MkNode(context.Context, *fuseops.MkNodeOp) error CreateFile(context.Context, *fuseops.CreateFileOp) error CreateLink(context.Context, *fuseops.CreateLinkOp) error CreateSymlink(context.Context, *fuseops.CreateSymlinkOp) error Rename(context.Context, *fuseops.RenameOp) error RmDir(context.Context, *fuseops.RmDirOp) error Unlink(context.Context, *fuseops.UnlinkOp) error OpenDir(context.Context, *fuseops.OpenDirOp) error ReadDir(context.Context, *fuseops.ReadDirOp) error ReleaseDirHandle(context.Context, *fuseops.ReleaseDirHandleOp) error OpenFile(context.Context, *fuseops.OpenFileOp) error ReadFile(context.Context, *fuseops.ReadFileOp) error WriteFile(context.Context, *fuseops.WriteFileOp) error SyncFile(context.Context, *fuseops.SyncFileOp) error FlushFile(context.Context, *fuseops.FlushFileOp) error ReleaseFileHandle(context.Context, *fuseops.ReleaseFileHandleOp) error ReadSymlink(context.Context, *fuseops.ReadSymlinkOp) error RemoveXattr(context.Context, *fuseops.RemoveXattrOp) error GetXattr(context.Context, *fuseops.GetXattrOp) error ListXattr(context.Context, *fuseops.ListXattrOp) error SetXattr(context.Context, *fuseops.SetXattrOp) error Fallocate(context.Context, *fuseops.FallocateOp) error // Regard all inodes (including the root inode) as having their lookup counts // decremented to zero, and clean up any resources associated with the file // system. No further calls to the file system will be made. Destroy() }
An interface with a method for each op type in the fuseops package. This can be used in conjunction with NewFileSystemServer to avoid writing a "dispatch loop" that switches on op types, instead receiving typed method calls directly.
The FileSystem implementation should not call Connection.Reply, instead returning the error with which the caller should respond.
See NotImplementedFileSystem for a convenient way to embed default implementations for methods you don't care about.
type NotImplementedFileSystem ¶
type NotImplementedFileSystem struct { }
A FileSystem that responds to all ops with fuse.ENOSYS. Embed this in your struct to inherit default implementations for the methods you don't care about, ensuring your struct will continue to implement FileSystem even as new methods are added.
func (*NotImplementedFileSystem) CreateFile ¶
func (fs *NotImplementedFileSystem) CreateFile( ctx context.Context, op *fuseops.CreateFileOp) error
func (*NotImplementedFileSystem) CreateLink ¶
func (fs *NotImplementedFileSystem) CreateLink( ctx context.Context, op *fuseops.CreateLinkOp) error
func (*NotImplementedFileSystem) CreateSymlink ¶
func (fs *NotImplementedFileSystem) CreateSymlink( ctx context.Context, op *fuseops.CreateSymlinkOp) error
func (*NotImplementedFileSystem) Destroy ¶
func (fs *NotImplementedFileSystem) Destroy()
func (*NotImplementedFileSystem) Fallocate ¶
func (fs *NotImplementedFileSystem) Fallocate( ctx context.Context, op *fuseops.FallocateOp) error
func (*NotImplementedFileSystem) FlushFile ¶
func (fs *NotImplementedFileSystem) FlushFile( ctx context.Context, op *fuseops.FlushFileOp) error
func (*NotImplementedFileSystem) ForgetInode ¶
func (fs *NotImplementedFileSystem) ForgetInode( ctx context.Context, op *fuseops.ForgetInodeOp) error
func (*NotImplementedFileSystem) GetInodeAttributes ¶
func (fs *NotImplementedFileSystem) GetInodeAttributes( ctx context.Context, op *fuseops.GetInodeAttributesOp) error
func (*NotImplementedFileSystem) GetXattr ¶
func (fs *NotImplementedFileSystem) GetXattr( ctx context.Context, op *fuseops.GetXattrOp) error
func (*NotImplementedFileSystem) ListXattr ¶
func (fs *NotImplementedFileSystem) ListXattr( ctx context.Context, op *fuseops.ListXattrOp) error
func (*NotImplementedFileSystem) LookUpInode ¶
func (fs *NotImplementedFileSystem) LookUpInode( ctx context.Context, op *fuseops.LookUpInodeOp) error
func (*NotImplementedFileSystem) OpenFile ¶
func (fs *NotImplementedFileSystem) OpenFile( ctx context.Context, op *fuseops.OpenFileOp) error
func (*NotImplementedFileSystem) ReadFile ¶
func (fs *NotImplementedFileSystem) ReadFile( ctx context.Context, op *fuseops.ReadFileOp) error
func (*NotImplementedFileSystem) ReadSymlink ¶
func (fs *NotImplementedFileSystem) ReadSymlink( ctx context.Context, op *fuseops.ReadSymlinkOp) error
func (*NotImplementedFileSystem) ReleaseDirHandle ¶
func (fs *NotImplementedFileSystem) ReleaseDirHandle( ctx context.Context, op *fuseops.ReleaseDirHandleOp) error
func (*NotImplementedFileSystem) ReleaseFileHandle ¶
func (fs *NotImplementedFileSystem) ReleaseFileHandle( ctx context.Context, op *fuseops.ReleaseFileHandleOp) error
func (*NotImplementedFileSystem) RemoveXattr ¶
func (fs *NotImplementedFileSystem) RemoveXattr( ctx context.Context, op *fuseops.RemoveXattrOp) error
func (*NotImplementedFileSystem) SetInodeAttributes ¶
func (fs *NotImplementedFileSystem) SetInodeAttributes( ctx context.Context, op *fuseops.SetInodeAttributesOp) error
func (*NotImplementedFileSystem) SetXattr ¶
func (fs *NotImplementedFileSystem) SetXattr( ctx context.Context, op *fuseops.SetXattrOp) error
func (*NotImplementedFileSystem) SyncFile ¶
func (fs *NotImplementedFileSystem) SyncFile( ctx context.Context, op *fuseops.SyncFileOp) error
func (*NotImplementedFileSystem) WriteFile ¶
func (fs *NotImplementedFileSystem) WriteFile( ctx context.Context, op *fuseops.WriteFileOp) error