fission

package module
v0.0.0-...-21dcc45 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

README

fission

Go package enabling the implementation of a multi-threaded low-level FUSE file system.

API Reference

package fission

// Volume represents a file system instance. A Volume is provisioned by calling
// NewVolume(). After recording the returned interface from NewVolume(), a single
// call to DoMount() kicks off the mounting process and the caller should expect
// to see the various callbacks listed in the Callbacks interface. This will
// continue a single call to DoUnmount() is made after which the Volume instance
// may be safely discarded.
//
type Volume interface {
	// DoMount is invoked on a Volume interface to perform the FUSE mount and
	// begin receiving the various callbacks listed in the Callbacks interface.
	//
	DoMount() (err error)

	// DoUnmount is invoked on a Volume interface to perform the FUSE unmount.
	// Upon return, no callbacks will be made and the Volume instance may be
	// safely discarded.
	//
	DoUnmount() (err error)
}

// Callbacks is the interface declaring the various callbacks that will be issued
// in response to a Volume instance while it is mounted. Note that some callbacks
// are expected to return both an error as well as a struct pointer. In the case of an
// error, the struct pointer should be <nil> as it will not be written to /dev/fuse.
// Finally, one callback is special: DoInit(). Provisioning a Volume instance involved
// providing the InitOut.MaxWrite to allow configuring the buffer pool used by the
// /dev/fuse read loop (including, of course, the reception of the InitIn up-call).
// The implementation of DoInit, therefore, should not expect returning an InitOut
// with a different MaxWrite to be honored.
//
type Callbacks interface {
	DoLookup(inHeader *InHeader, lookupIn *LookupIn) (lookupOut *LookupOut, errno syscall.Errno)
	DoForget(inHeader *InHeader, forgetIn *ForgetIn)
	DoGetAttr(inHeader *InHeader, getAttrIn *GetAttrIn) (getAttrOut *GetAttrOut, errno syscall.Errno)
	DoSetAttr(inHeader *InHeader, setAttrIn *SetAttrIn) (setAttrOut *SetAttrOut, errno syscall.Errno)
	DoReadLink(inHeader *InHeader) (readLinkOut *ReadLinkOut, errno syscall.Errno)
	DoSymLink(inHeader *InHeader, symLinkIn *SymLinkIn) (symLinkOut *SymLinkOut, errno syscall.Errno)
	DoMkNod(inHeader *InHeader, mkNodIn *MkNodIn) (mkNodOut *MkNodOut, errno syscall.Errno)
	DoMkDir(inHeader *InHeader, mkDirIn *MkDirIn) (mkDirOut *MkDirOut, errno syscall.Errno)
	DoUnlink(inHeader *InHeader, unlinkIn *UnlinkIn) (errno syscall.Errno)
	DoRmDir(inHeader *InHeader, rmDirIn *RmDirIn) (errno syscall.Errno)
	DoRename(inHeader *InHeader, renameIn *RenameIn) (errno syscall.Errno)
	DoLink(inHeader *InHeader, linkIn *LinkIn) (linkOut *LinkOut, errno syscall.Errno)
	DoOpen(inHeader *InHeader, openIn *OpenIn) (openOut *OpenOut, errno syscall.Errno)
	DoRead(inHeader *InHeader, readIn *ReadIn) (readOut *ReadOut, errno syscall.Errno)
	DoWrite(inHeader *InHeader, writeIn *WriteIn) (writeOut *WriteOut, errno syscall.Errno)
	DoStatFS(inHeader *InHeader) (statFSOut *StatFSOut, errno syscall.Errno)
	DoRelease(inHeader *InHeader, releaseIn *ReleaseIn) (errno syscall.Errno)
	DoFSync(inHeader *InHeader, fSyncIn *FSyncIn) (errno syscall.Errno)
	DoSetXAttr(inHeader *InHeader, setXAttrIn *SetXAttrIn) (errno syscall.Errno)
	DoGetXAttr(inHeader *InHeader, getXAttrIn *GetXAttrIn) (getXAttrOut *GetXAttrOut, errno syscall.Errno)
	DoListXAttr(inHeader *InHeader, listXAttrIn *ListXAttrIn) (listXAttrOut *ListXAttrOut, errno syscall.Errno)
	DoRemoveXAttr(inHeader *InHeader, removeXAttrIn *RemoveXAttrIn) (errno syscall.Errno)
	DoFlush(inHeader *InHeader, flushIn *FlushIn) (errno syscall.Errno)
	DoInit(inHeader *InHeader, initIn *InitIn) (initOut *InitOut, errno syscall.Errno)
	DoOpenDir(inHeader *InHeader, openDirIn *OpenDirIn) (openDirOut *OpenDirOut, errno syscall.Errno)
	DoReadDir(inHeader *InHeader, readDirIn *ReadDirIn) (readDirOut *ReadDirOut, errno syscall.Errno)
	DoReleaseDir(inHeader *InHeader, releaseDirIn *ReleaseDirIn) (errno syscall.Errno)
	DoFSyncDir(inHeader *InHeader, fSyncDirIn *FSyncDirIn) (errno syscall.Errno)
	DoGetLK(inHeader *InHeader, getLKIn *GetLKIn) (getLKOut *GetLKOut, errno syscall.Errno)
	DoSetLK(inHeader *InHeader, setLKIn *SetLKIn) (errno syscall.Errno)
	DoSetLKW(inHeader *InHeader, setLKWIn *SetLKWIn) (errno syscall.Errno)
	DoAccess(inHeader *InHeader, accessIn *AccessIn) (errno syscall.Errno)
	DoCreate(inHeader *InHeader, createIn *CreateIn) (createOut *CreateOut, errno syscall.Errno)
	DoInterrupt(inHeader *InHeader, interruptIn *InterruptIn)
	DoBMap(inHeader *InHeader, bMapIn *BMapIn) (bMapOut *BMapOut, errno syscall.Errno)
	DoDestroy(inHeader *InHeader) (errno syscall.Errno)
	DoPoll(inHeader *InHeader, pollIn *PollIn) (pollOut *PollOut, errno syscall.Errno)
	DoBatchForget(inHeader *InHeader, batchForgetIn *BatchForgetIn)
	DoFAllocate(inHeader *InHeader, fAllocateIn *FAllocateIn) (errno syscall.Errno)
	DoReadDirPlus(inHeader *InHeader, readDirPlusIn *ReadDirPlusIn) (readDirPlusOut *ReadDirPlusOut, errno syscall.Errno)
	DoRename2(inHeader *InHeader, rename2In *Rename2In) (errno syscall.Errno)
	DoLSeek(inHeader *InHeader, lSeekIn *LSeekIn) (lSeekOut *LSeekOut, errno syscall.Errno)
}

// NewVolume is called to create a Volume instance. Various callbacks listed in the Callbacks interface
// will be made while the Volume is mounted. The type of the file system, once mounted, will be "fuse"
// and, if non-empty, followed by a "." and the fuseSubtype (if supported... as it is on Linux). Non-root
// users may want to specify allowOther as TRUE to enable other non-root users access to the mount point.
// Note that the caller provides a value for InitOut.MaxWrite at the time the Volume instance is provisioned
// so that the package may properly setup the read loop against /dev/fuse prior to reception of an InitIn
// request. A chan error is also supplied to enable the Volume to indicate that it is no longer servicing
// FUSE upcalls (e.g. as a result of an intentional DoUnmount() call or some unexpected error reading
// from /dev/fuse).
//
func NewVolume(volumeName string, mountpointDirPath string, fuseSubtype string, initOutMaxWrite uint32, allowOther bool, callbacks Callbacks, logger *log.Logger, errChan chan error) (volume Volume)

Contributors

License

See the included LICENSE file

Documentation

Index

Constants

View Source
const (
	SetAttrInValidMode        = uint32(1) << 0
	SetAttrInValidUID         = uint32(1) << 1
	SetAttrInValidGID         = uint32(1) << 2
	SetAttrInValidSize        = uint32(1) << 3
	SetAttrInValidATime       = uint32(1) << 4
	SetAttrInValidMTime       = uint32(1) << 5
	SetAttrInValidFH          = uint32(1) << 6
	SetAttrInValidATimeNow    = uint32(1) << 7
	SetAttrInValidMTimeNow    = uint32(1) << 8
	SetAttrInValidLockOwner   = uint32(1) << 9
	SetAttrInValidCTime       = uint32(1) << 10 // not supported
	SetAttrInValidKillSuidGID = uint32(1) << 11 // not supported
)
View Source
const (
	SetXAttrInCreate  = uint32(1)
	SetXAttrInReplace = uint32(2)
)
View Source
const (
	FOpenRequestRDONLY = uint32(syscall.O_RDONLY)
	FOpenRequestWRONLY = uint32(syscall.O_WRONLY)
	FOpenRequestRDWR   = uint32(syscall.O_RDWR)
	FOpenRequestAPPEND = uint32(syscall.O_APPEND)
	FOpenRequestCREAT  = uint32(syscall.O_CREAT)
	FOpenRequestEXCL   = uint32(syscall.O_EXCL)
	FOpenRequestSYNC   = uint32(syscall.O_SYNC)
	FOpenRequestTRUNC  = uint32(syscall.O_TRUNC)
)
View Source
const (
	FOpenResponseDirectIO    = uint32(1) << 0
	FOpenResponseKeepCache   = uint32(1) << 1
	FOpenResponseNonSeekable = uint32(1) << 2
	FOpenResponseCacheDir    = uint32(1) << 3
	FOpenResponseStream      = uint32(1) << 4
)
View Source
const (
	InitFlagsAsyncRead         = uint32(1) << 0
	InitFlagsPosixLocks        = uint32(1) << 1
	InitFlagsFileOps           = uint32(1) << 2
	InitFlagsAtomicOTrunc      = uint32(1) << 3
	InitFlagsExportSupport     = uint32(1) << 4
	InitFlagsBigWrites         = uint32(1) << 5
	InitFlagsDontMask          = uint32(1) << 6
	InitFlagsSpliceWrite       = uint32(1) << 7
	InitFlagsSpliceMove        = uint32(1) << 8
	InitFlagsSpliceRead        = uint32(1) << 9
	InitFlagsFLockLocks        = uint32(1) << 10
	InitFlagsHasIoctlDir       = uint32(1) << 11
	InitFlagsAutoInvalData     = uint32(1) << 12
	InitFlagsDoReadDirPlus     = uint32(1) << 13
	InitFlagsReaddirplusAuto   = uint32(1) << 14
	InitFlagsAsyncDio          = uint32(1) << 15
	InitFlagsWritebackCache    = uint32(1) << 16
	InitFlagsNoOpenSupport     = uint32(1) << 17
	InitFlagsParallelDirops    = uint32(1) << 18
	InitFlagsHandleKillpriv    = uint32(1) << 19
	InitFlagsPosixACL          = uint32(1) << 20
	InitFlagsAbortError        = uint32(1) << 21
	InitFlagsMaxPages          = uint32(1) << 22
	InitFlagsCacheSymlinks     = uint32(1) << 23
	InitFlagsNoOpendirSupport  = uint32(1) << 24
	InitFlagsExplicitInvalData = uint32(1) << 25
	InitFlagsMapAlignment      = uint32(1) << 26
	InitFlagsSubMounts         = uint32(1) << 27
	InitFlagsHandleKillprivV2  = uint32(1) << 28
	InitFlagsSetXattrExt       = uint32(1) << 29
	InitFalgsInitExt           = uint32(1) << 30
	InitFlagsInitReserved      = uint32(1) << 31

	InitFlags2SecurityCtx     = uint32(1) << 0
	InitFlags2HasInodeDAX     = uint32(1) << 1
	InitFlags2CreateSuppGroup = uint32(1) << 2
)
View Source
const (
	ReleaseFlush = uint32(1) << iota
	ReleaseFLockUnlock
)
View Source
const (
	WriteCache = uint32(1) << iota
	WriteLockOwner
	WriteKillPriv
)
View Source
const (
	IoctlCompat = uint32(1) << iota
	IoctlUnrestricted
	IoctlRetry
	Ioctl32Bit
	IoctlDir
	IoctlCompatX32
)
View Source
const (
	NofifyPoll = iota + 1
	NotifyInvalInode
	NotifyInvalEntry
	NotifyStore
	NotifyRetrieve
	NotifyDelete
	NotifyCodeMax
)
View Source
const (
	OpCodeLookup   = uint32(1)
	OpCodeForget   = uint32(2) // no reply
	OpCodeGetAttr  = uint32(3)
	OpCodeSetAttr  = uint32(4)
	OpCodeReadLink = uint32(5)
	OpCodeSymLink  = uint32(6)

	OpCodeMkNod   = uint32(8)
	OpCodeMkDir   = uint32(9)
	OpCodeUnlink  = uint32(10)
	OpCodeRmDir   = uint32(11)
	OpCodeRename  = uint32(12)
	OpCodeLink    = uint32(13)
	OpCodeOpen    = uint32(14)
	OpCodeRead    = uint32(15)
	OpCodeWrite   = uint32(16)
	OpCodeStatFS  = uint32(17)
	OpCodeRelease = uint32(18)

	OpCodeFSync         = uint32(20)
	OpCodeSetXAttr      = uint32(21)
	OpCodeGetXAttr      = uint32(22)
	OpCodeListXAttr     = uint32(23)
	OpCodeRemoveXAttr   = uint32(24)
	OpCodeFlush         = uint32(25)
	OpCodeInit          = uint32(26)
	OpCodeOpenDir       = uint32(27)
	OpCodeReadDir       = uint32(28)
	OpCodeReleaseDir    = uint32(29)
	OpCodeFSyncDir      = uint32(30)
	OpCodeGetLK         = uint32(31)
	OpCodeSetLK         = uint32(32)
	OpCodeSetLKW        = uint32(33)
	OpCodeAccess        = uint32(34)
	OpCodeCreate        = uint32(35)
	OpCodeInterrupt     = uint32(36) // no reply
	OpCodeBMap          = uint32(37)
	OpCodeDestroy       = uint32(38)
	OpCodeIoCtl         = uint32(39) // unsupported
	OpCodePoll          = uint32(40)
	OpCodeNotifyReply   = uint32(41) // unsupported
	OpCodeBatchForget   = uint32(42) // no reply
	OpCodeFAllocate     = uint32(43)
	OpCodeReadDirPlus   = uint32(44)
	OpCodeRename2       = uint32(45)
	OpCodeLSeek         = uint32(46)
	OpCodeCopyFileRange = uint32(47) // unsupported
	OpCodeSetupMapping  = uint32(48) // unsupported
	OpCodeRemoveMapping = uint32(49) // unsupported
	OpCodeSyncFS        = uint32(50) // unsupported
	OpCodeTmpFile       = uint32(51) // unsupported

	OpCodeCuseInit = uint32(4096) // unsupported
)
View Source
const AccessInSize = 8
View Source
const AttrSize = 88
View Source
const BMapInSize = 16
View Source
const BMapOutSize = 8
View Source
const BatchForgetInFixedPortionSize = 8 // + (Count * ForgetOneSize)
View Source
const CreateInFixedPortionSize = 16 // + len(Name)
View Source
const CreateOutSize = EntryOutSize + 16
View Source
const DirEntAlignment = 8 // applies to both DirEnt and DirEntPlus
View Source
const DirEntFixedPortionSize = 24 // + len(Name) and rounded up to DirEntAlignment boundary
View Source
const DirEntPlusFixedPortionSize = EntryOutSize + DirEntFixedPortionSize // + len(DirEnt.Name) and rounded up to DirEntAlignment boundary
View Source
const EntryOutSize = 40 + AttrSize
View Source
const FAllocateInSize = 32
View Source
const FSyncDirInSize = 16
View Source
const (
	FSyncFDataSync = uint32(1) << iota
)
View Source
const FSyncInSize = 16
View Source
const FileLockSize = 24
View Source
const FlushInSize = 24
View Source
const ForgetInSize = 8
View Source
const ForgetOneSize = 16
View Source
const (
	GetAttrFH uint32 = uint32(1) << iota
)
View Source
const GetAttrInSize = 16
View Source
const GetAttrOutSize = 16 + AttrSize
View Source
const GetLKInSize = 16 + FileLockSize + 8
View Source
const GetLKOutSize = FileLockSize
View Source
const GetXAttrInFixedPortionSize = 8 // + len(Name)
View Source
const GetXAttrOutSizeOnlySize = 8
View Source
const InHeaderSize = 40
View Source
const InitInFrom736OnSize = 64
View Source
const InitInMinSize = 8
View Source
const InitInSize = 64
View Source
const InitInUpThru735Size = 16
View Source
const InitOut717Size = 24
View Source
const InitOut718Thru720Size = 72
View Source
const InitOut721Thru722Size = 24
View Source
const InitOut723Thru727Size = 64
View Source
const InitOut728Thru731aSize = 64
View Source
const InitOut731bThru735Size = 64
View Source
const InitOut736AndBeyondSize = 64
View Source
const InitOutSize = 64
View Source
const InterruptInSize = 8
View Source
const IoCtlInFixedPortionSize = 32 // + len(InBuf) a.k.a. InSize
View Source
const IoCtlOutFixedPortionSize = 16 // + (InIovs * IoctlIovecSize) + (OutIovs * IoctlIovecSize)
View Source
const IoctlIovecSize = 16
View Source
const IoctlMaxIOV = 256
View Source
const KStatFSSize = 80
View Source
const (
	LKFLock uint32 = uint32(1) << iota
)
View Source
const LSeekInSize = 24
View Source
const LSeekOutSize = 8
View Source
const LinkInFixedPortionSize = 8 // + len(Name)
View Source
const LinkOutSize = EntryOutSize
View Source
const ListXAttrInSize = 8
View Source
const ListXAttrOutSizeOnlySize = 8
View Source
const LookupOutSize = EntryOutSize
View Source
const MkDirInFixedPortionSize = 8 // + len(Name)
View Source
const MkDirOutSize = EntryOutSize
View Source
const MkNodInFixedPortionSize = 16 // + len(Name)
View Source
const MkNodOutSize = EntryOutSize
View Source
const OpenDirInSize = 8
View Source
const OpenDirOutSize = 16
View Source
const OpenInSize = 8
View Source
const OpenOutSize = 16
View Source
const OutHeaderSize = 16
View Source
const PollInSize = 24
View Source
const PollOutSize = 8
View Source
const (
	PollScheduleNotify = uint32(1) << iota
)
View Source
const ReadDirInSize = 40
View Source
const ReadDirPlusInSize = 40
View Source
const ReadInSize = 40
View Source
const (
	ReadLockOwner = uint32(1) << (iota + 1)
)
View Source
const ReleaseDirInSize = 24
View Source
const ReleaseInSize = 24
View Source
const Rename2InFixedPortionSize = 16 // + len(OldName) + 1 + len(NewName)
View Source
const RenameInFixedPortionSize = 8 // + len(OldName) + 1 + len(NewName)
View Source
const SetAttrInSize = 88
View Source
const SetAttrOutSize = 16 + AttrSize
View Source
const SetLKInSize = 16 + FileLockSize + 8
View Source
const SetLKWInSize = 16 + FileLockSize + 8
View Source
const SetXAttrInFixedPortionSize = 16 // + len(Name) + 1 + len(Data)
View Source
const StatFSOutSize = KStatFSSize
View Source
const SymLinkOutSize = EntryOutSize
View Source
const WriteInFixedPortionSize = 40 // + len(Data) a.k.a. Size
View Source
const WriteOutSize = 8

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessIn

type AccessIn struct {
	Mask    uint32
	Padding uint32
}

type Attr

type Attr struct {
	Ino       uint64
	Size      uint64
	Blocks    uint64
	ATimeSec  uint64
	MTimeSec  uint64
	CTimeSec  uint64
	ATimeNSec uint32
	MTimeNSec uint32
	CTimeNSec uint32
	Mode      uint32
	NLink     uint32
	UID       uint32
	GID       uint32
	RDev      uint32
	BlkSize   uint32
	Padding   uint32
}

type BMapIn

type BMapIn struct {
	Block     uint64
	BlockSize uint32
	Padding   uint32
}

type BMapOut

type BMapOut struct {
	Block uint64
}

type BatchForgetIn

type BatchForgetIn struct {
	Count  uint32
	Dummy  uint32
	Forget []ForgetOne // len(Forget) == Count
}

type Callbacks

type Callbacks interface {
	DoLookup(inHeader *InHeader, lookupIn *LookupIn) (lookupOut *LookupOut, errno syscall.Errno)
	DoForget(inHeader *InHeader, forgetIn *ForgetIn)
	DoGetAttr(inHeader *InHeader, getAttrIn *GetAttrIn) (getAttrOut *GetAttrOut, errno syscall.Errno)
	DoSetAttr(inHeader *InHeader, setAttrIn *SetAttrIn) (setAttrOut *SetAttrOut, errno syscall.Errno)
	DoReadLink(inHeader *InHeader) (readLinkOut *ReadLinkOut, errno syscall.Errno)
	DoSymLink(inHeader *InHeader, symLinkIn *SymLinkIn) (symLinkOut *SymLinkOut, errno syscall.Errno)
	DoMkNod(inHeader *InHeader, mkNodIn *MkNodIn) (mkNodOut *MkNodOut, errno syscall.Errno)
	DoMkDir(inHeader *InHeader, mkDirIn *MkDirIn) (mkDirOut *MkDirOut, errno syscall.Errno)
	DoUnlink(inHeader *InHeader, unlinkIn *UnlinkIn) (errno syscall.Errno)
	DoRmDir(inHeader *InHeader, rmDirIn *RmDirIn) (errno syscall.Errno)
	DoRename(inHeader *InHeader, renameIn *RenameIn) (errno syscall.Errno)
	DoLink(inHeader *InHeader, linkIn *LinkIn) (linkOut *LinkOut, errno syscall.Errno)
	DoOpen(inHeader *InHeader, openIn *OpenIn) (openOut *OpenOut, errno syscall.Errno)
	DoRead(inHeader *InHeader, readIn *ReadIn) (readOut *ReadOut, errno syscall.Errno)
	DoWrite(inHeader *InHeader, writeIn *WriteIn) (writeOut *WriteOut, errno syscall.Errno)
	DoStatFS(inHeader *InHeader) (statFSOut *StatFSOut, errno syscall.Errno)
	DoRelease(inHeader *InHeader, releaseIn *ReleaseIn) (errno syscall.Errno)
	DoFSync(inHeader *InHeader, fSyncIn *FSyncIn) (errno syscall.Errno)
	DoSetXAttr(inHeader *InHeader, setXAttrIn *SetXAttrIn) (errno syscall.Errno)
	DoGetXAttr(inHeader *InHeader, getXAttrIn *GetXAttrIn) (getXAttrOut *GetXAttrOut, errno syscall.Errno)
	DoListXAttr(inHeader *InHeader, listXAttrIn *ListXAttrIn) (listXAttrOut *ListXAttrOut, errno syscall.Errno)
	DoRemoveXAttr(inHeader *InHeader, removeXAttrIn *RemoveXAttrIn) (errno syscall.Errno)
	DoFlush(inHeader *InHeader, flushIn *FlushIn) (errno syscall.Errno)
	DoInit(inHeader *InHeader, initIn *InitIn) (initOut *InitOut, errno syscall.Errno)
	DoOpenDir(inHeader *InHeader, openDirIn *OpenDirIn) (openDirOut *OpenDirOut, errno syscall.Errno)
	DoReadDir(inHeader *InHeader, readDirIn *ReadDirIn) (readDirOut *ReadDirOut, errno syscall.Errno)
	DoReleaseDir(inHeader *InHeader, releaseDirIn *ReleaseDirIn) (errno syscall.Errno)
	DoFSyncDir(inHeader *InHeader, fSyncDirIn *FSyncDirIn) (errno syscall.Errno)
	DoGetLK(inHeader *InHeader, getLKIn *GetLKIn) (getLKOut *GetLKOut, errno syscall.Errno)
	DoSetLK(inHeader *InHeader, setLKIn *SetLKIn) (errno syscall.Errno)
	DoSetLKW(inHeader *InHeader, setLKWIn *SetLKWIn) (errno syscall.Errno)
	DoAccess(inHeader *InHeader, accessIn *AccessIn) (errno syscall.Errno)
	DoCreate(inHeader *InHeader, createIn *CreateIn) (createOut *CreateOut, errno syscall.Errno)
	DoInterrupt(inHeader *InHeader, interruptIn *InterruptIn)
	DoBMap(inHeader *InHeader, bMapIn *BMapIn) (bMapOut *BMapOut, errno syscall.Errno)
	DoDestroy(inHeader *InHeader) (errno syscall.Errno)
	DoPoll(inHeader *InHeader, pollIn *PollIn) (pollOut *PollOut, errno syscall.Errno)
	DoBatchForget(inHeader *InHeader, batchForgetIn *BatchForgetIn)
	DoFAllocate(inHeader *InHeader, fAllocateIn *FAllocateIn) (errno syscall.Errno)
	DoReadDirPlus(inHeader *InHeader, readDirPlusIn *ReadDirPlusIn) (readDirPlusOut *ReadDirPlusOut, errno syscall.Errno)
	DoRename2(inHeader *InHeader, rename2In *Rename2In) (errno syscall.Errno)
	DoLSeek(inHeader *InHeader, lSeekIn *LSeekIn) (lSeekOut *LSeekOut, errno syscall.Errno)
}

Callbacks is the interface declaring the various callbacks that will be issued in response to a Volume instance while it is mounted. Note that some callbacks are expected to return both an error as well as a struct pointer. In the case of an error, the struct pointer should be <nil> as it will not be written to /dev/fuse. Finally, one callback is special: DoInit(). Provisioning a Volume instance involved providing the InitOut.MaxWrite to allow configuring the buffer pool used by the /dev/fuse read loop (including, of course, the reception of the InitIn up-call). The implementation of DoInit, therefore, should not expect returning an InitOut with a different MaxWrite to be honored.

type CreateIn

type CreateIn struct {
	Flags   uint32 // mask of const FOpenRequest* bits
	Mode    uint32
	UMask   uint32
	Padding uint32
	Name    []byte
}

type CreateOut

type CreateOut struct {
	EntryOut
	FH        uint64
	OpenFlags uint32 // mask of const FOpenResponse* bits
	Padding   uint32
}

type DirEnt

type DirEnt struct {
	Ino     uint64
	Off     uint64 // position of next DirEnt
	NameLen uint32 // automatically computed ( == len(Name) )
	Type    uint32
	Name    []byte
}

type DirEntPlus

type DirEntPlus struct {
	EntryOut
	DirEnt
}

type EntryOut

type EntryOut struct {
	NodeID         uint64
	Generation     uint64
	EntryValidSec  uint64
	AttrValidSec   uint64
	EntryValidNSec uint32
	AttrValidNSec  uint32
	Attr
}

type FAllocateIn

type FAllocateIn struct {
	FH      uint64
	Offset  uint64
	Length  uint64
	Mode    uint32
	Padding uint32
}

type FSyncDirIn

type FSyncDirIn struct {
	FH         uint64
	FsyncFlags uint32
	Padding    uint32
}

type FSyncIn

type FSyncIn struct {
	FH         uint64
	FsyncFlags uint32
	Padding    uint32
}

type FileLock

type FileLock struct {
	Start uint64
	End   uint64
	Type  uint32
	PID   uint32
}

type FlushIn

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

type ForgetIn

type ForgetIn struct {
	NLookup uint64
}

type ForgetOne

type ForgetOne struct {
	NodeID  uint64
	NLookup uint64
}

type GetAttrIn

type GetAttrIn struct {
	Flags uint32 // mask of const GetAttrInFlags* bits
	Dummy uint32
	FH    uint64
}

type GetAttrOut

type GetAttrOut struct {
	AttrValidSec  uint64
	AttrValidNSec uint32
	Dummy         uint32
	Attr
}

type GetLKIn

type GetLKIn struct {
	FH    uint64
	Owner uint64
	FileLock
	LKFlags uint32
	Padding uint32
}

type GetLKOut

type GetLKOut struct {
	FileLock
}

type GetXAttrIn

type GetXAttrIn struct {
	Size    uint32 // == max len(GetXAttrOut.Data)
	Padding uint32
	Name    []byte
}

type GetXAttrOut

type GetXAttrOut struct {
	Size    uint32 // only returned if GetXAttrIn.Size == 0
	Padding uint32 // only returned if GetXAttrIn.Size == 0
	Data    []byte // only returned if GetXAttrIn.Size != 0
}

type InHeader

type InHeader struct {
	Len     uint32 // includes InHeaderSize and any payload
	OpCode  uint32 // one of const OpCode*
	Unique  uint64
	NodeID  uint64
	UID     uint32
	GID     uint32
	PID     uint32
	Padding uint32
}

type InitIn

type InitIn struct {
	Major        uint32
	Minor        uint32
	MaxReadAhead uint32
	Flags        uint32 // mask of const InitFlags* bits
	Flags2       uint32 // mask of const InitFlags2* bits
	Unused       [11]uint32
}

type InitInFrom736On

type InitInFrom736On struct {
	Major        uint32
	Minor        uint32
	MaxReadAhead uint32
	Flags        uint32 // mask of const InitFlags* bits
	Flags2       uint32 // mask of const InitFlags2* bits
	Unused       [11]uint32
}

type InitInMin

type InitInMin struct {
	Major uint32
	Minor uint32
}

type InitInUpThru735

type InitInUpThru735 struct {
	Major        uint32
	Minor        uint32
	MaxReadAhead uint32
	Flags        uint32 // mask of const InitFlags* bits
}

type InitOut

type InitOut struct {
	Major                uint32
	Minor                uint32
	MaxReadAhead         uint32
	Flags                uint32 // mask of const InitFlags* bits
	MaxBackground        uint16
	CongestionThreshhold uint16
	MaxWrite             uint32
	TimeGran             uint32
	MaxPages             uint16
	MapAlignment         uint16
	Flags2               uint32
	Unused               [7]uint32
}

type InitOut717

type InitOut717 struct {
	Major                uint32
	Minor                uint32
	MaxReadAhead         uint32
	Flags                uint32 // mask of const InitFlags* bits
	MaxBackground        uint16
	CongestionThreshhold uint16
	MaxWrite             uint32
}

type InitOut718Thru720

type InitOut718Thru720 struct {
	Major                uint32
	Minor                uint32
	MaxReadAhead         uint32
	Flags                uint32 // mask of const InitFlags* bits
	MaxBackground        uint16
	CongestionThreshhold uint16
	MaxWrite             uint32
	DevMajor             uint32
	DevMinor             uint32
	Spare                [10]uint32
}

type InitOut721Thru722

type InitOut721Thru722 struct {
	Major                uint32
	Minor                uint32
	MaxReadAhead         uint32
	Flags                uint32 // mask of const InitFlags* bits
	MaxBackground        uint16
	CongestionThreshhold uint16
	MaxWrite             uint32
}

type InitOut723Thru727

type InitOut723Thru727 struct {
	Major                uint32
	Minor                uint32
	MaxReadAhead         uint32
	Flags                uint32 // mask of const InitFlags* bits
	MaxBackground        uint16
	CongestionThreshhold uint16
	MaxWrite             uint32
	TimeGran             uint32
	Spare                [9]uint32
}

type InitOut728Thru731a

type InitOut728Thru731a struct {
	Major                uint32
	Minor                uint32
	MaxReadAhead         uint32
	Flags                uint32 // mask of const InitFlags* bits
	MaxBackground        uint16
	CongestionThreshhold uint16
	MaxWrite             uint32
	TimeGran             uint32
	MaxPages             uint16
	Padding              uint16
	Spare                [8]uint32
}

type InitOut731bThru735

type InitOut731bThru735 struct {
	Major                uint32
	Minor                uint32
	MaxReadAhead         uint32
	Flags                uint32 // mask of const InitFlags* bits
	MaxBackground        uint16
	CongestionThreshhold uint16
	MaxWrite             uint32
	TimeGran             uint32
	MaxPages             uint16
	MapAlignment         uint16
	Spare                [8]uint32
}

type InitOut736AndBeyond

type InitOut736AndBeyond struct {
	Major                uint32
	Minor                uint32
	MaxReadAhead         uint32
	Flags                uint32 // mask of const InitFlags* bits
	MaxBackground        uint16
	CongestionThreshhold uint16
	MaxWrite             uint32
	TimeGran             uint32
	MaxPages             uint16
	MapAlignment         uint16
	Flags2               uint32
	Unused               [7]uint32
}

type InterruptIn

type InterruptIn struct {
	Unique uint64
}

type IoCtlIn

type IoCtlIn struct {
	FH      uint64
	Flags   uint32
	Cmd     uint32
	Arg     uint64 // == a uintptr to InBuf
	InSize  uint32
	OutSize uint32
	InBuf   []byte // == nil if InSize == 0
}

type IoCtlOut

type IoCtlOut struct {
	Result  uint32
	Flags   uint32
	InIovs  uint32
	OutIovs uint32
	InIov   []IoctlIovec // len(IoIov) == InIovs
	OutIov  []IoctlIovec // len(OutIov) == OutIovs
}

type IoctlIovec

type IoctlIovec struct {
	Base uint64
	Len  uint64
}

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
}

type LSeekIn

type LSeekIn struct {
	FH      uint64
	Offset  uint64
	Whence  uint32
	Padding uint32
}

type LSeekOut

type LSeekOut struct {
	Offset uint64
}

type LinkIn

type LinkIn struct {
	OldNodeID uint64
	Name      []byte
}

type LinkOut

type LinkOut struct {
	EntryOut
}

type ListXAttrIn

type ListXAttrIn struct {
	Size    uint32 // == max len(ListXAttrOut.Name) with a '\0' between each Name element
	Padding uint32
}

type ListXAttrOut

type ListXAttrOut struct {
	Size    uint32   // only returned if ListXAttrIn.Size == 0... SUM(each Name + trailing '\0')
	Padding uint32   // only returned if ListXAttrIn.Size == 0
	Name    [][]byte // only returned if ListXAttrIn.Size != 0... each with trailing '\0'
}

type LookupIn

type LookupIn struct {
	Name []byte
}

type LookupOut

type LookupOut struct {
	EntryOut
}

type MkDirIn

type MkDirIn struct {
	Mode  uint32
	UMask uint32
	Name  []byte
}

type MkDirOut

type MkDirOut struct {
	EntryOut
}

type MkNodIn

type MkNodIn struct {
	Mode    uint32
	RDev    uint32
	UMask   uint32
	Padding uint32
	Name    []byte
}

type MkNodOut

type MkNodOut struct {
	EntryOut
}

type OpenDirIn

type OpenDirIn struct {
	Flags  uint32
	Unused uint32
}

type OpenDirOut

type OpenDirOut struct {
	FH        uint64
	OpenFlags uint32 // mask of const FOpen* bits
	Padding   uint32
}

type OpenIn

type OpenIn struct {
	Flags  uint32 // mask of const FOpenRequest* bits
	Unused uint32
}

type OpenOut

type OpenOut struct {
	FH        uint64
	OpenFlags uint32 // mask of const FOpenResponse* bits
	Padding   uint32
}

type OutHeader

type OutHeader struct {
	Len    uint32 // automatically computed; includes OutHeaderSize and any payload
	Error  int32
	Unique uint64
}

type PollIn

type PollIn struct {
	FH     uint64
	KH     uint64
	Flags  uint32
	Events uint32
}

type PollOut

type PollOut struct {
	REvents uint32
	Padding uint32
}

type ReadDirIn

type ReadDirIn struct {
	FH        uint64
	Offset    uint64
	Size      uint32
	ReadFlags uint32
	LockOwner uint64
	Flags     uint32
	Padding   uint32
}

type ReadDirOut

type ReadDirOut struct {
	DirEnt []DirEnt // aligned on DirEntAlignment boundaries
}

type ReadDirPlusIn

type ReadDirPlusIn struct {
	FH        uint64
	Offset    uint64
	Size      uint32
	ReadFlags uint32
	LockOwner uint64
	Flags     uint32
	Padding   uint32
}

type ReadDirPlusOut

type ReadDirPlusOut struct {
	DirEntPlus []DirEntPlus // aligned on DirEntAlignment boundaries
}

type ReadIn

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

type ReadLinkOut

type ReadLinkOut struct {
	Data []byte
}

type ReadOut

type ReadOut struct {
	Data []byte
}

type ReleaseDirIn

type ReleaseDirIn struct {
	FH           uint64
	Flags        uint32
	ReleaseFlags uint32
	LockOwner    uint64
}

type ReleaseIn

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

type RemoveXAttrIn

type RemoveXAttrIn struct {
	Name []byte
}

type Rename2In

type Rename2In struct {
	NewDir  uint64
	Flags   uint32
	Padding uint32
	OldName []byte
	NewName []byte // byte(0) separated from OldName
}

type RenameIn

type RenameIn struct {
	NewDir  uint64
	OldName []byte
	NewName []byte // byte(0) separated from OldName
}

type RmDirIn

type RmDirIn struct {
	Name []byte
}

type SetAttrIn

type SetAttrIn struct {
	Valid     uint32 // mask of const SetAttrInValid* bits
	Padding   uint32
	FH        uint64
	Size      uint64
	LockOwner uint64
	ATimeSec  uint64
	MTimeSec  uint64
	Unused2   uint64
	ATimeNSec uint32
	MTimeNSec uint32
	Unused3   uint32
	Mode      uint32
	Unused4   uint32
	UID       uint32
	GID       uint32
	Unused5   uint32
}

type SetAttrOut

type SetAttrOut struct {
	AttrValidSec  uint64
	AttrValidNSec uint32
	Dummy         uint32
	Attr
}

type SetLKIn

type SetLKIn struct {
	FH    uint64
	Owner uint64
	FileLock
	LKFlags uint32
	Padding uint32
}

type SetLKWIn

type SetLKWIn struct {
	FH    uint64
	Owner uint64
	FileLock
	LKFlags uint32
	Padding uint32
}

type SetXAttrIn

type SetXAttrIn struct {
	Size          uint32 // == len(Name) + 1 + len(Data)
	Flags         uint32 // if not 0, either of SetXAttrIn*
	SetXAttrFlags uint32
	Padding       uint32
	Name          []byte
	Data          []byte // byte(0) separated from Name
}

type StatFSOut

type StatFSOut struct {
	KStatFS
}

type SymLinkIn

type SymLinkIn struct {
	Name []byte
	Data []byte // byte(0) separated from Name
}

type SymLinkOut

type SymLinkOut struct {
	EntryOut
}

type UnlinkIn

type UnlinkIn struct {
	Name []byte
}

type Volume

type Volume interface {
	// DoMount is invoked on a Volume interface to perform the FUSE mount and
	// begin receiving the various callbacks listed in the Callbacks interface.
	//
	DoMount() (err error)

	// DoUnmount is invoked on a Volume interface to perform the FUSE unmount.
	// Upon return, no callbacks will be made and the Volume instance may be
	// safely discarded.
	//
	DoUnmount() (err error)
}

Volume represents a file system instance. A Volume is provisioned by calling NewVolume(). After recording the returned interface from NewVolume(), a single call to DoMount() kicks off the mounting process and the caller should expect to see the various callbacks listed in the Callbacks interface. This will continue a single call to DoUnmount() is made after which the Volume instance may be safely discarded.

func NewVolume

func NewVolume(volumeName string, mountpointDirPath string, fuseSubtype string, maxRead uint32, maxWrite uint32, defaultPermissions bool, allowOther bool, callbacks Callbacks, logger *log.Logger, errChan chan error) (volume Volume)

NewVolume is called to create a Volume instance. Various callbacks listed in the Callbacks interface will be made while the Volume is mounted. The type of the file system, once mounted, will be "fuse" and, if non-empty, followed by a "." and the fuseSubtype (if supported... as it is on Linux). Non-root users may want to specify allowOther as TRUE to enable other non-root users access to the mount point. A chan error is also supplied to enable the Volume to indicate that it is no longer servicing FUSE upcalls (e.g. as a result of an intentional DoUnmount() call or some unexpected error reading from /dev/fuse).

type WriteIn

type WriteIn struct {
	FH         uint64
	Offset     uint64
	Size       uint32
	WriteFlags uint32
	LockOwner  uint64
	Flags      uint32
	Padding    uint32
	Data       []byte
}

type WriteOut

type WriteOut struct {
	Size    uint32
	Padding uint32
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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