Documentation ¶
Index ¶
- Constants
- type AccessIn
- type Attr
- type BMapIn
- type BMapOut
- type BatchForgetIn
- type Callbacks
- type CreateIn
- type CreateOut
- type DirEnt
- type DirEntPlus
- type EntryOut
- type FAllocateIn
- type FSyncDirIn
- type FSyncIn
- type FileLock
- type FlushIn
- type ForgetIn
- type ForgetOne
- type GetAttrIn
- type GetAttrOut
- type GetLKIn
- type GetLKOut
- type GetXAttrIn
- type GetXAttrOut
- type InHeader
- type InitIn
- type InitOut
- type InterruptIn
- type IoCtlIn
- type IoCtlOut
- type IoctlIovec
- type KStatFS
- type LSeekIn
- type LSeekOut
- type LinkIn
- type LinkOut
- type ListXAttrIn
- type ListXAttrOut
- type LookupIn
- type LookupOut
- type MkDirIn
- type MkDirOut
- type MkNodIn
- type MkNodOut
- type OpenDirIn
- type OpenDirOut
- type OpenIn
- type OpenOut
- type OutHeader
- type PollIn
- type PollOut
- type ReadDirIn
- type ReadDirOut
- type ReadDirPlusIn
- type ReadDirPlusOut
- type ReadIn
- type ReadLinkOut
- type ReadOut
- type ReleaseDirIn
- type ReleaseIn
- type RemoveXAttrIn
- type Rename2In
- type RenameIn
- type RmDirIn
- type SetAttrIn
- type SetAttrOut
- type SetLKIn
- type SetLKWIn
- type SetXAttrIn
- type StatFSOut
- type SymLinkIn
- type SymLinkOut
- type UnlinkIn
- type Volume
- type WriteIn
- type WriteOut
Constants ¶
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 SetAttrInValidCrTime = uint32(1) << 28 // darwin only SetAttrInValidChgTime = uint32(1) << 29 // darwin only SetAttrInValidBkupTime = uint32(1) << 30 // darwin only SetAttrInValidFlags = uint32(1) << 31 // darwin only )
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) )
const ( FOpenResponseDirectIO = uint32(1) << 0 FOpenResponseKeepCache = uint32(1) << 1 FOpenResponseNonSeekable = uint32(1) << 2 FOpenResponseCacheDir = uint32(1) << 3 FOpenResponseStream = uint32(1) << 4 )
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 InitFlagsCaseSensitive = uint32(1) << 29 // darwin only InitFlagsVolRename = uint32(1) << 30 // darwin only InitFlagsXtimes = uint32(1) << 31 // darwin only )
const ( ReleaseFlush = uint32(1) << iota ReleaseFLockUnlock )
const ( WriteCache = uint32(1) << iota WriteLockOwner WriteKillPriv )
const ( IoctlCompat = uint32(1) << iota IoctlUnrestricted IoctlRetry Ioctl32Bit IoctlDir IoctlCompatX32 )
const ( NofifyPoll = iota + 1 NotifyInvalInode NotifyInvalEntry NotifyStore NotifyRetrieve NotifyDelete NotifyCodeMax )
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 OpCodeCuseInit = uint32(4096) // unsupported )
const AccessInSize = 8
const AttrSize = 88
const BMapInSize = 16
const BMapOutSize = 8
const BatchForgetInFixedPortionSize = 8 // + (Count * ForgetOneSize)
const CreateInFixedPortionSize = 16 // + len(Name)
const CreateOutSize = EntryOutSize + 16
const DirEntAlignment = 8 // applies to both DirEnt and DirEntPlus
const DirEntFixedPortionSize = 24 // + len(Name) and rounded up to DirEntAlignment boundary
const DirEntPlusFixedPortionSize = EntryOutSize + DirEntFixedPortionSize // + len(DirEnt.Name) and rounded up to DirEntAlignment boundary
const EntryOutSize = 40 + AttrSize
const FAllocateInSize = 32
const FSyncDirInSize = 16
const (
FSyncFDataSync = uint32(1) << iota
)
const FSyncInSize = 16
const FileLockSize = 24
const FlushInSize = 24
const ForgetInSize = 8
const ForgetOneSize = 16
const (
GetAttrFH uint32 = uint32(1) << iota
)
const GetAttrInSize = 16
const GetAttrOutSize = 16 + AttrSize
const GetLKInSize = 16 + FileLockSize + 8
const GetLKOutSize = FileLockSize
const GetXAttrInFixedPortionSize = 8 // + len(Name)
const GetXAttrOutSizeOnlySize = 8
const InHeaderSize = 40
const InitInSize = 16
const InitOutSize = 24
const InterruptInSize = 8
const IoCtlInFixedPortionSize = 32 // + len(InBuf) a.k.a. InSize
const IoCtlOutFixedPortionSize = 16 // + (InIovs * IoctlIovecSize) + (OutIovs * IoctlIovecSize)
const IoctlIovecSize = 16
const IoctlMaxIOV = 256
const KStatFSSize = 80
const (
LKFLock uint32 = uint32(1) << iota
)
const LSeekInSize = 24
const LSeekOutSize = 8
const LinkInFixedPortionSize = 8 // + len(Name)
const LinkOutSize = EntryOutSize
const ListXAttrInSize = 8
const ListXAttrOutSizeOnlySize = 8
const LookupOutSize = EntryOutSize
const MkDirInFixedPortionSize = 8 // + len(Name)
const MkDirOutSize = EntryOutSize
const MkNodInFixedPortionSize = 16 // + len(Name)
const MkNodOutSize = EntryOutSize
const OpenDirInSize = 8
const OpenDirOutSize = 16
const OpenInSize = 8
const OpenOutSize = 16
const OutHeaderSize = 16
const PollInSize = 24
const PollOutSize = 8
const (
PollScheduleNotify = uint32(1) << iota
)
const ReadDirInSize = 40
const ReadDirPlusInSize = 40
const ReadInSize = 40
const (
ReadLockOwner = uint32(1) << (iota + 1)
)
const ReleaseDirInSize = 24
const ReleaseInSize = 24
const Rename2InFixedPortionSize = 16 // + len(OldName) + 1 + len(NewName)
const RenameInFixedPortionSize = 8 // + len(OldName) + 1 + len(NewName)
const SetAttrInSize = 88
const SetAttrOutSize = 16 + AttrSize
const SetLKInSize = 16 + FileLockSize + 8
const SetLKWInSize = 16 + FileLockSize + 8
const SetXAttrInFixedPortionSize = 8 // + len(Name) + 1 + len(Data)
const StatFSOutSize = KStatFSSize
const SymLinkOutSize = EntryOutSize
const WriteInFixedPortionSize = 40 // + len(Data) a.k.a. Size
const WriteOutSize = 8
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchForgetIn ¶
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 DirEntPlus ¶
type FAllocateIn ¶
type FSyncDirIn ¶
type GetAttrOut ¶
type GetXAttrIn ¶
type GetXAttrOut ¶
type InterruptIn ¶
type InterruptIn struct {
Unique uint64
}
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 ListXAttrIn ¶
type ListXAttrOut ¶
type OpenDirOut ¶
type ReadDirOut ¶
type ReadDirOut struct {
DirEnt []DirEnt // aligned on DirEntAlignment boundaries
}
type ReadDirPlusIn ¶
type ReadDirPlusOut ¶
type ReadDirPlusOut struct {
DirEntPlus []DirEntPlus // aligned on DirEntAlignment boundaries
}
type ReadLinkOut ¶
type ReadLinkOut struct {
Data []byte
}
type ReleaseDirIn ¶
type RemoveXAttrIn ¶
type RemoveXAttrIn struct {
Name []byte
}
type SetAttrOut ¶
type SetXAttrIn ¶
type SymLinkOut ¶
type SymLinkOut struct {
EntryOut
}
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, initOutMaxWrite uint32, 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. 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).