diskfs

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2024 License: 0BSD Imports: 11 Imported by: 0

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

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

func Open(name string) (*FS, error)

Open opens OS's file tree as *FS rooted at name.

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)

TODO: check uid BUG: check uid. it can be a security hole.

func (*FS) IsGroupLeader added in v0.4.0

func (fsys *FS) IsGroupLeader(group, uid string) bool

func (*FS) IsGroupMember added in v0.4.0

func (fsys *FS) IsGroupMember(group, uid string) bool

func (*FS) OpenFile

func (fsys *FS) OpenFile(name string, flag int) (lib9p.File, error)

OpenFile opens the named file with specified omode by calling os.OpenFile.

func (*FS) Remove added in v0.3.0

func (fsys *FS) Remove(name string) error

type File

type File struct {
	// contains filtered or unexported fields
}

File represents a file.

func (*File) Close

func (f *File) Close() error

Close closes the file.

func (*File) Read

func (f *File) Read(b []byte) (int, error)

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) ReadAt

func (f *File) ReadAt(p []byte, off int64) (int, error)

func (*File) ReadDir

func (f *File) ReadDir(n int) ([]fs.DirEntry, error)

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

func (f *File) Stat() (*lib9p.FileInfo, error)

Stat returns the *lib9p.FileInfo structure describing file.

func (*File) WStat

func (f *File) WStat(s *lib9p.Stat) error

WStat updates the stat of the file.

func (*File) WriteAt

func (f *File) WriteAt(p []byte, off int64) (int, error)

type QidPool

type QidPool struct {
	// contains filtered or unexported fields
}

QidPool is the list of Qids in the file system.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL