T-Box Basic dev
Loading...
Searching...
No Matches
android_filesystem_capability.h
1/*
2 * Copyright (C) 2013 The Android Open Source Project
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17/*
18 * Taken from linux/capability.h, with minor modifications
19 */
20
21/* clang-format off */
22#ifndef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_FILESYSTEM_CAPABILITY_H
23#define _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_FILESYSTEM_CAPABILITY_H
24
25#include <stdint.h>
26
27#define __user
28#define __u32 uint32_t
29#define __le32 uint32_t
30
31#define _LINUX_CAPABILITY_VERSION_1 0x19980330
32#define _LINUX_CAPABILITY_U32S_1 1
33#define _LINUX_CAPABILITY_VERSION_2 0x20071026
34#define _LINUX_CAPABILITY_U32S_2 2
35#define _LINUX_CAPABILITY_VERSION_3 0x20080522
36#define _LINUX_CAPABILITY_U32S_3 2
37
39 __u32 version;
40 int pid;
41} __user *cap_user_header_t;
42
43typedef struct __user_cap_data_struct {
44 __u32 effective;
45 __u32 permitted;
46 __u32 inheritable;
47} __user *cap_user_data_t;
48
49#define VFS_CAP_REVISION_MASK 0xFF000000
50#define VFS_CAP_REVISION_SHIFT 24
51#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
52#define VFS_CAP_FLAGS_EFFECTIVE 0x000001
53#define VFS_CAP_REVISION_1 0x01000000
54#define VFS_CAP_U32_1 1
55#define XATTR_CAPS_SZ_1 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_1))
56#define VFS_CAP_REVISION_2 0x02000000
57#define VFS_CAP_U32_2 2
58#define XATTR_CAPS_SZ_2 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2))
59#define XATTR_CAPS_SZ XATTR_CAPS_SZ_2
60#define VFS_CAP_U32 VFS_CAP_U32_2
61#define VFS_CAP_REVISION VFS_CAP_REVISION_2
62
64 __le32 magic_etc;
65 struct {
66 __le32 permitted;
67 __le32 inheritable;
68 } data[VFS_CAP_U32];
69};
70
71#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1
72#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1
73#define CAP_CHOWN 0
74#define CAP_DAC_OVERRIDE 1
75#define CAP_DAC_READ_SEARCH 2
76#define CAP_FOWNER 3
77#define CAP_FSETID 4
78#define CAP_KILL 5
79#define CAP_SETGID 6
80#define CAP_SETUID 7
81#define CAP_SETPCAP 8
82#define CAP_LINUX_IMMUTABLE 9
83#define CAP_NET_BIND_SERVICE 10
84#define CAP_NET_BROADCAST 11
85#define CAP_NET_ADMIN 12
86#define CAP_NET_RAW 13
87#define CAP_IPC_LOCK 14
88#define CAP_IPC_OWNER 15
89#define CAP_SYS_MODULE 16
90#define CAP_SYS_RAWIO 17
91#define CAP_SYS_CHROOT 18
92#define CAP_SYS_PTRACE 19
93#define CAP_SYS_PACCT 20
94#define CAP_SYS_ADMIN 21
95#define CAP_SYS_BOOT 22
96#define CAP_SYS_NICE 23
97#define CAP_SYS_RESOURCE 24
98#define CAP_SYS_TIME 25
99#define CAP_SYS_TTY_CONFIG 26
100#define CAP_MKNOD 27
101#define CAP_LEASE 28
102#define CAP_AUDIT_WRITE 29
103#define CAP_AUDIT_CONTROL 30
104#define CAP_SETFCAP 31
105#define CAP_MAC_OVERRIDE 32
106#define CAP_MAC_ADMIN 33
107#define CAP_SYSLOG 34
108#define CAP_WAKE_ALARM 35
109#define CAP_LAST_CAP CAP_WAKE_ALARM
110#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
111#define CAP_TO_INDEX(x) ((x) >> 5)
112#define CAP_TO_MASK(x) (1 << ((x) & 31))
113
114#undef __user
115#undef __u32
116#undef __le32
117
118#endif
119/* clang-format on */
Definition android_filesystem_capability.h:43
Definition android_filesystem_capability.h:38
Definition android_filesystem_capability.h:63