Documentation
¶
Overview ¶
Package p9 used a 9P2000.L implementation. It served its purpose well, but has been replaced by LisaFS.
All that remains are some types that are used in LisaFS.
Index ¶
- Constants
- func StatToAttr(s *syscall.Stat_t, req AttrMask) (Attr, AttrMask)
- type AllocateMode
- type Attr
- type AttrMask
- type FSStat
- type FileMode
- func (m FileMode) FileType() FileMode
- func (m FileMode) IsBlockDevice() bool
- func (m FileMode) IsCharacterDevice() bool
- func (m FileMode) IsDir() bool
- func (m FileMode) IsExecutable() bool
- func (m FileMode) IsNamedPipe() bool
- func (m FileMode) IsReadable() bool
- func (m FileMode) IsRegular() bool
- func (m FileMode) IsSocket() bool
- func (m FileMode) IsSymlink() bool
- func (m FileMode) IsWritable() bool
- func (m FileMode) OSMode() os.FileMode
- func (m FileMode) Permissions() FileMode
- func (m FileMode) Writable() FileMode
- type GID
- type OpenFlags
- type SocketType
- type UID
Constants ¶
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AllocateMode ¶
type AllocateMode struct {
KeepSize bool
PunchHole bool
NoHideStale bool
CollapseRange bool
ZeroRange bool
InsertRange bool
}
AllocateMode are possible modes to p9.File.Allocate().
func ToAllocateMode ¶
func ToAllocateMode(mode uint64) AllocateMode
ToAllocateMode returns an AllocateMode from a fallocate(2) mode.
func (*AllocateMode) ToLinux ¶
func (a *AllocateMode) ToLinux() uint32
ToLinux converts to a value compatible with fallocate(2)'s mode.
type Attr ¶
type Attr struct {
Mode FileMode
UID UID
GID GID
NLink uint64
RDev uint64
Size uint64
BlockSize uint64
Blocks uint64
ATimeSeconds uint64
ATimeNanoSeconds uint64
MTimeSeconds uint64
MTimeNanoSeconds uint64
CTimeSeconds uint64
CTimeNanoSeconds uint64
BTimeSeconds uint64
BTimeNanoSeconds uint64
Gen uint64
DataVersion uint64
}
Attr is a set of attributes for getattr.
type AttrMask ¶
type AttrMask struct {
Mode bool
NLink bool
UID bool
GID bool
RDev bool
ATime bool
MTime bool
CTime bool
INo bool
Size bool
Blocks bool
BTime bool
Gen bool
DataVersion bool
}
AttrMask is a mask of attributes for getattr.
func AttrMaskAll ¶
func AttrMaskAll() AttrMask
AttrMaskAll returns an AttrMask with all fields masked.
type FSStat ¶
type FSStat struct {
// Type is the filesystem type.
Type uint32
// BlockSize is the blocksize.
BlockSize uint32
// Blocks is the number of blocks.
Blocks uint64
// BlocksFree is the number of free blocks.
BlocksFree uint64
// BlocksAvailable is the number of blocks *available*.
BlocksAvailable uint64
// Files is the number of files available.
Files uint64
// FilesFree is the number of free file nodes.
FilesFree uint64
// FSID is the filesystem ID.
FSID uint64
// NameLength is the maximum name length.
NameLength uint32
}
FSStat is used by statfs.
type FileMode ¶
type FileMode uint32
FileMode are flags corresponding to file modes.
These correspond to bits sent over the wire. These also correspond to mode_t bits.
const ( // FileModeMask is a mask of all the file mode bits of FileMode. FileModeMask FileMode = 0170000 // ModeSocket is an (unused) mode bit for a socket. ModeSocket FileMode = 0140000 // ModeSymlink is a mode bit for a symlink. ModeSymlink FileMode = 0120000 // ModeRegular is a mode bit for regular files. ModeRegular FileMode = 0100000 // ModeBlockDevice is a mode bit for block devices. ModeBlockDevice FileMode = 060000 // ModeDirectory is a mode bit for directories. ModeDirectory FileMode = 040000 // ModeCharacterDevice is a mode bit for a character device. ModeCharacterDevice FileMode = 020000 // ModeNamedPipe is a mode bit for a named pipe. ModeNamedPipe FileMode = 010000 // Read is a mode bit indicating read permission. Read FileMode = 04 // Write is a mode bit indicating write permission. Write FileMode = 02 // Exec is a mode bit indicating exec permission. Exec FileMode = 01 // AllPermissions is a mask with rwx bits set for user, group and others. AllPermissions FileMode = 0777 // Sticky is a mode bit indicating sticky directories. Sticky FileMode = 01000 // SetGID is the set group ID bit. SetGID FileMode = 02000 // SetUID is the set user ID bit. SetUID FileMode = 04000 )
func ModeFromOS ¶
ModeFromOS returns a FileMode from an os.FileMode.
func (FileMode) IsBlockDevice ¶
IsBlockDevice returns true if m represents a character device.
func (FileMode) IsCharacterDevice ¶
IsCharacterDevice returns true if m represents a character device.
func (FileMode) IsExecutable ¶
IsExecutable returns true if m represents a file that can be executed.
func (FileMode) IsNamedPipe ¶
IsNamedPipe returns true if m represents a named pipe.
func (FileMode) IsReadable ¶
IsReadable returns true if m represents a file that can be read.
func (FileMode) IsWritable ¶
IsWritable returns true if m represents a file that can be written to.
func (FileMode) Permissions ¶
Permissions returns just the permission bits of the mode.
type OpenFlags ¶
type OpenFlags uint32
OpenFlags is the mode passed to Open and Create operations.
These correspond to bits sent over the wire.
const ( // ReadOnly is a Tlopen and Tlcreate flag indicating read-only mode. ReadOnly OpenFlags = 0 // WriteOnly is a Tlopen and Tlcreate flag indicating write-only mode. WriteOnly OpenFlags = 1 // ReadWrite is a Tlopen flag indicates read-write mode. ReadWrite OpenFlags = 2 // OpenFlagsModeMask is a mask of valid OpenFlags mode bits. OpenFlagsModeMask OpenFlags = 3 // OpenTruncate is a Tlopen flag indicating that the opened file should be // truncated. OpenTruncate OpenFlags = 01000 )
type SocketType ¶
type SocketType uint32
SocketType is the socket type passed in Connect and Bind operations.
These correspond to bits sent over the wire.
const ( // StreamSocket indicates SOCK_STREAM mode. StreamSocket SocketType = 0 // DgramSocket indicates SOCK_DGRAM mode. DgramSocket SocketType = 1 // SeqpacketSocket indicates SOCK_SEQPACKET mode. SeqpacketSocket SocketType = 2 // AnonymousSocket is only valid for Connect calls, and indicates that // the caller will accept any socket type. AnonymousSocket SocketType = 3 )
func SocketTypeFromLinux ¶
func SocketTypeFromLinux(st linux.SockType) (SocketType, bool)
SocketTypeFromLinux maps a Linux socket type to a SocketType.