inomap

package
v0.0.0-...-ece74ff Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

inomap translates (Dev, Flags, 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, Flags) tuple gets a namespace id assigned. The original inode number is then passed through in the lower 48 bits.

If namespace ids are exhaused, or the original id is larger than 48 bits, the whole (Dev, Flags, 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() *InoMap

New returns a new InoMap.

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. Convience 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, inode number pair.

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.

type TranslateStatZero

type TranslateStatZero struct{}

TranslateStatZero always sets st.Ino to zero. Used for `-sharedstorage`.

func (TranslateStatZero) TranslateStat

func (z TranslateStatZero) TranslateStat(st *syscall.Stat_t)

type TranslateStater

type TranslateStater interface {
	TranslateStat(st *syscall.Stat_t)
}

Jump to

Keyboard shortcuts

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