package p9
import "gvisor.dev/gvisor/pkg/p9"
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
- func AttrMaskAll() AttrMask
- func (a AttrMask) Contains(b AttrMask) bool
- func (a AttrMask) Empty() bool
- func (a AttrMask) String() string
- type FSStat
- type FileMode
- func ModeFromOS(mode os.FileMode) 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 SetAttr
- type SetAttrMask
- func (s SetAttrMask) Empty() bool
- func (s SetAttrMask) IsSubsetOf(m SetAttrMask) bool
- func (s SetAttrMask) String() string
- type SocketType
- func SocketTypeFromLinux(st linux.SockType) (SocketType, bool)
- func (st SocketType) ToLinux() (linux.SockType, bool)
- type Tag
- type UID
Constants ¶
const ( // NoUID is a sentinel used to indicate no valid UID. NoUID UID = math.MaxUint32 // NoGID is a sentinel used to indicate no valid GID. NoGID GID = math.MaxUint32 )
Functions ¶
func StatToAttr ¶
StatToAttr converts a Linux syscall stat structure to an Attr.
Types ¶
type AllocateMode ¶
type AllocateMode struct { KeepSize bool PunchHole bool NoHideStale bool CollapseRange bool ZeroRange bool InsertRange bool 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.
func (*Attr) Apply ¶
func (a *Attr) Apply(mask SetAttrMask, attr SetAttr)
Apply applies this to the given Attr.
func (Attr) String ¶
String implements fmt.Stringer.
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.
func (AttrMask) Contains ¶
Contains returns true if a contains all of the attributes masked as b.
func (AttrMask) Empty ¶
Empty returns true if no fields are masked.
func (AttrMask) String ¶
String implements fmt.Stringer.
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) FileType ¶
FileType returns the file mode without the permission bits.
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) IsDir ¶
IsDir returns true if m represents a directory.
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) IsRegular ¶
IsRegular returns true if m is a regular file.
func (FileMode) IsSocket ¶
IsSocket returns true if m represents a socket.
func (FileMode) IsSymlink ¶
IsSymlink returns true if m represents a symlink.
func (FileMode) IsWritable ¶
IsWritable returns true if m represents a file that can be written to.
func (FileMode) OSMode ¶
OSMode converts a p9.FileMode to an os.FileMode.
func (FileMode) Permissions ¶
Permissions returns just the permission bits of the mode.
func (FileMode) Writable ¶
Writable returns the mode with write bits added.
type GID ¶
type GID uint32
GID represents a group ID.
func (GID) Ok ¶
Ok returns true if gid is not NoGID.
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 )
func (OpenFlags) OSFlags ¶
OSFlags converts a p9.OpenFlags to an int compatible with open(2).
func (OpenFlags) String ¶
String implements fmt.Stringer.
type SetAttr ¶
type SetAttr struct { Permissions FileMode UID UID GID GID Size uint64 ATimeSeconds uint64 ATimeNanoSeconds uint64 MTimeSeconds uint64 MTimeNanoSeconds uint64 }
SetAttr specifies a set of attributes for a setattr.
func (SetAttr) String ¶
String implements fmt.Stringer.
type SetAttrMask ¶
type SetAttrMask struct { Permissions bool UID bool GID bool Size bool ATime bool MTime bool CTime bool ATimeNotSystemTime bool MTimeNotSystemTime bool }
SetAttrMask specifies a valid mask for setattr.
func (SetAttrMask) Empty ¶
func (s SetAttrMask) Empty() bool
Empty returns true if no fields are masked.
func (SetAttrMask) IsSubsetOf ¶
func (s SetAttrMask) IsSubsetOf(m SetAttrMask) bool
IsSubsetOf returns whether s is a subset of m.
func (SetAttrMask) String ¶
func (s SetAttrMask) String() string
String implements fmt.Stringer.
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.
func (SocketType) ToLinux ¶
func (st SocketType) ToLinux() (linux.SockType, bool)
ToLinux maps the SocketType to a Linux socket type.
type Tag ¶
type Tag uint16
Tag is a message tag.
type UID ¶
type UID uint32
UID represents a user ID.
func (UID) Ok ¶
Ok returns true if uid is not NoUID.
Source Files ¶
p9.go
- Version
- v0.0.0-20250702182429-85e76111eb28 (latest)
- Published
- Jul 2, 2025
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 3 hours ago –
Tools for package owners.