xattr.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. extern struct xattr_handler ocfs2_xattr_user_handler;
  30. extern struct xattr_handler ocfs2_xattr_trusted_handler;
  31. extern ssize_t ocfs2_listxattr(struct dentry *, char *, size_t);
  32. extern int ocfs2_xattr_get(struct inode *, int, const char *, void *, size_t);
  33. extern int ocfs2_xattr_set(struct inode *, int, const char *, const void *,
  34. size_t, int);
  35. extern int ocfs2_xattr_remove(struct inode *inode, struct buffer_head *di_bh);
  36. extern struct xattr_handler *ocfs2_xattr_handlers[];
  37. static inline u16 ocfs2_xattr_buckets_per_cluster(struct ocfs2_super *osb)
  38. {
  39. return (1 << osb->s_clustersize_bits) / OCFS2_XATTR_BUCKET_SIZE;
  40. }
  41. static inline u16 ocfs2_blocks_per_xattr_bucket(struct super_block *sb)
  42. {
  43. return OCFS2_XATTR_BUCKET_SIZE / (1 << sb->s_blocksize_bits);
  44. }
  45. static inline u16 ocfs2_xattr_max_xe_in_bucket(struct super_block *sb)
  46. {
  47. u16 len = sb->s_blocksize -
  48. offsetof(struct ocfs2_xattr_header, xh_entries);
  49. return len / sizeof(struct ocfs2_xattr_entry);
  50. }
  51. #endif /* OCFS2_XATTR_H */