inode

package
v0.0.0-...-f7a35a7 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(cwd, name string) string

Abs returns name if name is an absolute path. If name is a relative path then an absolute path is constructed by using cwd as the current working directory.

func PopPath

func PopPath(path string) (string, string)

PopPath returns the first name in `path` and the rest of the `path` string. The path provided must use forward slashes ("/").

Types

type DirEntry

type DirEntry struct {
	Name  string
	Inode *Inode
}

func (*DirEntry) IsDir

func (e *DirEntry) IsDir() bool

type Directory

type Directory []*DirEntry

func (Directory) Len

func (d Directory) Len() int

func (Directory) Less

func (d Directory) Less(i, j int) bool

func (Directory) Swap

func (d Directory) Swap(i, j int)

type Ino

type Ino uint64

func (*Ino) New

func (n *Ino) New(mode os.FileMode) *Inode

func (*Ino) NewDir

func (n *Ino) NewDir(mode os.FileMode) *Inode

func (*Ino) SubIno

func (n *Ino) SubIno()

type Inode

type Inode struct {
	sync.RWMutex

	Ino   uint64
	Mode  fs.FileMode
	Nlink uint64
	Size  int64

	Ctime time.Time // creation time
	Atime time.Time // access time
	Mtime time.Time // modification time

	Dir Directory
}

An Inode represents the basic metadata of a file.

func (*Inode) IsDir

func (n *Inode) IsDir() bool
func (n *Inode) Link(name string, child *Inode) error

Link - link adds a directory entry (DirEntry) for the given node (assumed to be a directory) to the provided child Inode.

func (*Inode) Rename

func (n *Inode) Rename(oldpath, newpath string) error

func (*Inode) Resolve

func (n *Inode) Resolve(path string) (*Inode, error)
func (n *Inode) Unlink(name string) error

Unlink - removes the directory entry (DirEntry).

func (*Inode) UnlinkAll

func (n *Inode) UnlinkAll()

Jump to

Keyboard shortcuts

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