Portability | portable |
---|---|
Stability | experimental |
Maintainer | Nicola Squartini <tensor5@gmail.com> |
Safe Haskell | Safe |
linux-xattr
provides bindings to the Linux syscalls for reading and
manipulating
extended attributes
(setxattr
,
getxattr
,
listxattr
and
removexattr
).
Each function in this module has two variants: one with the name prefixed by
__l__
and one prefixed by __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
Moreover, every function has an xxx__UserXAttr__
variant for working
transparently in the __user__
namespace of extended attributes, without
worrying about the user.
prefix: these functions automatically prepends
the string user.
to the
of the attribute when Name
is an
input value, or strip the prefix Name
user.
from it when
is a
returned value. See the documentation of each individual function for
details.
Name
- setXAttr :: FilePath -> Name -> Value -> IO ()
- lSetXAttr :: FilePath -> Name -> Value -> IO ()
- fdSetXAttr :: Fd -> Name -> Value -> IO ()
- setUserXAttr :: FilePath -> Name -> Value -> IO ()
- lSetUserXAttr :: FilePath -> Name -> Value -> IO ()
- fdSetUserXAttr :: Fd -> Name -> Value -> IO ()
- createXAttr :: FilePath -> Name -> Value -> IO ()
- lCreateXAttr :: FilePath -> Name -> Value -> IO ()
- fdCreateXAttr :: Fd -> Name -> Value -> IO ()
- createUserXAttr :: FilePath -> Name -> Value -> IO ()
- lCreateUserXAttr :: FilePath -> Name -> Value -> IO ()
- fdCreateUserXAttr :: Fd -> Name -> Value -> IO ()
- replaceXAttr :: FilePath -> Name -> Value -> IO ()
- lReplaceXAttr :: FilePath -> Name -> Value -> IO ()
- fdReplaceXAttr :: Fd -> Name -> Value -> IO ()
- replaceUserXAttr :: FilePath -> Name -> Value -> IO ()
- lReplaceUserXAttr :: FilePath -> Name -> Value -> IO ()
- fdReplaceUserXAttr :: Fd -> Name -> Value -> IO ()
- getXAttr :: FilePath -> Name -> IO Value
- lGetXAttr :: FilePath -> Name -> IO Value
- fdGetXAttr :: Fd -> Name -> IO Value
- getUserXAttr :: FilePath -> Name -> IO Value
- lGetUserXAttr :: FilePath -> Name -> IO Value
- fdGetUserXAttr :: Fd -> Name -> IO Value
- listXAttr :: FilePath -> IO [Name]
- lListXAttr :: FilePath -> IO [Name]
- fdListXAttr :: Fd -> IO [Name]
- listUserXAttr :: FilePath -> IO [Name]
- lListUserXAttr :: FilePath -> IO [Name]
- fdListUserXAttr :: Fd -> IO [Name]
- removeXAttr :: FilePath -> Name -> IO ()
- lRemoveXAttr :: FilePath -> Name -> IO ()
- fdRemoveXAttr :: Fd -> Name -> IO ()
- removeUserXAttr :: FilePath -> Name -> IO ()
- lRemoveUserXAttr :: FilePath -> Name -> IO ()
- fdRemoveUserXAttr :: Fd -> Name -> IO ()
- type Name = String
- type Value = ByteString
Set extended attributes
Functions in this section call the
setxattr
syscall.
Set extended user
attributes
fdSetUserXAttr :: Fd -> Name -> Value -> IO ()Source
fdSetUserXAttr
(Fd
n) foo bar =fdSetXAttr
(Fd
n) user.foo bar
Create extended attributes
Functions in this section call the
setxattr
syscall with the flag XATTR_CREATE
.
createXAttr :: FilePath -> Name -> Value -> IO ()Source
Identical to
, but if the attribute already exists fail with
setXAttr
.
isAlreadyExistsError
lCreateXAttr :: FilePath -> Name -> Value -> IO ()Source
Identical to
, but if the attribute already exists fail with
lSetXAttr
.
isAlreadyExistsError
fdCreateXAttr :: Fd -> Name -> Value -> IO ()Source
Identical to
, but if the attribute already exists fail with
fdSetXAttr
.
isAlreadyExistsError
Create extended user
attributes
fdCreateUserXAttr :: Fd -> Name -> Value -> IO ()Source
fdCreateUserXAttr
(Fd
n) foo bar =fdCreateXAttr
(Fd
n) user.foo bar
Replace extended attributes
Functions in this section call the
setxattr
syscall with the flag XATTR_REPLACE
.
replaceXAttr :: FilePath -> Name -> Value -> IO ()Source
Identical to
, but if the attribute does not exist fail with
setXAttr
.
isDoesNotExistError
lReplaceXAttr :: FilePath -> Name -> Value -> IO ()Source
Identical to
, but if the attribute does not exist fail with
lSetXAttr
.
isDoesNotExistError
fdReplaceXAttr :: Fd -> Name -> Value -> IO ()Source
Identical to
, but if the attribute does not exist fail with
fdSetXAttr
.
isDoesNotExistError
Replace extended user
attributes
fdReplaceUserXAttr :: Fd -> Name -> Value -> IO ()Source
fdReplaceUserXAttr
(Fd
n) foo bar =fdReplaceXAttr
(Fd
n) user.foo bar
Retrieve extended attributes
Functions in this section call the
getxattr
syscall.
getXAttr :: FilePath -> Name -> IO ValueSource
Retrieve the
of the extended attribute identified by Value
and
associated with the given Name
in the filesystem, or fail with
FilePath
if the attribute does not exist.
isDoesNotExistError
lGetXAttr :: FilePath -> Name -> IO ValueSource
Retrieve the
of the extended attribute identified by Value
and
associated with the given Name
in the filesystem, or fail with
FilePath
if the attribute does not exist (do
not follow symbolic links).
isDoesNotExistError
fdGetXAttr :: Fd -> Name -> IO ValueSource
Retrieve the
of the extended attribute identified by Value
and
associated with the given file descriptor in the filesystem, or fail with
Name
if the attribute does not exist.
isDoesNotExistError
Retrieve extended user
attributes
fdGetUserXAttr :: Fd -> Name -> IO ValueSource
fdGetUserXAttr
(Fd
n) foo =fdGetXAttr
(Fd
n) user.foo
List extended attributes
Functions in this section call the
listxattr
syscall.
lListXAttr :: FilePath -> IO [Name]Source
fdListXAttr :: Fd -> IO [Name]Source
Get the list of extended attribute
s associated with the given file
descriptor in the filesystem.
Name
List extended user
attributes
These functions only list those extended attributes with
beginning with Name
user.
. The user.
prefix is removed from each
in the output list.
Name
listUserXAttr :: FilePath -> IO [Name]Source
lListUserXAttr :: FilePath -> IO [Name]Source
fdListUserXAttr :: Fd -> IO [Name]Source
Remove extended attributes
Functions in this section call the
removexattr
syscall.
removeXAttr :: FilePath -> Name -> IO ()Source
Remove the extended attribute identified by
and associated with
the given Name
in the filesystem, or fail with
FilePath
if the attribute does not exist.
isDoesNotExistError
lRemoveXAttr :: FilePath -> Name -> IO ()Source
Remove the extended attribute identified by
and associated with
the given Name
in the filesystem, or fail with
FilePath
if the attribute does not exist (do
not follow symbolic links).
isDoesNotExistError
fdRemoveXAttr :: Fd -> Name -> IO ()Source
Remove the extended attribute identified by
and associated with
the given file descriptor in the filesystem, or fail with
Name
if the attribute does not exist.
isDoesNotExistError
Remove extended user
attributes
removeUserXAttr :: FilePath -> Name -> IO ()Source
lRemoveUserXAttr :: FilePath -> Name -> IO ()Source
fdRemoveUserXAttr :: Fd -> Name -> IO ()Source
fdRemoveUserXAttr
(Fd
n) foo =fdRemoveXAttr
(Fd
n) user.foo
Types for extended attributes
type Value = ByteStringSource
Value of extended attribute.