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