hardlink

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileID added in v1.13.0

type FileID struct {
	// contains filtered or unexported fields
}

FileID is an opaque, comparable file identity: one kind byte and 24 raw bytes with the unused tail zeroed, so == and map keys stay well-defined. An ID only means something on the filesystem that produced it; compare IDs through fsops.SameFile or key maps by fsops.FileKey.

func FileIDFromBytes added in v1.33.0

func FileIDFromBytes(b []byte) FileID

FileIDFromBytes is the inverse of Bytes. Any other length is no identity, which is what a row written before the tagged form decodes to.

func GetFileID added in v1.13.0

func GetFileID(fi os.FileInfo, _ string) (FileID, uint64, error)

GetFileID returns the FileID and link count for a file without allocations. This is more efficient than LinkInfo when you don't need the string representation.

func RemoteFileID added in v1.33.0

func RemoteFileID(raw []byte) FileID

RemoteFileID wraps up to 24 bytes of identity a remote host reported. Empty or longer input is no identity: cutting it would let two identities that share their first 24 bytes compare equal.

func UnixFileID added in v1.33.0

func UnixFileID(dev, ino uint64) FileID

UnixFileID builds the identity of a (device, inode) pair.

func WindowsFileID added in v1.33.0

func WindowsFileID(volumeSerial uint64, identifier [16]byte) FileID

WindowsFileID builds the identity of a volume serial and file identifier.

func (FileID) Bytes added in v1.13.0

func (f FileID) Bytes() []byte

Bytes returns the tagged form, kind byte first. This is what dirscan stores.

func (FileID) IsZero added in v1.13.0

func (f FileID) IsZero() bool

IsZero reports no identity.

func (FileID) Kind added in v1.33.0

func (f FileID) Kind() Kind

Kind reports which domain the ID belongs to.

func (FileID) Less added in v1.13.0

func (f FileID) Less(other FileID) bool

Less orders IDs by kind, then raw bytes, for stable signatures.

func (FileID) WriteToHash added in v1.13.0

func (f FileID) WriteToHash(h hash.Hash)

WriteToHash writes the tagged form without allocating a slice.

type Kind added in v1.33.0

type Kind uint8

Kind tags which identity domain a FileID's bytes came from.

const (
	KindNone    Kind = iota
	KindUnix         // device and inode, big endian
	KindWindows      // volume serial and the 16-byte file identifier
	KindRemote       // reported by a remote host; peer-asserted, never kernel-attested
)

Jump to

Keyboard shortcuts

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