openfiletable

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package openfiletable maintains a table of currently opened files, identified by the device number + inode number pair. This table is used by fusefrontend to centrally store the current file ID and to lock files against concurrent writes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unregister

func Unregister(qi QIno)

Unregister decrements the reference count for "qi" and deletes the entry from the open file table if the reference count reaches 0.

func WriteOpCount

func WriteOpCount() uint64

WriteOpCount returns the write lock counter value. This value is encremented each time writeLock.Lock() on a file table entry is called.

Types

type Entry

type Entry struct {

	// ContentLock guards the file content from concurrent writes. Every writer
	// must take this lock before modifying the file content.
	ContentLock countingMutex
	// HeaderLock guards the file ID (in this struct) and the file header (on
	// disk). Take HeaderLock.RLock() to make sure the file ID does not change
	// behind your back. If you modify the file ID, you must take
	// HeaderLock.Lock().
	HeaderLock sync.RWMutex
	// ID is the file ID in the file header.
	ID []byte
	// contains filtered or unexported fields
}

Entry is an entry in the open file table

func Register

func Register(qi QIno) *Entry

Register creates an open file table entry for "qi" (or incrementes the reference count if the entry already exists) and returns the entry.

type QIno

type QIno struct {
	// Stat_t.{Dev,Ino} is uint64 on 32- and 64-bit Linux
	Dev uint64
	Ino uint64
}

QIno = Qualified Inode number. Uniquely identifies a backing file through the device number, inode number pair.

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