aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/capability.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/capability.h')
-rw-r--r--include/linux/capability.h29
1 files changed, 21 insertions, 8 deletions
diff --git a/include/linux/capability.h b/include/linux/capability.h
index f4ea0dd9a618..fa830f8de032 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -31,11 +31,11 @@ struct task_struct;
31#define _LINUX_CAPABILITY_VERSION_1 0x19980330 31#define _LINUX_CAPABILITY_VERSION_1 0x19980330
32#define _LINUX_CAPABILITY_U32S_1 1 32#define _LINUX_CAPABILITY_U32S_1 1
33 33
34#define _LINUX_CAPABILITY_VERSION_2 0x20071026 34#define _LINUX_CAPABILITY_VERSION_2 0x20071026 /* deprecated - use v3 */
35#define _LINUX_CAPABILITY_U32S_2 2 35#define _LINUX_CAPABILITY_U32S_2 2
36 36
37#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_2 37#define _LINUX_CAPABILITY_VERSION_3 0x20080522
38#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_2 38#define _LINUX_CAPABILITY_U32S_3 2
39 39
40typedef struct __user_cap_header_struct { 40typedef struct __user_cap_header_struct {
41 __u32 version; 41 __u32 version;
@@ -77,10 +77,23 @@ struct vfs_cap_data {
77 } data[VFS_CAP_U32]; 77 } data[VFS_CAP_U32];
78}; 78};
79 79
80#ifdef __KERNEL__ 80#ifndef __KERNEL__
81
82/*
83 * Backwardly compatible definition for source code - trapped in a
84 * 32-bit world. If you find you need this, please consider using
85 * libcap to untrap yourself...
86 */
87#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1
88#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1
89
90#else
91
92#define _KERNEL_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_3
93#define _KERNEL_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_3
81 94
82typedef struct kernel_cap_struct { 95typedef struct kernel_cap_struct {
83 __u32 cap[_LINUX_CAPABILITY_U32S]; 96 __u32 cap[_KERNEL_CAPABILITY_U32S];
84} kernel_cap_t; 97} kernel_cap_t;
85 98
86#define _USER_CAP_HEADER_SIZE (sizeof(struct __user_cap_header_struct)) 99#define _USER_CAP_HEADER_SIZE (sizeof(struct __user_cap_header_struct))
@@ -351,7 +364,7 @@ typedef struct kernel_cap_struct {
351 */ 364 */
352 365
353#define CAP_FOR_EACH_U32(__capi) \ 366#define CAP_FOR_EACH_U32(__capi) \
354 for (__capi = 0; __capi < _LINUX_CAPABILITY_U32S; ++__capi) 367 for (__capi = 0; __capi < _KERNEL_CAPABILITY_U32S; ++__capi)
355 368
356# define CAP_FS_MASK_B0 (CAP_TO_MASK(CAP_CHOWN) \ 369# define CAP_FS_MASK_B0 (CAP_TO_MASK(CAP_CHOWN) \
357 | CAP_TO_MASK(CAP_DAC_OVERRIDE) \ 370 | CAP_TO_MASK(CAP_DAC_OVERRIDE) \
@@ -361,7 +374,7 @@ typedef struct kernel_cap_struct {
361 374
362# define CAP_FS_MASK_B1 (CAP_TO_MASK(CAP_MAC_OVERRIDE)) 375# define CAP_FS_MASK_B1 (CAP_TO_MASK(CAP_MAC_OVERRIDE))
363 376
364#if _LINUX_CAPABILITY_U32S != 2 377#if _KERNEL_CAPABILITY_U32S != 2
365# error Fix up hand-coded capability macro initializers 378# error Fix up hand-coded capability macro initializers
366#else /* HAND-CODED capability initializers */ 379#else /* HAND-CODED capability initializers */
367 380
@@ -372,7 +385,7 @@ typedef struct kernel_cap_struct {
372# define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \ 385# define CAP_NFSD_SET ((kernel_cap_t){{ CAP_FS_MASK_B0|CAP_TO_MASK(CAP_SYS_RESOURCE), \
373 CAP_FS_MASK_B1 } }) 386 CAP_FS_MASK_B1 } })
374 387
375#endif /* _LINUX_CAPABILITY_U32S != 2 */ 388#endif /* _KERNEL_CAPABILITY_U32S != 2 */
376 389
377#define CAP_INIT_INH_SET CAP_EMPTY_SET 390#define CAP_INIT_INH_SET CAP_EMPTY_SET
378 391