Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  *   Copyright (C) International Business Machines Corp., 2000-2002
0004  */
0005 
0006 #ifndef H_JFS_XATTR
0007 #define H_JFS_XATTR
0008 
0009 #include <linux/xattr.h>
0010 
0011 /*
0012  * jfs_ea_list describe the on-disk format of the extended attributes.
0013  * I know the null-terminator is redundant since namelen is stored, but
0014  * I am maintaining compatibility with OS/2 where possible.
0015  */
0016 struct jfs_ea {
0017     u8 flag;    /* Unused? */
0018     u8 namelen; /* Length of name */
0019     __le16 valuelen;    /* Length of value */
0020     char name[];    /* Attribute name (includes null-terminator) */
0021 };          /* Value immediately follows name */
0022 
0023 struct jfs_ea_list {
0024     __le32 size;        /* overall size */
0025     struct jfs_ea ea[]; /* Variable length list */
0026 };
0027 
0028 /* Macros for defining maxiumum number of bytes supported for EAs */
0029 #define MAXEASIZE   65535
0030 #define MAXEALISTSIZE   MAXEASIZE
0031 
0032 /*
0033  * some macros for dealing with variable length EA lists.
0034  */
0035 #define EA_SIZE(ea) \
0036     (sizeof (struct jfs_ea) + (ea)->namelen + 1 + \
0037      le16_to_cpu((ea)->valuelen))
0038 #define NEXT_EA(ea) ((struct jfs_ea *) (((char *) (ea)) + (EA_SIZE (ea))))
0039 #define FIRST_EA(ealist) ((ealist)->ea)
0040 #define EALIST_SIZE(ealist) le32_to_cpu((ealist)->size)
0041 #define END_EALIST(ealist) \
0042     ((struct jfs_ea *) (((char *) (ealist)) + EALIST_SIZE(ealist)))
0043 
0044 extern int __jfs_setxattr(tid_t, struct inode *, const char *, const void *,
0045               size_t, int);
0046 extern ssize_t __jfs_getxattr(struct inode *, const char *, void *, size_t);
0047 extern ssize_t jfs_listxattr(struct dentry *, char *, size_t);
0048 
0049 extern const struct xattr_handler *jfs_xattr_handlers[];
0050 
0051 #ifdef CONFIG_JFS_SECURITY
0052 extern int jfs_init_security(tid_t, struct inode *, struct inode *,
0053                  const struct qstr *);
0054 #else
0055 static inline int jfs_init_security(tid_t tid, struct inode *inode,
0056                     struct inode *dir, const struct qstr *qstr)
0057 {
0058     return 0;
0059 }
0060 #endif
0061 
0062 #endif  /* H_JFS_XATTR */