inomap

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

inomap translates (Dev, Tag, Ino) tuples to unique uint64 inode numbers.

Format of the returned inode numbers:

[spill bit = 0][15 bit namespace id][48 bit passthru inode number]
[spill bit = 1][63 bit spill inode number                        ]

Each (Dev, Tag) tuple gets a namespace id assigned. The original inode number is then passed through in the lower 48 bits.

If namespace ids are exhausted, or the original id is larger than 48 bits, the whole (Dev, Tag, Ino) tuple gets mapped in the spill map, and the spill bit is set to 1.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InoMap

type InoMap struct {
	sync.Mutex
	// contains filtered or unexported fields
}

InoMap stores the maps using for inode number translation. See package comment for details.

func New

func New(rootDev uint64) *InoMap

New returns a new InoMap. Inode numbers on device `rootDev` will be passed through as-is. If `rootDev` is zero, the first Translate() call decides the effective rootDev.

func (*InoMap) Translate

func (m *InoMap) Translate(in QIno) (out uint64)

Translate maps the passed-in (device, inode) pair to a unique inode number.

func (*InoMap) TranslateStat

func (m *InoMap) TranslateStat(st *syscall.Stat_t)

TranslateStat translates (device, ino) pair contained in "st" into a unique inode number and overwrites the ino in "st" with it. Convenience wrapper around Translate().

type QIno

type QIno struct {

	// Stat_t.Ino is uint64 on 32- and 64-bit Linu
	Ino uint64
	// contains filtered or unexported fields
}

QIno = Qualified Inode number. Uniquely identifies a backing file through the (device number, tag, inode number) tuple.

func NewQIno

func NewQIno(dev uint64, tag uint8, ino uint64) QIno

NewQIno returns a filled QIno struct

func QInoFromStat

func QInoFromStat(st *syscall.Stat_t) QIno

QInoFromStat fills a new QIno struct with the passed Stat_t info.

Jump to

Keyboard shortcuts

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