fine

package
v0.0.0-...-d39c007 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package fine implements FUSE with network-layer support. FINE stands for "FIlesystem over NEtwork." It's not a perfect translation of FUSE, but it's... FINE.

fine can be used with any kind of transport. Supported transports are the Linux kernel (via `/dev/fuse`) or gRPC. See the fuse and finegrpc packages respectively. Non-Linux kernel transports (BSD, macOS) are not supported.

fine is a subset of FUSE, though most basic operations are available.

fine was initially written against FUSE 7.31.

Index

Constants

View Source
const (
	ErrorNotPermitted     = Error(-0x01) // EPERM
	ErrorNotExist         = Error(-0x02) // ENOENT
	ErrorInterrupted      = Error(-0x04) // EINTR
	ErrorIO               = Error(-0x05) // EIO
	ErrorTooManyArguments = Error(-0x07) // E2BIG
	ErrorUnavailable      = Error(-0x0b) // EAGAIN
	ErrorNoMemory         = Error(-0x0c) // ENOMEM
	ErrorUnauthorized     = Error(-0x0d) // EACCES
	ErrorExists           = Error(-0x11) // EEXIST
	ErrorBadCrossLink     = Error(-0x12) // EXDEV
	ErrorNoDevice         = Error(-0x13) // ENODEV
	ErrorInvalid          = Error(-0x16) // EINVAL
	ErrorBadIoctl         = Error(-0x19) // ENOTTY
	ErrorNoLock           = Error(-0x25) // ENOLCK
	ErrorUnimplemented    = Error(-0x26) // ENOSYS
	ErrorAborted          = Error(-0x67) // ECONNABORTED
	ErrorStale            = Error(-0x74) // ESTALE
)

Common error codes. Custom error codes may be used as long as their value is negative and represents a standard POSIX error (i.e., -syscall.ENOTSUP). Error codes must be understanable by Linux and necessarily have the same representation on the host machine.

View Source
const (
	EntryUnknown    EntryType = 0x0 // Entry type isn't known
	EntryPipe       EntryType = 0x1 // Entry is a named FIFO pipe
	EntryCharacter  EntryType = 0x2 // Entry is a character device
	EntryDirectory  EntryType = 0x4 // Entry is another directory
	EntryBlock      EntryType = 0x6 // Entry is a block device
	EntryRegular    EntryType = 0x8 // Entry is a regular file
	EntryLink       EntryType = 0xa // Entry is a symbolic link
	EntryUnixSocket EntryType = 0xc // Entry is a UNIX domain socket
	EntryWhiteout   EntryType = 0xe // Entry is a BSD whiteout

	LockTypeRead   LockType = 0x0 // Read lock
	LockTypeWrite  LockType = 0x1 // Write lock
	LockTypeUnlock LockType = 0x2 // Used to release locks
)

Enum values.

View Source
const (
	// GetAttribFlagHandle request attributes for a handle instead of the node.
	GetAttribFlagHandle GetAttribFlags = (1 << 0)

	AttribMaskMode          AttribMask = 1 << 0  // The Mode field can be used
	AttribMaskUID           AttribMask = 1 << 1  // The UID field can be used
	AttribMaskGID           AttribMask = 1 << 2  // The GID field can be used
	AttribMaskSize          AttribMask = 1 << 3  // The Size field can be used
	AttribMaskLastAccess    AttribMask = 1 << 4  // The LastAccess field can be used
	AttribMaskLastModify    AttribMask = 1 << 5  // The LastModify field can be used
	AttribMaskFileHandle    AttribMask = 1 << 6  // The FileHandle field can be used
	AttribMaskLastAccessNow AttribMask = 1 << 7  // Update LastAccess to the current time
	AttribMaskLastModifyNow AttribMask = 1 << 8  // Update LastModify to the current time
	AttribMaskLockOwner     AttribMask = 1 << 9  // The LockOwner field can be used
	AttribMaskLastChange    AttribMask = 1 << 10 // The LastChange field can be used

	OpenReadOnly  FileFlags = 0x0 // Open the file for reading.
	OpenWriteOnly FileFlags = 0x1 // Open the file for writing.
	OpenReadWrite FileFlags = 0x2 // Open the file for reading and writing.
	OpenAccesMode FileFlags = 0x3 // Open the file to get access mode bits.

	OpenCreate    FileFlags = 0x40     // Create the file if it doesn't exist.
	OpenExclusive FileFlags = 0x80     // Open the file with an exclusive lock.
	OpenTruncate  FileFlags = 0x200    // Truncate file contents before opening for writing
	OpenAppend    FileFlags = 0x400    // Open with the file seeked to the end.
	OpenNonblock  FileFlags = 0x800    // Enable non-blocking IO against the open file.
	OpenDirectory FileFlags = 0x10000  // Open the file as a directory.
	OpenSync      FileFlags = 0x101000 // Enable synchronous writes

	OpenedDirectIO    OpenedFlags = 1 << 0 // Page cache should be bypassed when writing
	OpenedKeepCache   OpenedFlags = 1 << 1 // Existing page cache should be kept intact
	OpenedNonSeekable OpenedFlags = 1 << 2 // File does not support seeking
	OpenedCacheDir    OpenedFlags = 1 << 3 // Allow caching directory
	OpenedStream      OpenedFlags = 1 << 4 // The file is stream-like (it has no position)

	ReadLockOwner ReadFlags = 1 << 1 // Use LockOwner to check exclusive lock

	WriteCache     WriteFlags = 1 << 0 // Delayed write from cache
	WriteLockOwner WriteFlags = 1 << 1 // Lock owner field may be used for validating lock
	WriteKillPriv  WriteFlags = 1 << 2 // Kill suid and gid bits

	ReleaseFlush  ReleaseFlags = 1 << 0 // Flush the file after releasing
	ReleaseUnlock ReleaseFlags = 1 << 1 // Remove the lock after releasing

	SyncDataOnly SyncFlags = 1 << 0 // Only sync data, not file metadata

	ExtendedAttribCreate ExtendedAttribFlags = 0x1 // Fail if the attrib already exists
	ExtendedAttribReplce ExtendedAttribFlags = 0x2 // Fail if the attrib doesn't already exist

	InitAsyncRead               InitFlags = 1 << 0  // Use asynchronous read requests
	InitPOSIXLocks              InitFlags = 1 << 1  // Use POSIX file locks
	InitFileOps                 InitFlags = 1 << 2  // Kernel sends a file handle
	InitAtomicTruncate          InitFlags = 1 << 3  // OpenTruncate is handled in the filesystem
	InitExportSupport           InitFlags = 1 << 4  // Filesystem can handle "." and ".."
	InitBigWrites               InitFlags = 1 << 5  // Filesystem can handle writes larger than 4K
	InitNoUmask                 InitFlags = 1 << 6  // Don't apply Umask to file mode on create operations
	InitSpliceWrite             InitFlags = 1 << 7  // Kernel supports splice write on the device
	InitSpliceMove              InitFlags = 1 << 8  // Kernel supports splice move on the device
	InitSpliceRead              InitFlags = 1 << 9  // Kernel supports splice read on the device
	InitBSDLocks                InitFlags = 1 << 10 // Use BSD style locks
	InitDirIoctl                InitFlags = 1 << 11 // Kernel supports running ioctl on directories
	InitAutoInvalidateCache     InitFlags = 1 << 12 // Automatically invalidate cached pages
	InitUseReadDirPlus          InitFlags = 1 << 13 // Use ReadDirPlus instead of ReadDir
	InitAdaptiveReadDirPlus     InitFlags = 1 << 14 // Adaptive ReadDirPlus
	InitAsyncDIO                InitFlags = 1 << 15 // Asynchronous direct I/O submission
	InitWritebackCache          InitFlags = 1 << 16 // Use writeback cache for buffered writes
	InitZeroOpenSupport         InitFlags = 1 << 17 // Kernel supports zero-message opens
	InitParallelDirOps          InitFlags = 1 << 18 // Allow parallel operations on directories
	InitHandleKillpriv          InitFlags = 1 << 19 // Filesystem will kill suid/sgid/cap on write/chown/trunc
	InitACLSupportPOSIX         InitFlags = 1 << 20 // Filesystem has support for POSIX ACLs
	InitAbortError              InitFlags = 1 << 21 // Reading the device after abort will return ErrorAborted
	InitMaxPages                InitFlags = 1 << 22 // Set max pages on the init response
	InitCacheSymlinks           InitFlags = 1 << 23 // Cache respones for symblic links
	InitZeroOpenDirSupport      InitFlags = 1 << 24 // Kernel supports zero-message open directory
	InitExplicitCacheInvalidate InitFlags = 1 << 25 // Only invalidated caches after explicitly requested
	InitMapAlignment            InitFlags = 1 << 26 // Read MapAlignment field from init response

	LockFlock LockFlags = 1 << 0 // BSD-style lock

	DeviceControlCompat       DeviceControlFlags = 1 << 0 // 32-bit compatible ioctl
	DeviceControlUnrestricted DeviceControlFlags = 1 << 1 // Allow retries
	DeviceControlRetry        DeviceControlFlags = 1 << 2 // Request should be retried
	DeviceControlBitSize32    DeviceControlFlags = 1 << 3 // Use 32bit ioctl
	DeviceControlDirectory    DeviceControlFlags = 1 << 4 // ioctl on a directory
	DeviceControlX32Compat    DeviceControlFlags = 1 << 5 // x32 ioctl on 64bit machine (64bit time_t)

	PollScheduleNotify PollFlags = 1 << 0 // Request poll notify

	PollEventsIn             PollEvents = 0x0001 // Data is available for reading
	PollEventsPriority       PollEvents = 0x0002 // There is an exceptional condition on the file
	PollEventsOut            PollEvents = 0x0004 // Writing is now possible
	PollEventsError          PollEvents = 0x0008 // Some returned error condition
	PollEventsHangup         PollEvents = 0x0010 // Peer closed connection
	PollEventsInvalid        PollEvents = 0x0020 // Invalid request
	PollEventsReadNormal     PollEvents = 0x0040 // There is data to read
	PollEventsReadOutOfBand  PollEvents = 0x0080 // Out of band data can be read
	PollEventsWriteNormal    PollEvents = 0x0100 // Writing is now possible
	PollEventsWriteOutOfBand PollEvents = 0x0200 // Out of band data can be written
	PollEventsReadHangup     PollEvents = 0x2000 // Stream socket peer closed connection
	DefaultPollMask          PollEvents = PollEventsIn | PollEventsOut | PollEventsReadNormal | PollEventsWriteNormal

	RenameAtomic    RenameFlags = 0 // Atomically exchange the old and new file
	RenameNoReplace RenameFlags = 0 // Don't overwrite NewName if it already exists
	RenameWhiteout  RenameFlags = 0 // Create a whiteout object at the source.

	CUSEUnrestrictedIoctl CUSEInitFlags = 1 << 0 // Use unrestricted ioctl
)

Monolith of available flag options.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessRequest

type AccessRequest struct {
	Mask os.FileMode // Validate access for mask
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type AttrResponse

type AttrResponse struct {
	TTL    time.Duration // Cache validility of the attributes.
	Attrib Attrib        // Attribute data
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type Attrib

type Attrib struct {
	Inode      uint64      // Real inode number.
	Size       uint64      // Size in bytes.
	Blocks     uint64      // Size in blocks (512-byte units).
	LastAccess time.Time   // Last time file was accessed.
	LastModify time.Time   // Last time contents were modified
	LastChange time.Time   // Last time inode was updated.
	Mode       os.FileMode // File permissions.
	HardLinks  uint32      // Number of hard links to the file (usually 1)
	UID        uint32      // Owner UID
	GID        uint32      // Owner GID
	RDev       uint32      // Device ID (if special file)
	BlockSize  uint32      // Block size for filesystem i/O
}

Attrib are the set of attributes for a Node.

type AttribMask

type AttribMask uint32

AttribMask is used when setting file attributes to mark which fields from the request can be used.

type BatchForgetItem

type BatchForgetItem struct {
	Node       Node
	NumLookups uint64
}

Common data types. Common data types represent entities in a filesystem and are communicated over the protocol as part of messages.

type BatchForgetRequest

type BatchForgetRequest struct {
	Items []BatchForgetItem
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type CUSEInitFlags

type CUSEInitFlags uint32

CUSEInitFlags are used during a CUSE init.

type CreateRequest

type CreateRequest struct {
	Flags FileFlags   // Flags for creation
	Mode  os.FileMode // File mode
	Umask os.FileMode // Umask for file
	Name  string      // Name of file to create
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type CreateResponse

type CreateResponse struct {
	Handle      Handle      // Handle to newly created node
	OpenedFlags OpenedFlags // Flags used for the create
	Entry       Entry       // Created node entry
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type DeviceControlFlags

type DeviceControlFlags uint32

DeviceControlFlags change the behavior of ioctl.

type DirEntry

type DirEntry struct {
	Inode uint64
	Type  EntryType
	Name  string
}

DirEntry is a directory entry returned during ReadDir.

type DirPlusEntry

type DirPlusEntry struct {
	Entry    Entry
	DirEntry DirEntry
}

DirPlusEntry is returned as part of a ReadDirPlus operation.

type Entry

type Entry struct {
	Node       Node          // Node ID.
	Generation uint64        // Generation of Node. Increase whenever Node value wraps around to 0.
	EntryTTL   time.Duration // Cache validility of this Node.
	AttribTTL  time.Duration // Cache validility of this Node's attributes.
	Attrib     Attrib        // Attributes for the Node.
}

Entry is a description of a file.

type EntryResponse

type EntryResponse struct {
	Entry Entry
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type EntryType

type EntryType uint32

EntryType specifies the type of a file in a directory.

type Error

type Error int32

Error is a FUSE error code. FUSE accepts POSIX error codes that are inverted to be negative (i.e., -syscall.ENOTSUP).

The most common codes are re-defined here for cross-platform compatbility.

func (Error) Error

func (e Error) Error() string

Error prints the description of the error.

type ExtendedAttribFlags

type ExtendedAttribFlags uint32

ExtendedAttribFlags controls setting an extended attribute.

type FileFlags

type FileFlags uint32

Flags used for interacting with a node.

type FlushRequest

type FlushRequest struct {
	Handle    Handle
	LockOwner LockOwner
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type ForgetRequest

type ForgetRequest struct {
	NumLookups uint64
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type FsyncRequest

type FsyncRequest struct {
	Handle Handle
	Flags  SyncFlags
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type GetAttribFlags

type GetAttribFlags uint32

GetAttribFlags is a bitmask of flags for GetAttribRequest.

type GetattrRequest

type GetattrRequest struct {
	Flags  GetAttribFlags
	Handle Handle
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type Handle

type Handle uint64

Handle is a specific handle for a Node. Handles must have unique IDs for the lifetime of the handle. Handle IDs may be reassigned to other Nodes once the handle is released.

type InitFlags

type InitFlags uint32

Flags used during an init.

type InitRequest

type InitRequest struct {
	LatestVersion Version   // LatestVersion supported by the driver
	MaxReadahead  uint32    // Length of data that can be prefetched
	Flags         InitFlags // Flags for the init
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type InitResponse

type InitResponse struct {
	EarliestVersion     Version   // Earliest version supported by the filesystem
	MaxReadahead        uint32    // Length of data that can be prefetched
	Flags               InitFlags // Response init flags
	MaxBackground       uint16    // Maximum number of background requests that can be generated
	CongestionThreshold uint16    // Slow down if parallel requests go beyond this number
	MaxWrite            uint32    // Maximum size of the write buffer
	TimeGran            uint32    // Granularity supported for access/modify/create time of files
	MaxPages            uint16    // Pages to map to the filesystem
	MapAlignment        uint16
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type InterruptRequest

type InterruptRequest struct {
	RequestID uint64 // Request to interrupt
}

InterruptRequest interrupts an ongoing request. The interupted request should return with ErrorInterrupted. Handler implementations may ignore the context cancelation that comes from an interrupt.

type LinkRequest

type LinkRequest struct {
	OldNode Node
	NewName string
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type Lock

type Lock struct {
	Start uint64   // Absolute starting byte offset to lock.
	End   uint64   // Last byte offset to lock. Zero means to lock entire file past start.
	Type  LockType // Type of lock.
	PID   uint32   // PID of holding process
}

Lock is a POSIX advisory lock.

type LockFlags

type LockFlags uint32

LockFlags control how a lock is created.

type LockOwner

type LockOwner uint64

LockOwner is an opaque ID that references an owner of a file lock.

type LockType

type LockType uint32

LockType indicates the type of file lock.

type LookupRequest

type LookupRequest struct {
	Name string
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type LseekRequest

type LseekRequest struct {
	Handle Handle // Handle to seek in
	Offset uint64 // Offset to seek to, relative to whence
	Whence uint32 // Either seek relative to beginning, current position, or end.
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type LseekResponse

type LseekResponse struct {
	Offset uint64 // New offset in the file
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type MkdirRequest

type MkdirRequest struct {
	Mode  os.FileMode
	Umask os.FileMode
	Name  string
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type MknodRequest

type MknodRequest struct {
	Mode     os.FileMode // Permissions for the file
	DeviceID uint32      // Device ID for the special file
	Umask    os.FileMode // Umask of the request
	Name     string      // Name of the file
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type Node

type Node uint64

Node is an ID representing a file. 0 is never a valid reference. 1 will always refer to the root filesystem of the driver, and is always assumed to exist by both sides of the peer connection.

var (
	// MinVersion supported by the package. Earlier versions may be supported, but
	// are not tested to work.
	MinVersion = Version{Major: 7, Minor: 31}

	// RootNode represents the root filesystem. It always has inode ID 1.
	RootNode Node = Node(1)
)

type Op

type Op uint32

Op uniquely identifies a protocol message type. Every protocol message has a unique Op and, if supported by the package, an associated Request and Response struct. Some Ops only have requests and no respones.

const (
	// OpInvalid represents an invalid Op. It should never be generated by
	// libraries.
	OpInvalid Op = 0
	// OpLookup requests node information for a named file relative to a
	// directory node.
	OpLookup Op = 1
	// OpForget informs the FINE driver that the peer is releasing its knowledge
	// of a Node ID.
	OpForget Op = 2
	// OpGetattr returns attributes for a specific node ID or handle, depending
	// on flags.
	OpGetattr Op = 3
	// OpSetattr sets attributes for a specific node ID or handle, depending on
	// flags.
	OpSetattr Op = 4
	// OpReadlink returns the data of a symbolic link for a node ID.
	OpReadlink Op = 5
	// OpSymlink creates a new symbolic link relative to a directory node.
	OpSymlink Op = 6
	// OpMknod makes a new device file relative to a directory node.
	OpMknod Op = 8
	// OpMkdir creates a new directory relative to a directory of a given node
	// ID.
	OpMkdir Op = 9
	// OpUnlink removes a named file relative to a directory of a given node ID.
	OpUnlink Op = 10
	// OpRmdir removes a named directory relative to the directory of a given
	// node ID.
	OpRmdir Op = 11
	// OpRename renames a node relative to a directory to another directory
	// (which can be the same) and giving it a new name. OpRename can be
	// considered more of a "move" than a rename.
	OpRename Op = 12
	// OpLink creates a hard link to a file. The hard link is created relative to
	// a known directory but can reference any known ID.
	OpLink Op = 13
	// OpOpen opens a known node and returns a handle to it. If OpOpen isn't
	// handled, the Linux kernel will use node IDs for file operations instead of
	// handles.
	OpOpen Op = 14
	// OpRead reads data from a file handle.
	OpRead Op = 15
	// OpWrite writes data to a file handle.
	OpWrite Op = 16
	// OpRelease closes an open file handle. OpRelease may be left unhandled.
	OpRelease Op = 18
	// OpFsync performs an fsync on a file handle. OpFsync may be left
	// unhandled.
	OpFsync Op = 20
	// OpFlush is called every time a file is closed, and can be used to flush
	// cached data. OpFlush should be handled as it a failure results in a error
	// when closing a file, but it is safe to implement as a no-op.
	//
	// Note that OpFlush is not the same as OpFileSync or OpDirSync.
	OpFlush Op = 25
	// OpInit is called when initiating the filesystem.
	OpInit Op = 26
	// OpOpendir opens a directory file relative to a known directory, returning
	// a handle. If OpOpendir is left unhandled, node IDs will be used for
	// reading directories instead of files.
	OpOpendir Op = 27
	// OpReaddir reads the entries of a directory hadirectory file relative to an ndle.
	OpReaddir Op = 28
	// OpReleasedir releases a directory handle. OpReleasedir may be left unhandled.
	OpReleasedir Op = 29
	// OpFsyncDir performs an fsync against a directory handle. OpFsyncDir may be
	// left unhandled.
	OpFsyncDir Op = 30
	// OpAccess should check if a specific file can be accessed. If this is
	// not handled, FUSE should be mounted with `default_permissions` so the
	// kernel will enforce its own permissions.
	OpAccess Op = 34
	// OpCreate creates a new file and returns a handle to it. If OpCreate is not
	// handled, OpMknod will be used instead to make files.
	OpCreate Op = 35
	// OpInterrupt informs the peer that it should stop processing a previous
	// request.
	OpInterrupt Op = 36
	// OpDestroy is called when the filesystem is shutting down.
	OpDestroy Op = 38
	// OpBatchForget batch forgets node handles.
	OpBatchForget Op = 42
	// OpLseek seeks to a location in a file handle.
	OpLseek Op = 46
)

All known opcodes. Opcodes are described roughly here. See the documentation on relevant Request and Response types for more information.

Many Ops are "relative to a directory node," which means the directory that a specific request occurs in. Node IDs used for the directories in a request must be known ahead of time, usually by calling OpLookup for existing directories.

const (
	// OpStatfs returns stats for a filesystem at a known directory.
	OpStatfs Op = 17
	// OpSetxattr sets extended attributes on a file.
	OpSetxattr Op = 21
	// OpGetxattr gets a specific extended attribute from a file.
	OpGetxattr Op = 22
	// OpListxattr returns all extended attribute names from a file.
	OpListxattr Op = 23
	// OpRemovexattr removes an extended attribute name from a file.
	OpRemovexattr Op = 24
	// OpGetLock should return a BSD- or POSIX-style lock on a file. OpGetLock
	// may be left unhandled.
	OpGetLock Op = 31
	// OpSetLock should create a BSD- or POSIX-style lock on a file. OpSetLock
	// may be left unhandled.
	OpSetLock Op = 32
	// OpSetLockWait should create a BSD- or POSIX-style lock on a file, waiting
	// until the lock is obtained. OpSetLockWait may be left unhandled.
	OpSetLockWait Op = 33
	// OpBmap finds an absolute disk block number relative to the location
	// of a specific node.
	OpBmap Op = 37
	// OpIoctl performs an ioctl.
	OpIoctl Op = 39
	// OpPoll polls a a file handle for changes.
	OpPoll Op = 40
	// OpNotifyReply is used to reply to a notification.
	OpNotifyReply Op = 41
	// OpFallocate can allocate data for a file handle.
	OpFallocate Op = 43
	// OpReaddirplus reads directory entries along with their attributes.
	OpReaddirplus Op = 44
	// OpRename2 performs a rename but optionally includes flags.
	OpRename2 Op = 45
	// OpCopyFileRange copies file ranges between two file handles.
	OpCopyFileRange Op = 47
	// OpSetupMapping is unused in FUSE 7.31.
	OpSetupMapping Op = 48
	// OpRemoveMapping is unused in FUSE 7.31.
	OpRemoveMapping Op = 49
	// OpCUSEInit initializes CUSE.
	OpCUSEInit = 4096
)

Opcodes that are known to exist but are unimplemented

func (Op) String

func (o Op) String() string

String returns a friendly name for Op.

type OpenRequest

type OpenRequest struct {
	Flags FileFlags
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type OpenedFlags

type OpenedFlags uint32

Flags returned for an opened file.

type OpenedResponse

type OpenedResponse struct {
	Handle      Handle
	OpenedFlags OpenedFlags
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type PollEvents

type PollEvents uint32

PollEvents are poll flags for events to request.

type PollFlags

type PollFlags uint32

PollFlags modify the behavior of a poll.

type ReadFlags

type ReadFlags uint32

ReadFlags are used to customize a ReadRequest.

type ReadRequest

type ReadRequest struct {
	Handle    Handle
	Offset    uint64
	Size      uint32
	Flags     ReadFlags
	LockOwner LockOwner
	FileFlags FileFlags
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type ReadResponse

type ReadResponse struct {
	Data []byte
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type ReaddirResponse

type ReaddirResponse struct {
	Entries []DirEntry
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type ReadlinkResponse

type ReadlinkResponse struct {
	Contents []byte // Contents of the link, up to the page size.
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type ReleaseFlags

type ReleaseFlags uint32

ReleaseFlags customize a lock release.

type ReleaseRequest

type ReleaseRequest struct {
	Handle    Handle
	Flags     ReleaseFlags
	FileFlags FileFlags
	LockOwner LockOwner
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type RenameFlags

type RenameFlags uint32

RenameFlags is used during an extended rename to control its behavior.

type RenameRequest

type RenameRequest struct {
	NewDir           Node
	OldName, NewName string
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type Request

type Request interface {
	// contains filtered or unexported methods
}

Request is used for protocol request messages which are sent by a kernel to the filesystem driver.

func NewEmptyRequest

func NewEmptyRequest(o Op) (Request, error)

NewEmptyRequest creates a new, empty request object for o. This is useful for writing custom codecs.

NewEmptyRequest may return ErrorUnimplemented for unsupported ops.

type RequestHeader

type RequestHeader struct {
	Op        Op     // Op representing the request.
	RequestID uint64 // Response must match this value.
	Node      Node   // Node the request is for.
	UID       uint32 // UID of requesting user.
	GID       uint32 // GID of requesting user.
	PID       uint32 // PID of requesting user.
}

RequestHeader is present in every request.

type Response

type Response interface {
	// contains filtered or unexported methods
}

Response is used for protocol response message types which are sent from the filesystem driver after processing a request.

func NewEmptyResponse

func NewEmptyResponse(o Op) (Response, error)

NewEmptyResponse creates a new, empty response object for o. This is useful for writing custom codecs.

NewEmptyResponse may return ErrorUnimplemented for unsupported ops or ops that do not have responses.

type ResponseHeader

type ResponseHeader struct {
	Op        Op     // Op representing the response. Must match Op from request.
	RequestID uint64 // Request for which this response applies to.
	Error     Error
}

ResponseHeader is present in every response.

type RmdirRequest

type RmdirRequest struct {
	Name string
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type SetattrRequest

type SetattrRequest struct {
	UpdateMask AttribMask  // Mask indicating which fields to use for the update.
	Handle     Handle      // Handle to set attributes for.
	Size       uint64      // File size.
	LockOwner  LockOwner   // Owner of a lock.
	LastAccess time.Time   // Last time file was accessed.
	LastModify time.Time   // Last time file was modified.
	LastChange time.Time   // Last time file was updated.
	Mode       os.FileMode // File permissions.
	UID        uint32      // Owner UID
	GID        uint32      // Owner GID
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type SymlinkRequest

type SymlinkRequest struct {
	Source   string // File being created
	LinkName string // File being linked to
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type SyncFlags

type SyncFlags uint32

SyncFlags controls a file sync.

type Transport

type Transport interface {
	// RecvRequest will get the next request from the other side of the
	// connection. There will always be a request header, but some operations may
	// have empty (nil) requests.
	RecvRequest() (RequestHeader, Request, error)

	// SendResponse sends r to the other side of the connection. There must
	// always be a response header, but some operations do not have responses.
	SendResponse(h ResponseHeader, r Response) error

	// Close the connection.
	Close() error
}

Transports are used to transmit FINE protocol messages. See subpackages for available transports.

type UnlinkRequest

type UnlinkRequest struct {
	Name string
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type Version

type Version struct{ Major, Minor uint32 }

Version of the protocol.

func (Version) String

func (v Version) String() string

String implements fmt.Stringer.

type WriteFlags

type WriteFlags uint32

WriteFlags are used to customize a WriteRequest.

type WriteRequest

type WriteRequest struct {
	Handle    Handle     // Handle to write to
	Offset    uint64     // Offset in the handle to write
	Data      []byte     // Data to write
	Flags     WriteFlags // Flags for writing
	LockOwner LockOwner  // Owner of the write lock, if one exists.
	FileFlags FileFlags  // Permissions for writing
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

type WriteResponse

type WriteResponse struct {
	Written uint32 // Written bytes
}

Protocol types. Each type here is used as part of the request or response for a specific operation. Protocol types have associated opcodes, which can be retrieved by passing the types to GetOp.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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