XAttr-0.1: Read, set, and list extended attributes

System.XAttr

Contents

Description

XAttr provides bindings to the glibc function for reading and manipulating extended attributes (setxattr, getxattr, listxattr, ...).

Each function in this module has two variants: the one with the name prefixed by "l" and "fd". Both of these are identical to the original version except that the "l"-variant does not follow symbolic link but acts on the link itself, and the "fd"-variant take a file descriptor as argument rather than a filepath.

Synopsis

Set extended attributes

setXAttrSource

Arguments

:: FilePath

target file

-> String

name of attribute to set

-> String

value of attribute

-> IO () 

setXAttr sets the value of an extended attribute.

Create extended attributes

createXAttr :: FilePath -> String -> String -> IO ()Source

createXAttr is identical to setXAttr, but if the attribute already exists it fails and sets errno to EEXIST.

Replace extended attributes

replaceXAttr :: FilePath -> String -> String -> IO ()Source

replaceXAttr is identical to setXAttr, but if the attribute does not exist it fails and sets errno to ENOATTR.

Retrive extended attributes

getXAttrSource

Arguments

:: FilePath

target file

-> String

name of the attribute

-> IO String

value of the attribute

getXAttr retrieves the value of an extended attribute

List extended attributes

listXAttrSource

Arguments

:: FilePath

target file

-> IO [String]

list of attribute names

listXAttr retrieves the list of attribute names associated with the given filepath.

Remove extended attributes

removeXAttrSource

Arguments

:: FilePath

target file

-> String

name of the attribute

-> IO () 

removeXAttr removes an extended attribute from the give filepath.