2 * Copyright (C) 2013 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * Taken from linux/capability.h, with minor modifications
21 #ifndef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_FILESYSTEM_CAPABILITY_H
22 #define _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_FILESYSTEM_CAPABILITY_H
27 #define __u32 uint32_t
28 #define __le32 uint32_t
30 #define _LINUX_CAPABILITY_VERSION_1 0x19980330
31 #define _LINUX_CAPABILITY_U32S_1 1
32 #define _LINUX_CAPABILITY_VERSION_2 0x20071026
33 #define _LINUX_CAPABILITY_U32S_2 2
34 #define _LINUX_CAPABILITY_VERSION_3 0x20080522
35 #define _LINUX_CAPABILITY_U32S_3 2
37 typedef struct __user_cap_header_struct {
40 } __user *cap_user_header_t;
42 typedef struct __user_cap_data_struct {
46 } __user *cap_user_data_t;
48 #define VFS_CAP_REVISION_MASK 0xFF000000
49 #define VFS_CAP_REVISION_SHIFT 24
50 #define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
51 #define VFS_CAP_FLAGS_EFFECTIVE 0x000001
52 #define VFS_CAP_REVISION_1 0x01000000
53 #define VFS_CAP_U32_1 1
54 #define XATTR_CAPS_SZ_1 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_1))
55 #define VFS_CAP_REVISION_2 0x02000000
56 #define VFS_CAP_U32_2 2
57 #define XATTR_CAPS_SZ_2 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2))
58 #define XATTR_CAPS_SZ XATTR_CAPS_SZ_2
59 #define VFS_CAP_U32 VFS_CAP_U32_2
60 #define VFS_CAP_REVISION VFS_CAP_REVISION_2
70 #define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1
71 #define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1
73 #define CAP_DAC_OVERRIDE 1
74 #define CAP_DAC_READ_SEARCH 2
81 #define CAP_LINUX_IMMUTABLE 9
82 #define CAP_NET_BIND_SERVICE 10
83 #define CAP_NET_BROADCAST 11
84 #define CAP_NET_ADMIN 12
85 #define CAP_NET_RAW 13
86 #define CAP_IPC_LOCK 14
87 #define CAP_IPC_OWNER 15
88 #define CAP_SYS_MODULE 16
89 #define CAP_SYS_RAWIO 17
90 #define CAP_SYS_CHROOT 18
91 #define CAP_SYS_PTRACE 19
92 #define CAP_SYS_PACCT 20
93 #define CAP_SYS_ADMIN 21
94 #define CAP_SYS_BOOT 22
95 #define CAP_SYS_NICE 23
96 #define CAP_SYS_RESOURCE 24
97 #define CAP_SYS_TIME 25
98 #define CAP_SYS_TTY_CONFIG 26
101 #define CAP_AUDIT_WRITE 29
102 #define CAP_AUDIT_CONTROL 30
103 #define CAP_SETFCAP 31
104 #define CAP_MAC_OVERRIDE 32
105 #define CAP_MAC_ADMIN 33
106 #define CAP_SYSLOG 34
107 #define CAP_WAKE_ALARM 35
108 #define CAP_LAST_CAP CAP_WAKE_ALARM
109 #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
110 #define CAP_TO_INDEX(x) ((x) >> 5)
111 #define CAP_TO_MASK(x) (1 << ((x) & 31))