package stat
import "go.rbn.im/neinp/stat"
Package stat provides functionality to handle 9p stat values.
Index ¶
- func OsMode(mode Mode) os.FileMode
- type Mode
- type Reader
- func NewReader(stats ...Stat) *Reader
- func (s *Reader) Read(p []byte) (int, error)
- func (s *Reader) Seek(offset int64, whence int) (int64, error)
- type Stat
- func FileInfo(fi os.FileInfo) Stat
- func Generic(fi os.FileInfo) Stat
- func (s *Stat) Decode(r io.Reader) (int64, error)
- func (s *Stat) Encode(w io.Writer) (int64, error)
- func (s *Stat) IsAppend() bool
- func (s *Stat) IsAuth() bool
- func (s *Stat) IsDevice() bool
- func (s *Stat) IsDir() bool
- func (s *Stat) IsExcl() bool
- func (s *Stat) IsMount() bool
- func (s *Stat) IsNamedPipe() bool
- func (s *Stat) IsSetGid() bool
- func (s *Stat) IsSetUid() bool
- func (s *Stat) IsSocket() bool
- func (s *Stat) IsSymlink() bool
- func (s *Stat) IsTmp() bool
Functions ¶
func OsMode ¶
OsMode translates Mode to os.FileMode.
Types ¶
type Mode ¶
type Mode uint32
Mode represents modes of a directory entry.
const ( // SetGid is setgid (Unix, 9P2000.u) SetGid Mode = 0x00040000 // SetUid is setuid (Unix, 9P2000.u) SetUid Mode = 0x00080000 // Socket is a socket (Unix, 9P2000.u) Socket Mode = 0x00100000 // NamedPipe is a named pipe (Unix, 9P2000.u) NamedPipe Mode = 0x00200000 // Device is a device file (Unix, 9P2000.u) Device Mode = 0x00800000 // Symlink is a symbolic link (Unix, 9P2000.u) Symlink Mode = 0x02000000 // Tmp is a non-backed-up file Tmp Mode = 0x04000000 // Auth is a authentication file Auth Mode = 0x08000000 // Mount is a mounted channel Mount Mode = 0x10000000 // Excl is a exclusive use file Excl Mode = 0x20000000 // Append is a append only file Append Mode = 0x40000000 // Dir is a directory Dir Mode = 0x80000000 )
func NeinMode ¶
NeinMode converts os.FileMode to Mode.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is a reader for multiple Stats, aka directories.
func NewReader ¶
NewReader returns a new Reader initialized with stats and ready for reading.
func (*Reader) Read ¶
func (*Reader) Seek ¶
Seek interface implementation.
type Stat ¶
type Stat struct { // Size uint16 Typ uint16 Dev uint32 Qid qid.Qid Mode Mode Atime time.Time Mtime time.Time Length uint64 Name string Uid string Gid string Muid string }
Stat contains file attributes.
Typ and Dev are usually unused. Qid contains the Qid of this file. Mode is a combination of UNIX-permission bits for owner, group and others. Atime contains the time of last access, Mtime the time of last modification. Length is the file length in bytes, directories have a conventional length of 0. Name is the file name and must be "/" if the file is the root directory of the server. Uid is the owners name (not UNIX uid), group is the groups name. Muid is the name of the last user who modified the file.
http://man.cat-v.org/inferno/5/stat
func FileInfo ¶
FileInfo creates Stat using os.FileInfo.Sys(). If using the information returned by Sys() fails, it returns a stat like returned by GenericStat.
func Generic ¶
Generic creates a neinp.Stat not using FileInfo.Sys().
func (*Stat) Decode ¶
func (*Stat) Encode ¶
func (*Stat) IsAppend ¶
IsAppend returns true if Append is set.
func (*Stat) IsAuth ¶
IsAuth returns true if Auth is set.
func (*Stat) IsDevice ¶
IsDevice returns true if Device is set.
func (*Stat) IsDir ¶
IsDir returns true if Dir is set.
func (*Stat) IsExcl ¶
IsExcl returns true if Excl is set.
func (*Stat) IsMount ¶
IsMount returns true if Mount is set.
func (*Stat) IsNamedPipe ¶
IsNamedPipe returns true if NamedPipe is set.
func (*Stat) IsSetGid ¶
IsSetGid returns true if SetGid is set
func (*Stat) IsSetUid ¶
IsSetUid returns true if SetUid is set.
func (*Stat) IsSocket ¶
IsSocket returns true if Socket is set.
func (*Stat) IsSymlink ¶
IsSymlink returns true if Symlink is set.
func (*Stat) IsTmp ¶
IsTmp returns true if Tmp is set.
Source Files ¶
consts.go fileinfo.go fileinfo_stat.go reader.go stat.go
- Version
- v0.0.0-20210223183118-a76f220d4840 (latest)
- Published
- Feb 23, 2021
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 6 days ago –
Tools for package owners.