inode

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NBLKINO   uint64 = 10 // # blk in an inode's blks array
	NDIRECT   uint64 = NBLKINO - 2
	INDIRECT  uint64 = NBLKINO - 2
	DINDIRECT uint64 = NBLKINO - 1
	NBLKBLK   uint64 = disk.BlockSize / 8 // # blkno per block
	NINDLEVEL uint64 = 2                  // # levels of indirection
)
View Source
const NF3FREE nfstypes.Ftype3 = 0

Variables

This section is empty.

Functions

func MaxFileSize

func MaxFileSize() uint64

func NfstimeNow

func NfstimeNow() nfstypes.Nfstime3

Types

type Inode

type Inode struct {
	// in-memory info:
	Inum   common.Inum
	Dcache *dcache.Dcache

	// the on-disk inode:
	Kind  nfstypes.Ftype3
	Nlink uint32
	Gen   uint64
	Size  uint64

	// if ShrinkSize > Size, then the inode is in the process
	// of shrinking to Size. ShrinkSize is in block units
	ShrinkSize uint64

	Atime nfstypes.Nfstime3
	Mtime nfstypes.Nfstime3
	// contains filtered or unexported fields
}

func Decode

func Decode(buf *buf.Buf, inum common.Inum) *Inode

func MkRootInode

func MkRootInode() *Inode
func (ip *Inode) DecLink(atxn *alloctxn.AllocTxn) bool

func (*Inode) Encode

func (ip *Inode) Encode() []byte

func (*Inode) FreeInode

func (ip *Inode) FreeInode(atxn *alloctxn.AllocTxn)

func (*Inode) InitInode

func (ip *Inode) InitInode(inum common.Inum, kind nfstypes.Ftype3)

func (*Inode) IsShrinking

func (ip *Inode) IsShrinking() bool

func (*Inode) MkFattr

func (ip *Inode) MkFattr() nfstypes.Fattr3

func (*Inode) Read

func (ip *Inode) Read(atxn *alloctxn.AllocTxn, offset uint64, bytesToRead uint64) ([]byte,
	bool)

Returns number of bytes read and eof

func (*Inode) Resize

func (ip *Inode) Resize(atxn *alloctxn.AllocTxn, sz uint64) bool

Resize updates the inode, but may not free immediately if the inode shrinks. It creates a new thread to free blocks in a separate transaction, if shrinking involves freeing many blocks. ShrinkSize tracks shrinking progress, and is initialized with the old size.

func (*Inode) Shrink

func (ip *Inode) Shrink(op *alloctxn.AllocTxn) bool

Frees as many blocks as possible, and returns if more shrinking is necessary. 5: inode block, 2xbitmap block, indirect block, double indirect

func (*Inode) String

func (ip *Inode) String() string

func (*Inode) Write

func (ip *Inode) Write(atxn *alloctxn.AllocTxn, offset uint64,
	count uint64, dataBuf []byte) (uint64, bool)

Returns number of bytes written and error

func (*Inode) WriteInode

func (ip *Inode) WriteInode(atxn *alloctxn.AllocTxn)

Jump to

Keyboard shortcuts

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