package styxfile
import "aqwari.net/net/styx/internal/styxfile"
Package styxfile provides helper routines and interfaces for serving 9P files from Go types.
Index ¶
- Variables
- func Mode9P(mode os.FileMode) uint32
- func ModeOS(perm uint32) os.FileMode
- func QidType(mode uint32) uint8
- func SetDeadline(file Interface, t time.Time) error
- func Stat(buf []byte, file Interface, name string, qid styxproto.Qid) (styxproto.Stat, error)
- type Directory
- type Interface
Variables ¶
ErrNoSeek is returned when a given type does not support writing to any offset other than its current position after previous reads and writes.
ErrNotSupported is returned when a given type does not implement the necessary functionality to complete a given read/write operation.
ErrSmallRead is returned when a client's Tread request on a directory does not request enough bytes to hold at least one Stat structure.
Functions ¶
func Mode9P ¶
Mode9P converts an os.FileMode to a 9P mode mask
func ModeOS ¶
FileMode converts a 9P mode mask to an os.FileMode.
func QidType ¶
QidType selects the first byte of a 9P mode mask, and is suitable for use in a Qid's type field.
func SetDeadline ¶
SetDeadline sets read/write deadlines for a file, if the type supports it.
func Stat ¶
Stat produces a styxproto.Stat from an open file. If the value provides a Stat method matching that of os.File, that is used. Otherwise, the styxfile package determines the file's attributes based on other characteristics.
Types ¶
type Directory ¶
Types implementing the Directory interface can be made into 9P files by the NewDir function. This provides an easy way, for example, to provide directory listings from an *os.File.
type Interface ¶
Interface describes the methods a type must implement to be used as a file by a 9P file server. The New function converts types that implement some, but not all of these methods into types that do.
func New ¶
New creates a new Interface that reads and writes to and from rwc. The type of rwc determines the implementation selected by New; if rwc already implements Interface, it is used as-is. If some methods are missing, wrapper types are used to implement missing functionality. If the provided type cannot be adapted into an Interface, New returns a non-nil error.
func NewDir ¶
NewDir creates a new Interface that converts the return value of a Directory's Readdir method into 9P Stat structures.
Source Files ¶
dir.go dumb.go file.go mode.go seeker.go
- Version
- v0.0.0-20221011015736-bf55d759d56b (latest)
- Published
- Oct 11, 2022
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 4 days ago –
Tools for package owners.