Global replace of Nicira Networks.
[sliver-openvswitch.git] / include / linux / types.h
1 /*
2  * Copyright (c) 2011 Nicira, Inc.
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 #ifndef LINUX_TYPES_H
18 #define LINUX_TYPES_H 1
19
20 /* On Linux, this header file just includes <linux/types.h>.
21  *
22  * On other platforms, this header file implements just enough of
23  * <linux/types.h> to allow <linux/openvswitch.h> to work, that is, it defines
24  * the __u<N> and __be<N> types. */
25
26 #ifdef __KERNEL__
27 #include_next <linux/types.h>
28 #elif defined(HAVE_LINUX_TYPES_H)
29 /* With some combinations of kernel and userspace headers, including both
30  * <sys/types.h> and <linux/types.h> only works if you do so in that order, so
31  * force it.  */
32
33 #ifdef __CHECKER__
34 #define __CHECK_ENDIAN__
35 #endif
36
37 #include <sys/types.h>
38 #include_next <linux/types.h>
39 #else  /* no <linux/types.h> */
40 #include <stdint.h>
41
42 #ifdef __CHECKER__
43 #define __bitwise__ __attribute__((bitwise))
44 #else
45 #define __bitwise__
46 #endif
47
48 typedef uint8_t  __u8;
49 typedef uint16_t __u16;
50 typedef uint32_t __u32;
51 typedef uint64_t __u64;
52
53 typedef uint16_t __bitwise__ __be16;
54 typedef uint32_t __bitwise__ __be32;
55 typedef uint64_t __bitwise__ __be64;
56 #endif  /* no <linux/types.h> */
57
58 #endif /* <linux/types.h> */