xattr.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* -*- mode: c; c-basic-offset: 8; -*-
  2. * vim: noexpandtab sw=8 ts=8 sts=0:
  3. *
  4. * xattr.h
  5. *
  6. * Copyright (C) 2004, 2008 Oracle. All rights reserved.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public
  10. * License version 2 as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. */
  17. #ifndef OCFS2_XATTR_H
  18. #define OCFS2_XATTR_H
  19. #include <linux/init.h>
  20. #include <linux/xattr.h>
  21. enum ocfs2_xattr_type {
  22. OCFS2_XATTR_INDEX_USER = 1,
  23. OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS,
  24. OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT,
  25. OCFS2_XATTR_INDEX_TRUSTED,
  26. OCFS2_XATTR_INDEX_SECURITY,
  27. OCFS2_XATTR_MAX
  28. };
  29. struct ocfs2_security_xattr_info {
  30. int enable;
  31. char *name;
  32. void *value;
  33. size_t value_len;
  34. };
  35. extern const struct xattr_handler ocfs2_xattr_user_handler;
  36. extern const struct xattr_handler ocfs2_xattr_trusted_handler;
  37. extern const struct xattr_handler ocfs2_xattr_security_handler;
  38. extern const struct xattr_handler ocfs2_xattr_acl_access_handler;
  39. extern const struct xattr_handler ocfs2_xattr_acl_default_handler;
  40. extern const struct xattr_handler *ocfs2_xattr_handlers[];
  41. ssize_t ocfs2_listxattr(struct dentry *, char *, size_t);
  42. int ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int,
  43. const char *, void *, size_t);
  44. int ocfs2_xattr_set(struct inode *, int, const char *, const void *,
  45. size_t, int);
  46. int ocfs2_xattr_set_handle(handle_t *, struct inode *, struct buffer_head *,
  47. int, const char *, const void *, size_t, int,
  48. struct ocfs2_alloc_context *,
  49. struct ocfs2_alloc_context *);
  50. int ocfs2_has_inline_xattr_value_outside(struct inode *inode,
  51. struct ocfs2_dinode *di);
  52. int ocfs2_xattr_remove(struct inode *, struct buffer_head *);
  53. int ocfs2_init_security_get(struct inode *, struct inode *,
  54. const struct qstr *,
  55. struct ocfs2_security_xattr_info *);
  56. int ocfs2_init_security_set(handle_t *, struct inode *,
  57. struct buffer_head *,
  58. struct ocfs2_security_xattr_info *,
  59. struct ocfs2_alloc_context *,
  60. struct ocfs2_alloc_context *);
  61. int ocfs2_calc_security_init(struct inode *,
  62. struct ocfs2_security_xattr_info *,
  63. int *, int *, struct ocfs2_alloc_context **);
  64. int ocfs2_calc_xattr_init(struct inode *, struct buffer_head *,
  65. umode_t, struct ocfs2_security_xattr_info *,
  66. int *, int *, int *);
  67. /*
  68. * xattrs can live inside an inode, as part of an external xattr block,
  69. * or inside an xattr bucket, which is the leaf of a tree rooted in an
  70. * xattr block. Some of the xattr calls, especially the value setting
  71. * functions, want to treat each of these locations as equal. Let's wrap
  72. * them in a structure that we can pass around instead of raw buffer_heads.
  73. */
  74. struct ocfs2_xattr_value_buf {
  75. struct buffer_head *vb_bh;
  76. ocfs2_journal_access_func vb_access;
  77. struct ocfs2_xattr_value_root *vb_xv;
  78. };
  79. int ocfs2_xattr_attach_refcount_tree(struct inode *inode,
  80. struct buffer_head *fe_bh,
  81. struct ocfs2_caching_info *ref_ci,
  82. struct buffer_head *ref_root_bh,
  83. struct ocfs2_cached_dealloc_ctxt *dealloc);
  84. int ocfs2_reflink_xattrs(struct inode *old_inode,
  85. struct buffer_head *old_bh,
  86. struct inode *new_inode,
  87. struct buffer_head *new_bh,
  88. bool preserve_security);
  89. int ocfs2_init_security_and_acl(struct inode *dir,
  90. struct inode *inode,
  91. const struct qstr *qstr);
  92. #endif /* OCFS2_XATTR_H */