Documentation
¶
Overview ¶
Package diskfs provides a glue layer between OS's file system and 9P file system. It can be used to export OS's file tree via 9P protocol.
Index ¶
- type FS
- func (fsys *FS) Create(name string, uid string, omode lib9p.OpenMode, perm lib9p.FileMode) (lib9p.File, error)
- func (fsys *FS) IsGroupLeader(group, uid string) bool
- func (fsys *FS) IsGroupMember(group, uid string) bool
- func (fsys *FS) OpenFile(name string, flag int) (lib9p.File, error)
- func (fsys *FS) Remove(name string) error
- func (fsys *FS) ShowQidPool() string
- type File
- func (f *File) Close() error
- func (f *File) Read(b []byte) (int, error)
- func (f *File) ReadAt(p []byte, off int64) (int, error)
- func (f *File) ReadDir(n int) ([]fs.DirEntry, error)
- func (f *File) Stat() (*lib9p.FileInfo, error)
- func (f *File) WStat(s *lib9p.Stat) error
- func (f *File) WriteAt(p []byte, off int64) (int, error)
- type QidPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS is a file system to export OS's file system via 9P protocol.
func Open ¶
Open opens OS's file tree as *FS rooted at name. Name is either os.PathSeparator-separated or slash-separated.
func (*FS) Create ¶ added in v0.3.0
func (fsys *FS) Create(name string, uid string, omode lib9p.OpenMode, perm lib9p.FileMode) (lib9p.File, error)
Name is slash-separated.
func (*FS) OpenFile ¶
OpenFile opens the named file with specified omode by calling os.OpenFile. Name is slash separated.
func (*FS) Remove ¶ added in v0.3.0
Remove removes the file specified by name. It also removes the corresponding qid record from fsys.
type File ¶
type File struct {
// contains filtered or unexported fields
}
File represents a file.
func (*File) Read ¶
Read reads up to len(b) bytes from the File and stores them in b. It returns the number of bytes read and any error encountered. At end of file. Read returns 0, io.EOF.
func (*File) ReadDir ¶
ReadDir reads the contents of the directory and returns a slice of up to n *lib9p.DirEntry values in directory order. Subsequent calls on the same file will yield further DirEntry values.
If n > 0, ReadDir returns at most n DirEntry structures. In this case, if ReadDir returns an empty slice, it will return a non-nil error explaining why. At the end of a directory, the error is io.EOF. (ReadDir must return io.EOF itself, not an error wrapping io.EOF.)
If n <= 0, ReadDir returns all the DirEntry values from the directory in a single slice. In this case, if ReadDir succeeds (reads all the way to the end of the directory), it returns the slice and a nil error. If it encounters an error before the end of the directory, ReadDir returns the DirEntry list read until that point and a non-nil error.
TODO: handle errors correctly.
func (*File) Stat ¶
Stat returns the *lib9p.FileInfo structure describing file.