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