jfs_xattr.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. #include <linux/xattr.h>
  21. /*
  22. * jfs_ea_list describe the on-disk format of the extended attributes.
  23. * I know the null-terminator is redundant since namelen is stored, but
  24. * I am maintaining compatibility with OS/2 where possible.
  25. */
  26. struct jfs_ea {
  27. u8 flag; /* Unused? */
  28. u8 namelen; /* Length of name */
  29. __le16 valuelen; /* Length of value */
  30. char name[0]; /* Attribute name (includes null-terminator) */
  31. }; /* Value immediately follows name */
  32. struct jfs_ea_list {
  33. __le32 size; /* overall size */
  34. struct jfs_ea ea[0]; /* Variable length list */
  35. };
  36. /* Macros for defining maxiumum number of bytes supported for EAs */
  37. #define MAXEASIZE 65535
  38. #define MAXEALISTSIZE MAXEASIZE
  39. /*
  40. * some macros for dealing with variable length EA lists.
  41. */
  42. #define EA_SIZE(ea) \
  43. (sizeof (struct jfs_ea) + (ea)->namelen + 1 + \
  44. le16_to_cpu((ea)->valuelen))
  45. #define NEXT_EA(ea) ((struct jfs_ea *) (((char *) (ea)) + (EA_SIZE (ea))))
  46. #define FIRST_EA(ealist) ((ealist)->ea)
  47. #define EALIST_SIZE(ealist) le32_to_cpu((ealist)->size)
  48. #define END_EALIST(ealist) \
  49. ((struct jfs_ea *) (((char *) (ealist)) + EALIST_SIZE(ealist)))
  50. extern int __jfs_setxattr(tid_t, struct inode *, const char *, const void *,
  51. size_t, int);
  52. extern ssize_t __jfs_getxattr(struct inode *, const char *, void *, size_t);
  53. extern ssize_t jfs_listxattr(struct dentry *, char *, size_t);
  54. extern const struct xattr_handler *jfs_xattr_handlers[];
  55. #ifdef CONFIG_JFS_SECURITY
  56. extern int jfs_init_security(tid_t, struct inode *, struct inode *,
  57. const struct qstr *);
  58. #else
  59. static inline int jfs_init_security(tid_t tid, struct inode *inode,
  60. struct inode *dir, const struct qstr *qstr)
  61. {
  62. return 0;
  63. }
  64. #endif
  65. #endif /* H_JFS_XATTR */