blob: 71aac119a1da51cac9c109e1e08b8bad47ab01c4 [file] [log] [blame]
Ben Cheng655a7c02013-10-16 16:09:24 -07001/****************************************************************************
2 ****************************************************************************
3 ***
4 *** This header was automatically generated from a Linux kernel header
5 *** of the same name, to make information necessary for userspace to
6 *** call into the kernel available to libc. It contains only constants,
7 *** structures, and macros generated from the original header, and thus,
8 *** contains no copyrightable information.
9 ***
10 *** To edit the content of this header, modify the corresponding
11 *** source file (e.g. under external/kernel-headers/original/) then
12 *** run bionic/libc/kernel/tools/update_all.py
13 ***
14 *** Any manual change here will be lost the next time this script will
15 *** be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _UAPI_LINUX_SWAB_H
20#define _UAPI_LINUX_SWAB_H
21#include <linux/types.h>
22#include <linux/compiler.h>
23/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
24#include <asm/swab.h>
Tao Baod7db5942015-01-28 10:07:51 -080025#define ___constant_swab16(x) ((__u16) ((((__u16) (x) & (__u16) 0x00ffU) << 8) | (((__u16) (x) & (__u16) 0xff00U) >> 8)))
26#define ___constant_swab32(x) ((__u32) ((((__u32) (x) & (__u32) 0x000000ffUL) << 24) | (((__u32) (x) & (__u32) 0x0000ff00UL) << 8) | (((__u32) (x) & (__u32) 0x00ff0000UL) >> 8) | (((__u32) (x) & (__u32) 0xff000000UL) >> 24)))
27#define ___constant_swab64(x) ((__u64) ((((__u64) (x) & (__u64) 0x00000000000000ffULL) << 56) | (((__u64) (x) & (__u64) 0x000000000000ff00ULL) << 40) | (((__u64) (x) & (__u64) 0x0000000000ff0000ULL) << 24) | (((__u64) (x) & (__u64) 0x00000000ff000000ULL) << 8) | (((__u64) (x) & (__u64) 0x000000ff00000000ULL) >> 8) | (((__u64) (x) & (__u64) 0x0000ff0000000000ULL) >> 24) | (((__u64) (x) & (__u64) 0x00ff000000000000ULL) >> 40) | (((__u64) (x) & (__u64) 0xff00000000000000ULL) >> 56)))
Ben Cheng655a7c02013-10-16 16:09:24 -070028/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Tao Baod7db5942015-01-28 10:07:51 -080029#define ___constant_swahw32(x) ((__u32) ((((__u32) (x) & (__u32) 0x0000ffffUL) << 16) | (((__u32) (x) & (__u32) 0xffff0000UL) >> 16)))
30#define ___constant_swahb32(x) ((__u32) ((((__u32) (x) & (__u32) 0x00ff00ffUL) << 8) | (((__u32) (x) & (__u32) 0xff00ff00UL) >> 8)))
Christopher Ferris106b3a82016-08-24 12:15:38 -070031#ifdef __arch_swab16
32#else
Ben Cheng655a7c02013-10-16 16:09:24 -070033/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris106b3a82016-08-24 12:15:38 -070034#endif
35#ifdef __arch_swab32
Ben Cheng655a7c02013-10-16 16:09:24 -070036#else
37#endif
Ben Cheng655a7c02013-10-16 16:09:24 -070038/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris106b3a82016-08-24 12:15:38 -070039#ifdef __arch_swab64
Ben Cheng655a7c02013-10-16 16:09:24 -070040#elif defined(__SWAB_64_THRU_32__)
41#else
42#endif
Ben Cheng655a7c02013-10-16 16:09:24 -070043/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070044static inline __attribute__((__const__)) __u32 __fswahw32(__u32 val) {
Christopher Ferris106b3a82016-08-24 12:15:38 -070045#ifdef __arch_swahw32
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070046 return __arch_swahw32(val);
Ben Cheng655a7c02013-10-16 16:09:24 -070047#else
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070048/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
49 return ___constant_swahw32(val);
Ben Cheng655a7c02013-10-16 16:09:24 -070050#endif
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070051}
52static inline __attribute__((__const__)) __u32 __fswahb32(__u32 val) {
53/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070054#ifdef __arch_swahb32
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070055 return __arch_swahb32(val);
Christopher Ferris106b3a82016-08-24 12:15:38 -070056#else
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070057 return ___constant_swahb32(val);
58/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070059#endif
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070060}
Christopher Ferris106b3a82016-08-24 12:15:38 -070061#define __swab16(x) (__u16) __builtin_bswap16((__u16) (x))
Christopher Ferris106b3a82016-08-24 12:15:38 -070062#define __swab32(x) (__u32) __builtin_bswap32((__u32) (x))
Christopher Ferris106b3a82016-08-24 12:15:38 -070063/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferris106b3a82016-08-24 12:15:38 -070064#define __swab64(x) (__u64) __builtin_bswap64((__u64) (x))
Tao Baod7db5942015-01-28 10:07:51 -080065#define __swahw32(x) (__builtin_constant_p((__u32) (x)) ? ___constant_swahw32(x) : __fswahw32(x))
66#define __swahb32(x) (__builtin_constant_p((__u32) (x)) ? ___constant_swahb32(x) : __fswahb32(x))
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070067static __always_inline __u16 __swab16p(const __u16 * p) {
68/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070069#ifdef __arch_swab16p
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070070 return __arch_swab16p(p);
Christopher Ferris106b3a82016-08-24 12:15:38 -070071#else
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070072 return __swab16(* p);
73/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -070074#endif
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070075}
76static __always_inline __u32 __swab32p(const __u32 * p) {
Ben Cheng655a7c02013-10-16 16:09:24 -070077#ifdef __arch_swab32p
Ben Cheng655a7c02013-10-16 16:09:24 -070078/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070079 return __arch_swab32p(p);
80#else
81 return __swab32(* p);
Christopher Ferris106b3a82016-08-24 12:15:38 -070082#endif
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070083/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
84}
85static __always_inline __u64 __swab64p(const __u64 * p) {
Ben Cheng655a7c02013-10-16 16:09:24 -070086#ifdef __arch_swab64p
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070087 return __arch_swab64p(p);
Ben Cheng655a7c02013-10-16 16:09:24 -070088/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070089#else
90 return __swab64(* p);
91#endif
92}
93/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
94static inline __u32 __swahw32p(const __u32 * p) {
Christopher Ferris106b3a82016-08-24 12:15:38 -070095#ifdef __arch_swahw32p
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070096 return __arch_swahw32p(p);
Ben Cheng655a7c02013-10-16 16:09:24 -070097#else
Christopher Ferrisee1e0a32017-04-20 13:38:49 -070098/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
99 return __swahw32(* p);
Ben Cheng655a7c02013-10-16 16:09:24 -0700100#endif
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700101}
102static inline __u32 __swahb32p(const __u32 * p) {
103/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700104#ifdef __arch_swahb32p
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700105 return __arch_swahb32p(p);
Christopher Ferris106b3a82016-08-24 12:15:38 -0700106#else
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700107 return __swahb32(* p);
108/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700109#endif
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700110}
111static inline void __swab16s(__u16 * p) {
Ben Cheng655a7c02013-10-16 16:09:24 -0700112#ifdef __arch_swab16s
Ben Cheng655a7c02013-10-16 16:09:24 -0700113/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700114 __arch_swab16s(p);
115#else
116 * p = __swab16p(p);
Christopher Ferris106b3a82016-08-24 12:15:38 -0700117#endif
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700118/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
119}
120static __always_inline void __swab32s(__u32 * p) {
Ben Cheng655a7c02013-10-16 16:09:24 -0700121#ifdef __arch_swab32s
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700122 __arch_swab32s(p);
Ben Cheng655a7c02013-10-16 16:09:24 -0700123/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700124#else
125 * p = __swab32p(p);
126#endif
127}
128/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
129static __always_inline void __swab64s(__u64 * p) {
Christopher Ferris106b3a82016-08-24 12:15:38 -0700130#ifdef __arch_swab64s
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700131 __arch_swab64s(p);
Ben Cheng655a7c02013-10-16 16:09:24 -0700132#else
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700133/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
134 * p = __swab64p(p);
Ben Cheng655a7c02013-10-16 16:09:24 -0700135#endif
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700136}
137static inline void __swahw32s(__u32 * p) {
138/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700139#ifdef __arch_swahw32s
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700140 __arch_swahw32s(p);
Christopher Ferris106b3a82016-08-24 12:15:38 -0700141#else
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700142 * p = __swahw32p(p);
143/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Ben Cheng655a7c02013-10-16 16:09:24 -0700144#endif
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700145}
146static inline void __swahb32s(__u32 * p) {
Ben Cheng655a7c02013-10-16 16:09:24 -0700147#ifdef __arch_swahb32s
Ben Cheng655a7c02013-10-16 16:09:24 -0700148/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700149 __arch_swahb32s(p);
150#else
151 * p = __swahb32p(p);
Ben Cheng655a7c02013-10-16 16:09:24 -0700152#endif
Christopher Ferrisee1e0a32017-04-20 13:38:49 -0700153/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
154}
Christopher Ferris106b3a82016-08-24 12:15:38 -0700155#endif