jfs_xattr.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (C) International Business Machines Corp., 2000-2002
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  12. * the 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 to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. */
  18. #ifndef H_JFS_XATTR
  19. #define H_JFS_XATTR
  20. /*
  21. * jfs_ea_list describe the on-disk format of the extended attributes.
  22. * I know the null-terminator is redundant since namelen is stored, but
  23. * I am maintaining compatibility with OS/2 where possible.
  24. */
  25. struct jfs_ea {
  26. u8 flag; /* Unused? */
  27. u8 namelen; /* Length of name */
  28. __le16 valuelen; /* Length of value */
  29. char name[0]; /* Attribute name (includes null-terminator) */
  30. }; /* Value immediately follows name */
  31. struct jfs_ea_list {
  32. __le32 size; /* overall size */
  33. struct jfs_ea ea[0]; /* Variable length list */
  34. };
  35. /* Macros for defining maxiumum number of bytes supported for EAs */
  36. #define MAXEASIZE 65535
  37. #define MAXEALISTSIZE MAXEASIZE
  38. /*
  39. * some macros for dealing with variable length EA lists.
  40. */
  41. #define EA_SIZE(ea) \
  42. (sizeof (struct jfs_ea) + (ea)->namelen + 1 + \
  43. le16_to_cpu((ea)->valuelen))
  44. #define NEXT_EA(ea) ((struct jfs_ea *) (((char *) (ea)) + (EA_SIZE (ea))))
  45. #define FIRST_EA(ealist) ((ealist)->ea)
  46. #define EALIST_SIZE(ealist) le32_to_cpu((ealist)->size)
  47. #define END_EALIST(ealist) \
  48. ((struct jfs_ea *) (((char *) (ealist)) + EALIST_SIZE(ealist)))
  49. extern int __jfs_setxattr(tid_t, struct inode *, const char *, const void *,
  50. size_t, int);
  51. extern int jfs_setxattr(struct dentry *, const char *, const void *, size_t,
  52. int);
  53. extern ssize_t __jfs_getxattr(struct inode *, const char *, void *, size_t);
  54. extern ssize_t jfs_getxattr(struct dentry *, const char *, void *, size_t);
  55. extern ssize_t jfs_listxattr(struct dentry *, char *, size_t);
  56. extern int jfs_removexattr(struct dentry *, const char *);
  57. extern const struct xattr_handler *jfs_xattr_handlers[];
  58. #ifdef CONFIG_JFS_SECURITY
  59. extern int jfs_init_security(tid_t, struct inode *, struct inode *,
  60. const struct qstr *);
  61. #else
  62. static inline int jfs_init_security(tid_t tid, struct inode *inode,
  63. struct inode *dir, const struct qstr *qstr)
  64. {
  65. return 0;
  66. }
  67. #endif
  68. #endif /* H_JFS_XATTR */