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