jfs_xattr.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright (C) International Business Machines Corp., 2000-2002
  4. */
  5. #ifndef H_JFS_XATTR
  6. #define H_JFS_XATTR
  7. #include <linux/xattr.h>
  8. /*
  9. * jfs_ea_list describe the on-disk format of the extended attributes.
  10. * I know the null-terminator is redundant since namelen is stored, but
  11. * I am maintaining compatibility with OS/2 where possible.
  12. */
  13. struct jfs_ea {
  14. u8 flag; /* Unused? */
  15. u8 namelen; /* Length of name */
  16. __le16 valuelen; /* Length of value */
  17. char name[]; /* Attribute name (includes null-terminator) */
  18. }; /* Value immediately follows name */
  19. struct jfs_ea_list {
  20. __le32 size; /* overall size */
  21. struct jfs_ea ea[]; /* Variable length list */
  22. };
  23. /* Macros for defining maxiumum number of bytes supported for EAs */
  24. #define MAXEASIZE 65535
  25. #define MAXEALISTSIZE MAXEASIZE
  26. /*
  27. * some macros for dealing with variable length EA lists.
  28. */
  29. #define EA_SIZE(ea) \
  30. (sizeof (struct jfs_ea) + (ea)->namelen + 1 + \
  31. le16_to_cpu((ea)->valuelen))
  32. #define NEXT_EA(ea) ((struct jfs_ea *) (((char *) (ea)) + (EA_SIZE (ea))))
  33. #define FIRST_EA(ealist) ((ealist)->ea)
  34. #define EALIST_SIZE(ealist) le32_to_cpu((ealist)->size)
  35. #define END_EALIST(ealist) \
  36. ((struct jfs_ea *) (((char *) (ealist)) + EALIST_SIZE(ealist)))
  37. extern int __jfs_setxattr(tid_t, struct inode *, const char *, const void *,
  38. size_t, int);
  39. extern ssize_t __jfs_getxattr(struct inode *, const char *, void *, size_t);
  40. extern ssize_t jfs_listxattr(struct dentry *, char *, size_t);
  41. extern const struct xattr_handler *jfs_xattr_handlers[];
  42. #ifdef CONFIG_JFS_SECURITY
  43. extern int jfs_init_security(tid_t, struct inode *, struct inode *,
  44. const struct qstr *);
  45. #else
  46. static inline int jfs_init_security(tid_t tid, struct inode *inode,
  47. struct inode *dir, const struct qstr *qstr)
  48. {
  49. return 0;
  50. }
  51. #endif
  52. #endif /* H_JFS_XATTR */