Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 2 | * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. |
| 3 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License as |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * published by the Free Software Foundation. |
| 8 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 9 | * This program is distributed in the hope that it would be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write the Free Software Foundation, |
| 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | */ |
| 18 | #ifndef __XFS_CAP_H__ |
| 19 | #define __XFS_CAP_H__ |
| 20 | |
| 21 | /* |
| 22 | * Capabilities |
| 23 | */ |
| 24 | typedef __uint64_t xfs_cap_value_t; |
| 25 | |
| 26 | typedef struct xfs_cap_set { |
| 27 | xfs_cap_value_t cap_effective; /* use in capability checks */ |
| 28 | xfs_cap_value_t cap_permitted; /* combined with file attrs */ |
| 29 | xfs_cap_value_t cap_inheritable;/* pass through exec */ |
| 30 | } xfs_cap_set_t; |
| 31 | |
| 32 | /* On-disk XFS extended attribute names */ |
| 33 | #define SGI_CAP_FILE "SGI_CAP_FILE" |
| 34 | #define SGI_CAP_FILE_SIZE (sizeof(SGI_CAP_FILE)-1) |
| 35 | #define SGI_CAP_LINUX "SGI_CAP_LINUX" |
| 36 | #define SGI_CAP_LINUX_SIZE (sizeof(SGI_CAP_LINUX)-1) |
| 37 | |
| 38 | /* |
| 39 | * For Linux, we take the bitfields directly from capability.h |
| 40 | * and no longer attempt to keep this attribute ondisk compatible |
Nathan Scott | c41564b | 2006-03-29 08:55:14 +1000 | [diff] [blame] | 41 | * with IRIX. Since this attribute is only set on executables, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | * it just doesn't make much sense to try. We do use a different |
| 43 | * named attribute though, to avoid confusion. |
| 44 | */ |
| 45 | |
| 46 | #ifdef __KERNEL__ |
| 47 | |
| 48 | #ifdef CONFIG_FS_POSIX_CAP |
| 49 | |
| 50 | #include <linux/posix_cap_xattr.h> |
| 51 | |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 52 | struct bhv_vnode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 54 | extern int xfs_cap_vhascap(struct bhv_vnode *); |
| 55 | extern int xfs_cap_vset(struct bhv_vnode *, void *, size_t); |
| 56 | extern int xfs_cap_vget(struct bhv_vnode *, void *, size_t); |
| 57 | extern int xfs_cap_vremove(struct bhv_vnode *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
| 59 | #define _CAP_EXISTS xfs_cap_vhascap |
| 60 | |
| 61 | #else |
| 62 | #define xfs_cap_vset(v,p,sz) (-EOPNOTSUPP) |
| 63 | #define xfs_cap_vget(v,p,sz) (-EOPNOTSUPP) |
| 64 | #define xfs_cap_vremove(v) (-EOPNOTSUPP) |
| 65 | #define _CAP_EXISTS (NULL) |
| 66 | #endif |
| 67 | |
| 68 | #endif /* __KERNEL__ */ |
| 69 | |
| 70 | #endif /* __XFS_CAP_H__ */ |