xattr.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * xattr.h
  4. *
  5. * Copyright (C) 2004, 2008 Oracle. All rights reserved.
  6. */
  7. #ifndef OCFS2_XATTR_H
  8. #define OCFS2_XATTR_H
  9. #include <linux/init.h>
  10. #include <linux/xattr.h>
  11. enum ocfs2_xattr_type {
  12. OCFS2_XATTR_INDEX_USER = 1,
  13. OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS,
  14. OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT,
  15. OCFS2_XATTR_INDEX_TRUSTED,
  16. OCFS2_XATTR_INDEX_SECURITY,
  17. OCFS2_XATTR_MAX
  18. };
  19. struct ocfs2_security_xattr_info {
  20. int enable;
  21. const char *name;
  22. void *value;
  23. size_t value_len;
  24. };
  25. extern const struct xattr_handler ocfs2_xattr_user_handler;
  26. extern const struct xattr_handler ocfs2_xattr_trusted_handler;
  27. extern const struct xattr_handler ocfs2_xattr_security_handler;
  28. extern const struct xattr_handler * const ocfs2_xattr_handlers[];
  29. ssize_t ocfs2_listxattr(struct dentry *, char *, size_t);
  30. int ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int,
  31. const char *, void *, size_t);
  32. int ocfs2_xattr_set(struct inode *, int, const char *, const void *,
  33. size_t, int);
  34. int ocfs2_xattr_set_handle(handle_t *, struct inode *, struct buffer_head *,
  35. int, const char *, const void *, size_t, int,
  36. struct ocfs2_alloc_context *,
  37. struct ocfs2_alloc_context *);
  38. int ocfs2_has_inline_xattr_value_outside(struct inode *inode,
  39. struct ocfs2_dinode *di);
  40. int ocfs2_xattr_remove(struct inode *, struct buffer_head *);
  41. int ocfs2_init_security_get(struct inode *, struct inode *,
  42. const struct qstr *,
  43. struct ocfs2_security_xattr_info *);
  44. int ocfs2_init_security_set(handle_t *, struct inode *,
  45. struct buffer_head *,
  46. struct ocfs2_security_xattr_info *,
  47. struct ocfs2_alloc_context *,
  48. struct ocfs2_alloc_context *);
  49. int ocfs2_calc_security_init(struct inode *,
  50. struct ocfs2_security_xattr_info *,
  51. int *, int *, struct ocfs2_alloc_context **);
  52. int ocfs2_calc_xattr_init(struct inode *, struct buffer_head *,
  53. umode_t, struct ocfs2_security_xattr_info *,
  54. int *, int *, int *);
  55. /*
  56. * xattrs can live inside an inode, as part of an external xattr block,
  57. * or inside an xattr bucket, which is the leaf of a tree rooted in an
  58. * xattr block. Some of the xattr calls, especially the value setting
  59. * functions, want to treat each of these locations as equal. Let's wrap
  60. * them in a structure that we can pass around instead of raw buffer_heads.
  61. */
  62. struct ocfs2_xattr_value_buf {
  63. struct buffer_head *vb_bh;
  64. ocfs2_journal_access_func vb_access;
  65. struct ocfs2_xattr_value_root *vb_xv;
  66. };
  67. int ocfs2_xattr_attach_refcount_tree(struct inode *inode,
  68. struct buffer_head *fe_bh,
  69. struct ocfs2_caching_info *ref_ci,
  70. struct buffer_head *ref_root_bh,
  71. struct ocfs2_cached_dealloc_ctxt *dealloc);
  72. int ocfs2_reflink_xattrs(struct inode *old_inode,
  73. struct buffer_head *old_bh,
  74. struct inode *new_inode,
  75. struct buffer_head *new_bh,
  76. bool preserve_security);
  77. int ocfs2_init_security_and_acl(struct inode *dir,
  78. struct inode *inode,
  79. const struct qstr *qstr);
  80. #endif /* OCFS2_XATTR_H */