Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Andi Kleen | 867a979 | 2016-09-15 15:24:38 -0700 | [diff] [blame] | 2 | #ifndef JSON_H |
| 3 | #define JSON_H 1 |
| 4 | |
| 5 | #include "jsmn.h" |
| 6 | |
| 7 | jsmntok_t *parse_json(const char *fn, char **map, size_t *size, int *len); |
| 8 | void free_json(char *map, size_t size, jsmntok_t *tokens); |
| 9 | int json_line(char *map, jsmntok_t *t); |
| 10 | const char *json_name(jsmntok_t *t); |
| 11 | int json_streq(char *map, jsmntok_t *t, const char *s); |
| 12 | int json_len(jsmntok_t *t); |
| 13 | |
| 14 | extern int verbose; |
| 15 | |
| 16 | #include <stdbool.h> |
| 17 | |
| 18 | extern int eprintf(int level, int var, const char *fmt, ...); |
| 19 | #define pr_fmt(fmt) fmt |
| 20 | |
| 21 | #define pr_err(fmt, ...) \ |
| 22 | eprintf(0, verbose, pr_fmt(fmt), ##__VA_ARGS__) |
| 23 | |
Andi Kleen | 80eeb67 | 2016-09-19 17:39:33 -0300 | [diff] [blame] | 24 | #define pr_info(fmt, ...) \ |
| 25 | eprintf(1, verbose, pr_fmt(fmt), ##__VA_ARGS__) |
| 26 | |
| 27 | #define pr_debug(fmt, ...) \ |
| 28 | eprintf(2, verbose, pr_fmt(fmt), ##__VA_ARGS__) |
| 29 | |
Andi Kleen | 867a979 | 2016-09-15 15:24:38 -0700 | [diff] [blame] | 30 | #ifndef roundup |
| 31 | #define roundup(x, y) ( \ |
| 32 | { \ |
| 33 | const typeof(y) __y = y; \ |
| 34 | (((x) + (__y - 1)) / __y) * __y; \ |
| 35 | } \ |
| 36 | ) |
| 37 | #endif |
| 38 | |
| 39 | #endif |