xfs_cap.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it would be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write the Free Software Foundation,
  16. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef __XFS_CAP_H__
  19. #define __XFS_CAP_H__
  20. /*
  21. * Capabilities
  22. */
  23. typedef __uint64_t xfs_cap_value_t;
  24. typedef struct xfs_cap_set {
  25. xfs_cap_value_t cap_effective; /* use in capability checks */
  26. xfs_cap_value_t cap_permitted; /* combined with file attrs */
  27. xfs_cap_value_t cap_inheritable;/* pass through exec */
  28. } xfs_cap_set_t;
  29. /* On-disk XFS extended attribute names */
  30. #define SGI_CAP_FILE "SGI_CAP_FILE"
  31. #define SGI_CAP_FILE_SIZE (sizeof(SGI_CAP_FILE)-1)
  32. #define SGI_CAP_LINUX "SGI_CAP_LINUX"
  33. #define SGI_CAP_LINUX_SIZE (sizeof(SGI_CAP_LINUX)-1)
  34. /*
  35. * For Linux, we take the bitfields directly from capability.h
  36. * and no longer attempt to keep this attribute ondisk compatible
  37. * with IRIX. Since this attribute is only set on executables,
  38. * it just doesn't make much sense to try. We do use a different
  39. * named attribute though, to avoid confusion.
  40. */
  41. #ifdef __KERNEL__
  42. #ifdef CONFIG_FS_POSIX_CAP
  43. #include <linux/posix_cap_xattr.h>
  44. struct bhv_vnode;
  45. extern int xfs_cap_vhascap(struct bhv_vnode *);
  46. extern int xfs_cap_vset(struct bhv_vnode *, void *, size_t);
  47. extern int xfs_cap_vget(struct bhv_vnode *, void *, size_t);
  48. extern int xfs_cap_vremove(struct bhv_vnode *);
  49. #define _CAP_EXISTS xfs_cap_vhascap
  50. #else
  51. #define xfs_cap_vset(v,p,sz) (-EOPNOTSUPP)
  52. #define xfs_cap_vget(v,p,sz) (-EOPNOTSUPP)
  53. #define xfs_cap_vremove(v) (-EOPNOTSUPP)
  54. #define _CAP_EXISTS (NULL)
  55. #endif
  56. #endif /* __KERNEL__ */
  57. #endif /* __XFS_CAP_H__ */