Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/kernel.h
| Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
| #include <linux/stringify.h> | #include <linux/stringify.h> | ||||
| #include <linux/errno.h> | #include <linux/errno.h> | ||||
| #include <linux/types.h> | #include <linux/types.h> | ||||
| #include <linux/typecheck.h> | #include <linux/typecheck.h> | ||||
| #include <linux/jiffies.h> | #include <linux/jiffies.h> | ||||
| #include <linux/log2.h> | #include <linux/log2.h> | ||||
| #include <linux/kconfig.h> | #include <linux/kconfig.h> | ||||
| #include <linux/instruction_pointer.h> | #include <linux/instruction_pointer.h> | ||||
| #include <linux/hex.h> | |||||
| #include <asm/byteorder.h> | #include <asm/byteorder.h> | ||||
| #include <asm/cpufeature.h> | #include <asm/cpufeature.h> | ||||
| #include <asm/processor.h> | #include <asm/processor.h> | ||||
| #include <asm/uaccess.h> | #include <asm/uaccess.h> | ||||
| #include <linux/stdarg.h> | #include <linux/stdarg.h> | ||||
| ▲ Show 20 Lines • Show All 232 Lines • ▼ Show 20 Lines | |||||
| * signed. Else false is returned. | * signed. Else false is returned. | ||||
| */ | */ | ||||
| #define is_signed(datatype) (((datatype)-1 / (datatype)2) == (datatype)0) | #define is_signed(datatype) (((datatype)-1 / (datatype)2) == (datatype)0) | ||||
| #define TAINT_WARN 0 | #define TAINT_WARN 0 | ||||
| #define test_taint(x) (0) | #define test_taint(x) (0) | ||||
| #define add_taint(x,y) do { \ | #define add_taint(x,y) do { \ | ||||
| } while (0) | } while (0) | ||||
| static inline int | |||||
| _h2b(const char c) | |||||
| { | |||||
| if (c >= '0' && c <= '9') | |||||
| return (c - '0'); | |||||
| if (c >= 'a' && c <= 'f') | |||||
| return (10 + c - 'a'); | |||||
| if (c >= 'A' && c <= 'F') | |||||
| return (10 + c - 'A'); | |||||
| return (-EINVAL); | |||||
| } | |||||
| static inline int | |||||
| hex2bin(uint8_t *bindst, const char *hexsrc, size_t binlen) | |||||
| { | |||||
| int hi4, lo4; | |||||
| while (binlen > 0) { | |||||
| hi4 = _h2b(*hexsrc++); | |||||
| lo4 = _h2b(*hexsrc++); | |||||
| if (hi4 < 0 || lo4 < 0) | |||||
| return (-EINVAL); | |||||
| *bindst++ = (hi4 << 4) | lo4; | |||||
| binlen--; | |||||
| } | |||||
| return (0); | |||||
| } | |||||
| static inline bool | static inline bool | ||||
| mac_pton(const char *macin, uint8_t *macout) | mac_pton(const char *macin, uint8_t *macout) | ||||
| { | { | ||||
| const char *s, *d; | const char *s, *d; | ||||
| uint8_t mac[6], hx, lx; | uint8_t mac[6], hx, lx; | ||||
| int i; | int i; | ||||
| Show All 39 Lines | |||||