README
¶
bazil.org/fuse -- Filesystems in Go
bazil.org/fuse
is a Go library for writing FUSE userspace
filesystems.
It is a from-scratch implementation of the kernel-userspace
communication protocol, and does not use the C library from the
project called FUSE. bazil.org/fuse
embraces Go fully for safety and
ease of programming.
Here’s how to get going:
go get bazil.org/fuse
Website: http://bazil.org/fuse/
Github repository: https://github.com/bazillion/fuse
API docs: http://godoc.org/bazil.org/fuse
Our thanks to Russ Cox for his fuse library, which this project is based on.
Documentation
¶
Overview ¶
Package fuse enables writing FUSE file systems on Linux, OS X, and FreeBSD.
On OS X, it requires OSXFUSE (http://osxfuse.github.com/).
There are two approaches to writing a FUSE file system. The first is to speak the low-level message protocol, reading from a Conn using ReadRequest and writing using the various Respond methods. This approach is closest to the actual interaction with the kernel and can be the simplest one in contexts such as protocol translators.
Servers of synthesized file systems tend to share common bookkeeping abstracted away by the second approach, which is to call fs.Serve to serve the FUSE protocol using an implementation of the service methods in the interfaces FS* (file system), Node* (file or directory), and Handle* (opened file or directory). There are a daunting number of such methods that can be written, but few are required. The specific methods are described in the documentation for those interfaces.
The hellofs subdirectory contains a simple illustration of the fs.Serve approach.
Service Methods ¶
The required and optional methods for the FS, Node, and Handle interfaces have the general form
Op(req *OpRequest, resp *OpResponse, intr Intr) Error
where Op is the name of a FUSE operation. Op reads request parameters from req and writes results to resp. An operation whose only result is the error result omits the resp parameter. Multiple goroutines may call service methods simultaneously; the methods being called are responsible for appropriate synchronization.
Interrupted Operations ¶
In some file systems, some operations may take an undetermined amount of time. For example, a Read waiting for a network message or a matching Write might wait indefinitely. If the request is cancelled and no longer needed, the package will close intr, a chan struct{}. Blocking operations should select on a receive from intr and attempt to abort the operation early if the receive succeeds (meaning the channel is closed). To indicate that the operation failed because it was aborted, return fuse.EINTR.
If an operation does not block for an indefinite amount of time, the intr parameter can be ignored.
Authentication ¶
All requests types embed a Header, meaning that the method can inspect req.Pid, req.Uid, and req.Gid as necessary to implement permission checking. Alternately, XXX.
Mount Options ¶
Behavior and metadata of the mounted file system can be changed by passing MountOption values to Mount.
Index ¶
- Constants
- Variables
- func AppendDirent(data []byte, dir Dirent) []byte
- func Unmount(dir string) error
- type AccessRequest
- type Attr
- type Conn
- type CreateRequest
- type CreateResponse
- type DestroyRequest
- type Dirent
- type DirentType
- type Errno
- type Error
- type ErrorNumber
- type FlushRequest
- type ForgetRequest
- type FsyncRequest
- type GetattrRequest
- type GetattrResponse
- type GetxattrRequest
- type GetxattrResponse
- type HandleID
- type Header
- type InitFlags
- type InitRequest
- type InitResponse
- type InterruptRequest
- type LinkRequest
- type ListxattrRequest
- type ListxattrResponse
- type LookupRequest
- type LookupResponse
- type MkdirRequest
- type MkdirResponse
- type MknodRequest
- type MountConfig
- type MountOption
- type NodeID
- type OpenFlags
- type OpenRequest
- type OpenResponse
- type OpenResponseFlags
- type ReadRequest
- type ReadResponse
- type ReadlinkRequest
- type ReleaseFlags
- type ReleaseRequest
- type RemoveRequest
- type RemovexattrRequest
- type RenameRequest
- type Request
- type RequestID
- type SetattrRequest
- type SetattrResponse
- type SetattrValid
- func (fl SetattrValid) Atime() bool
- func (fl SetattrValid) AtimeNow() bool
- func (fl SetattrValid) Bkuptime() bool
- func (fl SetattrValid) Chgtime() bool
- func (fl SetattrValid) Crtime() bool
- func (fl SetattrValid) Flags() bool
- func (fl SetattrValid) Gid() bool
- func (fl SetattrValid) Handle() bool
- func (fl SetattrValid) LockOwner() bool
- func (fl SetattrValid) Mode() bool
- func (fl SetattrValid) Mtime() bool
- func (fl SetattrValid) MtimeNow() bool
- func (fl SetattrValid) Size() bool
- func (fl SetattrValid) String() string
- func (fl SetattrValid) Uid() bool
- type SetxattrRequest
- type StatfsRequest
- type StatfsResponse
- type SymlinkRequest
- type SymlinkResponse
- type WriteFlags
- type WriteRequest
- type WriteResponse
- Bugs
Constants ¶
const (
// ENOSYS indicates that the call is not supported.
ENOSYS = Errno(syscall.ENOSYS)
// ESTALE is used by Serve to respond to violations of the FUSE protocol.
ESTALE = Errno(syscall.ESTALE)
ENOENT = Errno(syscall.ENOENT)
EIO = Errno(syscall.EIO)
EPERM = Errno(syscall.EPERM)
// EINTR indicates request was interrupted by an InterruptRequest.
// See also fs.Intr.
EINTR = Errno(syscall.EINTR)
ENODATA = Errno(syscall.ENODATA)
ERANGE = Errno(syscall.ERANGE)
ENOTSUP = Errno(syscall.ENOTSUP)
EEXIST = Errno(syscall.EEXIST)
)
const DefaultErrno = EIO
DefaultErrno is the errno used when error returned does not implement ErrorNumber.
const Version = "7.8"
Version is the FUSE version implemented by the package.
Variables ¶
var Debug func(msg interface{}) = nop
Debug is called to output debug messages, including protocol traces. The default behavior is to do nothing.
The messages have human-friendly string representations and are safe to marshal to JSON.
Implementations must not retain msg.
var ErrCannotCombineAllowOtherAndAllowRoot = errors.New("cannot combine AllowOther and AllowRoot")
Functions ¶
func AppendDirent ¶
func AppendDirent(data []byte, dir Dirent) []byte
AppendDirent appends the encoded form of a directory entry to data and returns the resulting slice.
Types ¶
type AccessRequest ¶
type AccessRequest struct {
Header `json:"-"`
Mask uint32
}
An AccessRequest asks whether the file can be accessed for the purpose specified by the mask.
type Attr ¶
type Attr struct {
Inode uint64 // inode number
Size uint64 // size in bytes
Blocks uint64 // size in blocks
Atime time.Time // time of last access
Mtime time.Time // time of last modification
Ctime time.Time // time of last inode change
Crtime time.Time // time of creation (OS X only)
Mode os.FileMode // file mode
Nlink uint32 // number of links
Uid uint32 // owner uid
Gid uint32 // group gid
Rdev uint32 // device numbers
Flags uint32 // chflags(2) flags (OS X only)
}
An Attr is the metadata for a single file or directory.
type Conn ¶
type Conn struct {
// Ready is closed when the mount is complete or has failed.
Ready <-chan struct{}
// MountError stores any error from the mount process. Only valid
// after Ready is closed.
MountError error
// contains filtered or unexported fields
}
A Conn represents a connection to a mounted FUSE file system.
func Mount ¶
func Mount(dir string, options ...MountOption) (*Conn, error)
Mount mounts a new FUSE connection on the named directory and returns a connection for reading and writing FUSE messages.
After a successful return, caller must call Close to free resources.
Even on successful return, the new mount is not guaranteed to be visible until after Conn.Ready is closed. See Conn.MountError for possible errors. Incoming requests on Conn must be served to make progress.
func (*Conn) ReadRequest ¶
func (c *Conn) ReadRequest() (Request, error)
ReadRequest returns the next FUSE request from the kernel.
Caller must call either Request.Respond or Request.RespondError in a reasonable time. Caller must not retain Request after that call.
type CreateRequest ¶
type CreateRequest struct {
Header `json:"-"`
Name string
Flags OpenFlags
Mode os.FileMode
}
A CreateRequest asks to create and open a file (not a directory).
type CreateResponse ¶
type CreateResponse struct {
LookupResponse
OpenResponse
}
A CreateResponse is the response to a CreateRequest. It describes the created node and opened handle.
type DestroyRequest ¶
type DestroyRequest struct {
Header `json:"-"`
}
A DestroyRequest is sent by the kernel when unmounting the file system. No more requests will be received after this one, but it should still be responded to.
type Dirent ¶
type Dirent struct {
// Inode this entry names.
Inode uint64
// Type of the entry, for example DT_File.
//
// Setting this is optional. The zero value (DT_Unknown) means
// callers will just need to do a Getattr when the type is
// needed. Providing a type can speed up operations
// significantly.
Type DirentType
// Name of the entry
Name string
}
A Dirent represents a single directory entry.
type DirentType ¶
type DirentType uint32
Type of an entry in a directory listing.
const (
DT_Unknown DirentType = 0
DT_Socket DirentType = syscall.S_IFSOCK >> 12
DT_Link DirentType = syscall.S_IFLNK >> 12
DT_File DirentType = syscall.S_IFREG >> 12
DT_Block DirentType = syscall.S_IFBLK >> 12
DT_Dir DirentType = syscall.S_IFDIR >> 12
DT_Char DirentType = syscall.S_IFCHR >> 12
DT_FIFO DirentType = syscall.S_IFIFO >> 12
)
type Errno ¶
type Errno syscall.Errno
Errno implements Error and ErrorNumber using a syscall.Errno.
func (Errno) ErrnoName ¶
func (e Errno) ErrnoName() string
ErrnoName returns the short non-numeric identifier for this errno. For example, "EIO".
func (Errno) MarshalText ¶
func (e Errno) MarshalText() ([]byte, error)
type Error ¶
type Error error
An Error is a FUSE error.
Errors messages will be visible in the debug log as part of the response.
The FUSE interface can only communicate POSIX errno error numbers to file system clients, the message is not visible to file system clients. The returned error can implement ErrorNumber to control the errno returned. Without ErrorNumber, a generic errno (EIO) is returned.
type ErrorNumber ¶
type ErrorNumber interface {
// Errno returns the the error number (errno) for this error.
Errno() Errno
}
An ErrorNumber is an error with a specific error number.
Operations may return an error value that implements ErrorNumber to control what specific error number (errno) to return.
type FlushRequest ¶
type FlushRequest struct {
Header `json:"-"`
Handle HandleID
Flags uint32
LockOwner uint64
}
A FlushRequest asks for the current state of an open file to be flushed to storage, as when a file descriptor is being closed. A single opened Handle may receive multiple FlushRequests over its lifetime.
type ForgetRequest ¶
type ForgetRequest struct {
Header `json:"-"`
N uint64
}
A ForgetRequest is sent by the kernel when forgetting about r.Node as returned by r.N lookup requests.
type FsyncRequest ¶
type FsyncRequest struct {
Header `json:"-"`
Handle HandleID
// TODO bit 1 is datasync, not well documented upstream
Flags uint32
Dir bool
}
type GetattrRequest ¶
type GetattrRequest struct {
Header `json:"-"`
}
A GetattrRequest asks for the metadata for the file denoted by r.Node.
type GetattrResponse ¶
type GetattrResponse struct {
AttrValid time.Duration // how long Attr can be cached
Attr Attr // file attributes
}
A GetattrResponse is the response to a GetattrRequest.
type GetxattrRequest ¶
type GetxattrRequest struct {
Header `json:"-"`
// Maximum size to return.
Size uint32
// Name of the attribute requested.
Name string
// Offset within extended attributes.
//
// Only valid for OS X, and then only with the resource fork
// attribute.
Position uint32
}
A GetxattrRequest asks for the extended attributes associated with r.Node.
func (*GetxattrRequest) Respond ¶
func (r *GetxattrRequest) Respond(resp *GetxattrResponse)
Respond replies to the request with the given response.
func (*GetxattrRequest) RespondError ¶
func (r *GetxattrRequest) RespondError(err Error)
type GetxattrResponse ¶
type GetxattrResponse struct {
Xattr []byte
}
A GetxattrResponse is the response to a GetxattrRequest.
type HandleID ¶
type HandleID uint64
A HandleID is a number identifying an open directory or file. It only needs to be unique while the directory or file is open.
type Header ¶
type Header struct {
Conn *Conn `json:"-"` // connection this request was received on
ID RequestID // unique ID for request
Node NodeID // file or directory the request is about
Uid uint32 // user ID of process making request
Gid uint32 // group ID of process making request
Pid uint32 // process ID of process making request
// contains filtered or unexported fields
}
A Header describes the basic information sent in every request.
func (*Header) RespondError ¶
func (h *Header) RespondError(err Error)
type InitFlags ¶
type InitFlags uint32
The InitFlags are used in the Init exchange.
const (
InitAsyncRead InitFlags = 1 << 0
InitPosixLocks InitFlags = 1 << 1
InitFileOps InitFlags = 1 << 2
InitAtomicTrunc InitFlags = 1 << 3
InitExportSupport InitFlags = 1 << 4
InitBigWrites InitFlags = 1 << 5
InitDontMask InitFlags = 1 << 6
InitSpliceWrite InitFlags = 1 << 7
InitSpliceMove InitFlags = 1 << 8
InitSpliceRead InitFlags = 1 << 9
InitFlockLocks InitFlags = 1 << 10
InitHasIoctlDir InitFlags = 1 << 11
InitAutoInvalData InitFlags = 1 << 12
InitDoReaddirplus InitFlags = 1 << 13
InitReaddirplusAuto InitFlags = 1 << 14
InitAsyncDIO InitFlags = 1 << 15
InitWritebackCache InitFlags = 1 << 16
InitNoOpenSupport InitFlags = 1 << 17
InitCaseSensitive InitFlags = 1 << 29 // OS X only
InitVolRename InitFlags = 1 << 30 // OS X only
InitXtimes InitFlags = 1 << 31 // OS X only
)
type InitRequest ¶
type InitRequest struct {
Header `json:"-"`
Major uint32
Minor uint32
// Maximum readahead in bytes that the kernel plans to use.
MaxReadahead uint32
Flags InitFlags
}
An InitRequest is the first request sent on a FUSE file system.
type InitResponse ¶
type InitResponse struct {
// Maximum readahead in bytes that the kernel can use. Ignored if
// greater than InitRequest.MaxReadahead.
MaxReadahead uint32
Flags InitFlags
// Maximum size of a single write operation.
// Linux enforces a minimum of 4 KiB.
MaxWrite uint32
}
An InitResponse is the response to an InitRequest.
type InterruptRequest ¶
type InterruptRequest struct {
Header `json:"-"`
IntrID RequestID // ID of the request to be interrupt.
}
An InterruptRequest is a request to interrupt another pending request. The response to that request should return an error status of EINTR.
type LinkRequest ¶
type LinkRequest struct {
Header `json:"-"`
OldNode NodeID
NewName string
}
A LinkRequest is a request to create a hard link.
type ListxattrRequest ¶
type ListxattrRequest struct {
Header `json:"-"`
Size uint32 // maximum size to return
Position uint32 // offset within attribute list
}
A ListxattrRequest asks to list the extended attributes associated with r.Node.
type ListxattrResponse ¶
type ListxattrResponse struct {
Xattr []byte
}
A ListxattrResponse is the response to a ListxattrRequest.
type LookupRequest ¶
type LookupRequest struct {
Header `json:"-"`
Name string
}
A LookupRequest asks to look up the given name in the directory named by r.Node.
type LookupResponse ¶
type LookupResponse struct {
Node NodeID
Generation uint64
EntryValid time.Duration
AttrValid time.Duration
Attr Attr
}
A LookupResponse is the response to a LookupRequest.
type MkdirRequest ¶
type MkdirRequest struct {
Header `json:"-"`
Name string
Mode os.FileMode
}
A MkdirRequest asks to create (but not open) a directory.
type MkdirResponse ¶
type MkdirResponse struct {
LookupResponse
}
A MkdirResponse is the response to a MkdirRequest.
type MknodRequest ¶
type MknodRequest struct {
Header `json:"-"`
Name string
Mode os.FileMode
Rdev uint32
}
type MountConfig ¶
type MountConfig struct {
// contains filtered or unexported fields
}
MountConfig holds the configuration for a mount operation. Use it by passing MountOption values to Mount.
type MountOption ¶
type MountOption func(*MountConfig) error
MountOption is passed to Mount to change the behavior of the mount.
func AllowOther ¶
func AllowOther() MountOption
AllowOther allows other users to access the file system.
Only one of AllowOther or AllowRoot can be used.
func AllowRoot ¶
func AllowRoot() MountOption
AllowRoot allows other users to access the file system.
Only one of AllowOther or AllowRoot can be used.
func FSName ¶
func FSName(name string) MountOption
FSName sets the file system name (also called source) that is visible in the list of mounted file systems.
func LocalVolume ¶
func LocalVolume() MountOption
LocalVolume sets the volume to be local (instead of network), changing the behavior of Finder, Spotlight, and such.
OS X only. Others ignore this option.
func Subtype ¶
func Subtype(fstype string) MountOption
Subtype sets the subtype of the mount. The main type is always `fuse`. The type in a list of mounted file systems will look like `fuse.foo`.
OS X ignores this option.
func VolumeName ¶
func VolumeName(name string) MountOption
VolumeName sets the volume name shown in Finder.
OS X only. Others ignore this option.
type NodeID ¶
type NodeID uint64
A NodeID is a number identifying a directory or file. It must be unique among IDs returned in LookupResponses that have not yet been forgotten by ForgetRequests.
const RootID NodeID = rootID
The RootID identifies the root directory of a FUSE file system.
type OpenFlags ¶
type OpenFlags uint32
OpenFlags are the O_FOO flags passed to open/create/etc calls. For example, os.O_WRONLY | os.O_APPEND.
const (
// Access modes. These are not 1-bit flags, but alternatives where
// only one can be chosen. See the IsReadOnly etc convenience
// methods.
OpenReadOnly OpenFlags = syscall.O_RDONLY
OpenWriteOnly OpenFlags = syscall.O_WRONLY
OpenReadWrite OpenFlags = syscall.O_RDWR
OpenAppend OpenFlags = syscall.O_APPEND
OpenCreate OpenFlags = syscall.O_CREAT
OpenExclusive OpenFlags = syscall.O_EXCL
OpenSync OpenFlags = syscall.O_SYNC
OpenTruncate OpenFlags = syscall.O_TRUNC
)
Flags that can be seen in OpenRequest.Flags.
const OpenAccessModeMask OpenFlags = syscall.O_ACCMODE
OpenAccessModeMask is a bitmask that separates the access mode from the other flags in OpenFlags.
func (OpenFlags) IsReadOnly ¶
func (fl OpenFlags) IsReadOnly() bool
Return true if OpenReadOnly is set.
func (OpenFlags) IsReadWrite ¶
func (fl OpenFlags) IsReadWrite() bool
Return true if OpenReadWrite is set.
func (OpenFlags) IsWriteOnly ¶
func (fl OpenFlags) IsWriteOnly() bool
Return true if OpenWriteOnly is set.
type OpenRequest ¶
type OpenRequest struct {
Header `json:"-"`
Dir bool // is this Opendir?
Flags OpenFlags
}
An OpenRequest asks to open a file or directory
type OpenResponse ¶
type OpenResponse struct {
Handle HandleID
Flags OpenResponseFlags
}
A OpenResponse is the response to a OpenRequest.
type OpenResponseFlags ¶
type OpenResponseFlags uint32
The OpenResponseFlags are returned in the OpenResponse.
const (
OpenDirectIO OpenResponseFlags = 1 << 0 // bypass page cache for this open file
OpenKeepCache OpenResponseFlags = 1 << 1 // don't invalidate the data cache on open
OpenNonSeekable OpenResponseFlags = 1 << 2 // (Linux?)
OpenPurgeAttr OpenResponseFlags = 1 << 30 // OS X
OpenPurgeUBC OpenResponseFlags = 1 << 31 // OS X
)
type ReadRequest ¶
type ReadRequest struct {
Header `json:"-"`
Dir bool // is this Readdir?
Handle HandleID
Offset int64
Size int
}
A ReadRequest asks to read from an open file.
type ReadResponse ¶
type ReadResponse struct {
Data []byte
}
A ReadResponse is the response to a ReadRequest.
func (*ReadResponse) MarshalJSON ¶
func (r *ReadResponse) MarshalJSON() ([]byte, error)
type ReadlinkRequest ¶
type ReadlinkRequest struct {
Header `json:"-"`
}
A ReadlinkRequest is a request to read a symlink's target.
type ReleaseFlags ¶
type ReleaseFlags uint32
The ReleaseFlags are used in the Release exchange.
const (
ReleaseFlush ReleaseFlags = 1 << 0
)
type ReleaseRequest ¶
type ReleaseRequest struct {
Header `json:"-"`
Dir bool // is this Releasedir?
Handle HandleID
Flags OpenFlags // flags from OpenRequest
ReleaseFlags ReleaseFlags
LockOwner uint32
}
A ReleaseRequest asks to release (close) an open file handle.
type RemoveRequest ¶
type RemoveRequest struct {
Header `json:"-"`
Name string // name of the entry to remove
Dir bool // is this rmdir?
}
A RemoveRequest asks to remove a file or directory from the directory r.Node.
type RemovexattrRequest ¶
type RemovexattrRequest struct {
Header `json:"-"`
Name string // name of extended attribute
}
A RemovexattrRequest asks to remove an extended attribute associated with r.Node.
func (*RemovexattrRequest) Respond ¶
func (r *RemovexattrRequest) Respond()
Respond replies to the request, indicating that the attribute was removed.
func (*RemovexattrRequest) RespondError ¶
func (r *RemovexattrRequest) RespondError(err Error)
type RenameRequest ¶
type RenameRequest struct {
Header `json:"-"`
NewDir NodeID
OldName, NewName string
}
A RenameRequest is a request to rename a file.
type Request ¶
type Request interface {
// Hdr returns the Header associated with this request.
Hdr() *Header
// RespondError responds to the request with the given error.
RespondError(Error)
String() string
}
A Request represents a single FUSE request received from the kernel. Use a type switch to determine the specific kind. A request of unrecognized type will have concrete type *Header.
type SetattrRequest ¶
type SetattrRequest struct {
Header `json:"-"`
Valid SetattrValid
Handle HandleID
Size uint64
Atime time.Time
Mtime time.Time
Mode os.FileMode
Uid uint32
Gid uint32
// OS X only
Bkuptime time.Time
Chgtime time.Time
Crtime time.Time
Flags uint32 // see chflags(2)
}
A SetattrRequest asks to change one or more attributes associated with a file, as indicated by Valid.
type SetattrResponse ¶
type SetattrResponse struct {
AttrValid time.Duration // how long Attr can be cached
Attr Attr // file attributes
}
A SetattrResponse is the response to a SetattrRequest.
type SetattrValid ¶
type SetattrValid uint32
The SetattrValid are bit flags describing which fields in the SetattrRequest are included in the change.
const (
SetattrMode SetattrValid = 1 << 0
SetattrUid SetattrValid = 1 << 1
SetattrGid SetattrValid = 1 << 2
SetattrSize SetattrValid = 1 << 3
SetattrAtime SetattrValid = 1 << 4
SetattrMtime SetattrValid = 1 << 5
SetattrHandle SetattrValid = 1 << 6
// Linux only(?)
SetattrAtimeNow SetattrValid = 1 << 7
SetattrMtimeNow SetattrValid = 1 << 8
SetattrLockOwner SetattrValid = 1 << 9 // http://www.mail-archive.com/git-commits-head@vger.kernel.org/msg27852.html
// OS X only
SetattrCrtime SetattrValid = 1 << 28
SetattrChgtime SetattrValid = 1 << 29
SetattrBkuptime SetattrValid = 1 << 30
SetattrFlags SetattrValid = 1 << 31
)
type SetxattrRequest ¶
type SetxattrRequest struct {
Header `json:"-"`
// Flags can make the request fail if attribute does/not already
// exist. Unfortunately, the constants are platform-specific and
// not exposed by Go1.2. Look for XATTR_CREATE, XATTR_REPLACE.
//
// TODO improve this later
//
// TODO XATTR_CREATE and exist -> EEXIST
//
// TODO XATTR_REPLACE and not exist -> ENODATA
Flags uint32
// Offset within extended attributes.
//
// Only valid for OS X, and then only with the resource fork
// attribute.
Position uint32
Name string
Xattr []byte
}
A SetxattrRequest asks to set an extended attribute associated with a file.
func (*SetxattrRequest) Respond ¶
func (r *SetxattrRequest) Respond()
Respond replies to the request, indicating that the extended attribute was set.
func (*SetxattrRequest) RespondError ¶
func (r *SetxattrRequest) RespondError(err Error)
type StatfsRequest ¶
type StatfsRequest struct {
Header `json:"-"`
}
A StatfsRequest requests information about the mounted file system.
type StatfsResponse ¶
type StatfsResponse struct {
Blocks uint64 // Total data blocks in file system.
Bfree uint64 // Free blocks in file system.
Bavail uint64 // Free blocks in file system if you're not root.
Files uint64 // Total files in file system.
Ffree uint64 // Free files in file system.
Bsize uint32 // Block size
Namelen uint32 // Maximum file name length?
Frsize uint32 // Fragment size, smallest addressable data size in the file system.
}
A StatfsResponse is the response to a StatfsRequest.
type SymlinkRequest ¶
type SymlinkRequest struct {
Header `json:"-"`
NewName, Target string
}
A SymlinkRequest is a request to create a symlink making NewName point to Target.
type SymlinkResponse ¶
type SymlinkResponse struct {
LookupResponse
}
A SymlinkResponse is the response to a SymlinkRequest.
type WriteRequest ¶
type WriteRequest struct {
Header
Handle HandleID
Offset int64
Data []byte
Flags WriteFlags
}
A WriteRequest asks to write to an open file.
func (*WriteRequest) MarshalJSON ¶
func (r *WriteRequest) MarshalJSON() ([]byte, error)
type WriteResponse ¶
type WriteResponse struct {
Size int
}
A WriteResponse replies to a write indicating how many bytes were written.
Notes ¶
Bugs ¶
The mount code for FreeBSD has not been written yet.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
bench
Package bench contains benchmarks.
|
Package bench contains benchmarks. |
Hellofs implements a simple "hello world" file system.
|
Hellofs implements a simple "hello world" file system. |
Package syscallx provides wrappers that make syscalls on various platforms more interoperable.
|
Package syscallx provides wrappers that make syscalls on various platforms more interoperable. |