xattr

package
v0.0.0-...-c3677c5 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const (

	// XATTR_MAXNAMELEN comes from the maximal allowed key size that can be stored on ext, given the length is specified in u8
	XATTR_MAXNAMELEN = 255 // nolint: golint

	// ENOATTR is the error code returned when an attribute doesn't exist
	ENOATTR = syscall.ENODATA // nolint: golint
)
View Source
const (

	// MimeTypeAttr is the key of the xattr for file mime types
	MimeTypeAttr = "user.mime_type"
)

Variables

View Source
var ErrInvalidKey = errors.New("Key Invalid")

ErrInvalidKey is returned when a key is 0 bytes, or otherwise considered as invalid

Functions

func FDelXattr

func FDelXattr(file *os.File, key string) error

FDelXattr deletes an xattr for a given file handle

func FGetXattr

func FGetXattr(file *os.File, key string) ([]byte, error)

FGetXattr gets an xattr for a given file handle

func FListXattrs

func FListXattrs(file *os.File) (map[string]struct{}, error)

FListXattrs lists xattrs given a specific file handle

func FSetXattr

func FSetXattr(file *os.File, key string, value []byte) error

FSetXattr sets an xattr for a given file handle

func GetMimeType

func GetMimeType(filename string) string

GetMimeType tries to get the mime type for a given filename based on the xattr

func GetXattr

func GetXattr(path string, key string) ([]byte, error)

GetXattr gets an xattr given a particular filename

func ListXattrs

func ListXattrs(path string) (map[string]struct{}, error)

ListXattrs returns a set of all of the xattrs on a file

func MakeHole

func MakeHole(file *os.File, start, len int64) error

MakeHole zeros out a chunk of a file, ideally deallocating space underneath it

func SetXattr

func SetXattr(path string, key string, value []byte) error

SetXattr sets, or overwrites a key-value attribute pair for the given filename

Types

This section is empty.

Jump to

Keyboard shortcuts

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