Import upstream version 1.27.1
[debian/tar] / lib / xattr-at.h
1 /* Prototypes for openat-style fd-relative functions for operating with
2    extended file attributes.
3
4    Copyright 2012-2013 Free Software Foundation, Inc.
5
6    This program is free software: you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation, either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18
19 #ifndef XATTRS_AT_H
20 #define XATTRS_AT_H
21
22 #include <sys/types.h>
23 #include <attr/xattr.h>
24
25 /* These are the dir-fd-relative variants of the functions without the
26    "at" suffix.  For example, setxattrat (AT_FDCWD, path, name, value, size,
27    flags &c) is usually equivalent to setxattr (file, name, value, size,
28    flags).  For more info use the setxattr(2), getxattr(2) or listxattr(2)
29    manpages. */
30
31 /* dir-fd-relative setxattr.  Operation sets the VALUE of the extended
32    attribute identified by NAME and associated with the given PATH in the
33    filesystem relatively to directory identified by DIR_FD.  See the
34    setxattr(2) manpage for the description of all parameters. */
35 int setxattrat (int dir_fd, const char *path, const char *name,
36                 const void *value, size_t size, int flags);
37
38 /* dir-fd-relative lsetxattr.  This function is just like setxattrat,
39    except when DIR_FD and FILE specify a symlink:  lsetxattrat operates on the
40    symlink, while the setxattrat operates on the referent of the symlink.  */
41 int lsetxattrat (int dir_fd, const char *path, const char *name,
42                  const void *value, size_t size, int flags);
43
44 /* dir-fd-relative getxattr.  Operation gets the VALUE of the extended
45    attribute idenfified by NAME and associated with the given PATH in the
46    filesystem relatively to directory identified by DIR_FD.  For more info
47    about all parameters see the getxattr(2) manpage. */
48 ssize_t getxattrat (int dir_fd, const char *path, const char *name,
49                     void *value, size_t size);
50
51 /* dir-fd-relative lgetxattr.  This function is just like getxattrat,
52    except when DIR_FD and FILE specify a symlink:  lgetxattrat operates on the
53    symlink, while the getxattrat operates on the referent of the symlink.  */
54 ssize_t lgetxattrat (int dir_fd, const char *path, const char *name,
55                      void *value, size_t size);
56
57 /* dir-fd-relative listxattr.  Obtain the list of extended attrubtes names.  For
58    more info see the listxattr(2) manpage. */
59 ssize_t listxattrat (int dir_fd, const char *path, char *list, size_t size);
60
61 /* dir-fd-relative llistxattr.  This function is just like listxattrat,
62    except when DIR_FD and FILE specify a symlink:  llistxattr operates on the
63    symlink, while the listxattrat operates on the referent of the symlink.  */
64 ssize_t llistxattrat (int dir_fd, const char *path, char *list, size_t size);
65
66 #endif /* XATTRS_AT_H */