vfs

package
v0.14.6 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const READAHEAD_CHUNK = uint32(20 * 1024 * 1024)

Variables

View Source
var StatsSize = 1000

Functions

func GetInternalNodeByName

func GetInternalNodeByName(name string) (Ino, *Attr)

func IsSpecialName

func IsSpecialName(name string) bool

func IsSpecialNode

func IsSpecialNode(ino Ino) bool

Types

type Attr

type Attr = meta.Attr

type Config

type Config struct {
	Cache *cache.Config

	Meta *meta.Config
	// contains filtered or unexported fields
}

func InitConfig

func InitConfig(options ...Option) *Config

type DataReader

type DataReader interface {
	Open(inode Ino, length uint64, ufs ufslib.UnderFileStorage, path string) (FileReader, error)
}

func NewDataReader

func NewDataReader(m meta.Meta, blockSize int, store cache.Store) DataReader

type DataWriter

type DataWriter interface {
	Open(inode Ino, length uint64, ufs ufslib.UnderFileStorage, path string) (FileWriter, error)
}

func NewDataWriter

func NewDataWriter(m meta.Meta, blockSize int, store cache.Store) DataWriter

type FileReader

type FileReader interface {
	Read(buf []byte, off uint64) (int, syscall.Errno)
	Close()
}

type FileWriter

type FileWriter interface {
	Write(data []byte, offset uint64) syscall.Errno
	Flush() syscall.Errno
	Fsync(fd int) syscall.Errno
	Close()
	Truncate(size uint64) syscall.Errno
	Fallocate(size int64, off int64, mode uint32) syscall.Errno
}

type Ino

type Ino = meta.Ino

type Option

type Option func(*Config)

func WithDataCacheConfig

func WithDataCacheConfig(data cache.Config) Option

func WithMetaConfig

func WithMetaConfig(m meta.Config) Option

func WithOwner

func WithOwner(uid, gid uint32) Option

type Owner

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

type VFS

type VFS struct {
	Meta  meta.Meta
	Store cache.Store
	// contains filtered or unexported fields
}

func GetVFS

func GetVFS() *VFS

func InitVFS

func InitVFS(fsMeta common.FSMeta, links map[string]common.FSMeta, global bool,
	config *Config, registry *prometheus.Registry) (*VFS, error)

func (*VFS) Access

func (v *VFS) Access(ctx *meta.Context, ino Ino, mask uint32) (err syscall.Errno)

func (*VFS) CopyFileRange

func (v *VFS) CopyFileRange(ctx *meta.Context, nodeIn Ino, fhIn, offIn uint64, nodeOut Ino, fhOut, offOut, size uint64, flags uint32) (copied uint64, err syscall.Errno)

func (*VFS) Create

func (v *VFS) Create(ctx *meta.Context, parent Ino, name string, mode uint32, cumask uint16, flags uint32) (entry *meta.Entry, fh uint64, err syscall.Errno)

File handling.

func (*VFS) Fallocate

func (v *VFS) Fallocate(ctx *meta.Context, ino Ino, mode uint8, off, length int64, fh uint64) syscall.Errno

func (*VFS) Flush

func (v *VFS) Flush(ctx *meta.Context, ino Ino, fh uint64, lockOwner uint64) (err syscall.Errno)

func (*VFS) Fsync

func (v *VFS) Fsync(ctx *meta.Context, ino Ino, datasync int, fh uint64) (err syscall.Errno)

func (*VFS) GetAttr

func (v *VFS) GetAttr(ctx *meta.Context, ino Ino) (entry *meta.Entry, err syscall.Errno)

Attributes.

func (*VFS) GetLk

func (v *VFS) GetLk(ctx *meta.Context, ino Ino, fh uint64, owner uint64, start, len *uint64, typ *uint32, pid *uint32) (err syscall.Errno)

File locking

func (*VFS) GetXAttr

func (v *VFS) GetXAttr(ctx *meta.Context, ino Ino, name string, size uint32) (data []byte, err syscall.Errno)

GetXAttr reads an extended attribute, and should return the number of bytes. If the buffer is too small, return ERANGE, with the required buffer size.

func (v *VFS) Link(ctx *meta.Context, ino Ino, newparent Ino, newname string) (entry *meta.Entry, err syscall.Errno)

func (*VFS) ListXAttr

func (v *VFS) ListXAttr(ctx *meta.Context, ino Ino, size uint32) (data []byte, err syscall.Errno)

ListXAttr lists extended attributes as '\0' delimited byte slice, and return the number of bytes. If the buffer is too small, return ERANGE, with the required buffer size.

func (*VFS) Lookup

func (v *VFS) Lookup(ctx *meta.Context, parent Ino, name string) (entry *meta.Entry, err syscall.Errno)

Lookup is called by the kernel when the VFS wants to know about a file inside a directory. Many lookup calls can occur in parallel, but only one call happens for each (dir, path) pair.

func (*VFS) Mkdir

func (v *VFS) Mkdir(ctx *meta.Context, parent Ino, name string, mode uint32, cumask uint16) (entry *meta.Entry, err syscall.Errno)

func (*VFS) Mknod

func (v *VFS) Mknod(ctx *meta.Context, parent Ino, name string, mode uint32, rdev uint32) (entry *meta.Entry, err syscall.Errno)

Modifying structure.

func (*VFS) Open

func (v *VFS) Open(ctx *meta.Context, ino Ino, flags uint32) (entry *meta.Entry, fh uint64, err syscall.Errno)

func (*VFS) OpenDir

func (v *VFS) OpenDir(ctx *meta.Context, ino Ino) (fh uint64, err syscall.Errno)

Directory handling

func (*VFS) Read

func (v *VFS) Read(ctx *meta.Context, ino Ino, buf []byte, off uint64, fh uint64) (n int, err syscall.Errno)

func (*VFS) ReadDir

func (v *VFS) ReadDir(ctx *meta.Context, ino Ino, fh uint64, offset uint64) (entries []*meta.Entry, err syscall.Errno)
func (v *VFS) Readlink(ctx *meta.Context, ino Ino) (path []byte, err syscall.Errno)

func (*VFS) Release

func (v *VFS) Release(ctx *meta.Context, ino Ino, fh uint64)

func (*VFS) ReleaseDir

func (v *VFS) ReleaseDir(ctx *meta.Context, ino Ino, fh uint64)

func (*VFS) RemoveXAttr

func (v *VFS) RemoveXAttr(ctx *meta.Context, ino Ino, name string) (err syscall.Errno)

RemoveXAttr removes an extended attribute.

func (*VFS) Rename

func (v *VFS) Rename(ctx *meta.Context, parent Ino, name string, newparent Ino, newname string, flags uint32) (err syscall.Errno)

semantic of rename: rename("any", "not_exists") = ok rename("file1", "file2") = ok rename("empty_dir1", "empty_dir2") = ok rename("nonempty_dir1", "empty_dir2") = ok rename("nonempty_dir1", "nonempty_dir2") = ENOTEMPTY rename("file", "dir") = EISDIR rename("dir", "file") = ENOTDIR

func (*VFS) Rmdir

func (v *VFS) Rmdir(ctx *meta.Context, parent Ino, name string) (err syscall.Errno)

func (*VFS) SetAttr

func (v *VFS) SetAttr(ctx *meta.Context, ino Ino, set, mode, uid, gid uint32, atime, mtime int64, atimensec, mtimensec uint32, size uint64) (entry *meta.Entry, err syscall.Errno)

func (*VFS) SetLk

func (v *VFS) SetLk(ctx *meta.Context, ino Ino, fh uint64, owner uint64, start, end uint64, typ uint32, pid uint32, block bool) (err syscall.Errno)

func (*VFS) SetLkw

func (v *VFS) SetLkw(ctx *meta.Context, ino Ino, fh uint64, owner uint64, start, end uint64, typ uint32, pid uint32, block bool) (err syscall.Errno)

func (*VFS) SetXAttr

func (v *VFS) SetXAttr(ctx *meta.Context, ino Ino, name string, value []byte, flags uint32) (err syscall.Errno)

SetAttr writes an extended attribute.

func (*VFS) StatFs

func (v *VFS) StatFs(ctx *meta.Context) (*base.StatfsOut, syscall.Errno)
func (v *VFS) Symlink(ctx *meta.Context, path string, parent Ino, name string) (entry *meta.Entry, err syscall.Errno)

func (*VFS) Truncate

func (v *VFS) Truncate(ctx *meta.Context, ino Ino, size, fh uint64) (err syscall.Errno)
func (v *VFS) Unlink(ctx *meta.Context, parent Ino, name string) (err syscall.Errno)

func (*VFS) Write

func (v *VFS) Write(ctx *meta.Context, ino Ino, buf []byte, off, fh uint64) (err syscall.Errno)

Jump to

Keyboard shortcuts

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