• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef TYPES_EXTRA_H
16 #define TYPES_EXTRA_H
17 
18 /*
19  * This file exports kernel type definitions, which usually are transparent to
20  * user space, to BPF user program. Most of these definitions are specific to arm64
21  * , which is actually the resean why they are not exposed to user space
22 */
23 
24 // kernel types from arm64 linux-5.10
25 #ifdef __CHECKER__
26 #define __bitwise__ __attribute__((bitwise))
27 #else
28 #define __bitwise__
29 #endif
30 #define __bitwise __bitwise__
31 typedef int __bitwise       __kernel_rwf_t;
32 typedef __kernel_rwf_t      rwf_t;
33 typedef int                 __kernel_mqd_t;
34 typedef __kernel_mqd_t		mqd_t;
35 
36 typedef __u32 				compat_size_t;
37 typedef __s32 				compat_ssize_t;
38 typedef __s32 				compat_clock_t;
39 typedef __s32 				compat_pid_t;
40 typedef __u32 				compat_ino_t;
41 typedef __s32 				compat_off_t;
42 typedef __s64 				compat_loff_t;
43 typedef __s32 				compat_daddr_t;
44 typedef __s32 				compat_timer_t;
45 typedef __s32 				compat_key_t;
46 typedef __s16 				compat_short_t;
47 typedef __s32 				compat_int_t;
48 typedef __s32 				compat_long_t;
49 typedef __u16 				compat_ushort_t;
50 typedef __u32 				compat_uint_t;
51 typedef __u32 				compat_ulong_t;
52 typedef __u32 				compat_uptr_t;
53 typedef __u32 				compat_aio_context_t;
54 
55 typedef __u16		        compat_mode_t;
56 typedef unsigned short		umode_t;
57 
58 
59 #ifdef CONFIG_COMPAT_FOR_U64_ALIGNMENT
60 typedef __s64 __attribute__((aligned(4))) compat_s64;
61 typedef __u64 __attribute__((aligned(4))) compat_u64;
62 #else
63 typedef __s64 compat_s64;
64 typedef __u64 compat_u64;
65 #endif
66 
67 typedef unsigned short      __kernel_old_uid_t;
68 typedef unsigned short      __kernel_old_gid_t;
69 #define __kernel_old_uid_t  __kernel_old_uid_t
70 // #ifdef CONFIG_HAVE_UID16
71 /* This is defined by include/asm-{arch}/posix_types.h */
72 typedef __kernel_old_uid_t	old_uid_t;
73 typedef __kernel_old_gid_t	old_gid_t;
74 // #endif /* CONFIG_UID16 */
75 
76 #ifndef loff_t
77 typedef long long	__kernel_loff_t;
78 typedef __kernel_loff_t		loff_t;
79 #endif
80 
81 #endif