Documentation ¶
Overview ¶
Package xattr provides support for extended attributes on linux, darwin and freebsd. Extended attributes are name:value pairs associated permanently with files and directories, similar to the environment strings associated with a process. An attribute may be defined or undefined. If it is defined, its value may be empty or non-empty. More details you can find here: https://en.wikipedia.org/wiki/Extended_file_attributes .
All functions are provided in triples: Get/LGet/FGet, Set/LSet/FSet etc. The "L" variant will not follow a symlink at the end of the path, and "F" variant accepts a file descriptor instead of a path.
Example for "L" variant, assuming path is "/symlink1/symlink2", where both components are symlinks: Get will follow "symlink1" and "symlink2" and operate on the target of "symlink2". LGet will follow "symlink1" but operate directly on "symlink2".
Index ¶
- Constants
- func FGet(f *os.File, name string) ([]byte, error)
- func FList(f *os.File) ([]string, error)
- func FRemove(f *os.File, name string) error
- func FSet(f *os.File, name string, data []byte) error
- func FSetWithFlags(f *os.File, name string, data []byte, flags int) error
- func Get(path, name string) ([]byte, error)
- func LGet(path, name string) ([]byte, error)
- func LList(path string) ([]string, error)
- func LRemove(path, name string) error
- func LSet(path, name string, data []byte) error
- func LSetWithFlags(path, name string, data []byte, flags int) error
- func List(path string) ([]string, error)
- func Remove(path, name string) error
- func Set(path, name string, data []byte) error
- func SetWithFlags(path, name string, data []byte, flags int) error
- type Error
Constants ¶
const ( XATTR_CREATE = unix.XATTR_CREATE XATTR_REPLACE = unix.XATTR_REPLACE // ENOATTR is not exported by the syscall package on Linux, because it is // an alias for ENODATA. We export it here so it is available on all // our supported platforms. ENOATTR = syscall.ENODATA )
Variables ¶
This section is empty.
Functions ¶
func FSetWithFlags ¶ added in v0.4.0
FSetWithFlags is like SetWithFlags but accepts a os.File instead of a file path.
func Get ¶ added in v0.2.0
Get retrieves extended attribute data associated with path. It will follow all symlinks along the path.
func LList ¶ added in v0.3.0
LList is like List but does not follow a symlink at the end of the path.
func LRemove ¶ added in v0.3.0
LRemove is like Remove but does not follow a symlink at the end of the path.
func LSetWithFlags ¶ added in v0.3.0
LSetWithFlags is like SetWithFlags but does not follow a symlink at the end of the path.
func List ¶ added in v0.2.0
List retrieves a list of names of extended attributes associated with the given path in the file system.