xattr-at.h 3.2 KB

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