xattr.h 3.1 KB

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