Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Jeff Dike | 9c8d638 | 2007-11-14 17:00:31 -0800 | [diff] [blame] | 2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * Licensed under the GPL |
| 4 | */ |
| 5 | |
| 6 | #ifndef __USER_H__ |
| 7 | #define __USER_H__ |
| 8 | |
Al Viro | 9e63645 | 2011-08-18 20:01:49 +0100 | [diff] [blame] | 9 | #include <generated/asm-offsets.h> |
Jeff Dike | 9c8d638 | 2007-11-14 17:00:31 -0800 | [diff] [blame] | 10 | |
Jeff Dike | 24fa6c0 | 2007-05-06 14:51:09 -0700 | [diff] [blame] | 11 | /* |
| 12 | * The usual definition - copied here because the kernel provides its own, |
| 13 | * fancier, type-safe, definition. Using that one would require |
| 14 | * copying too much infrastructure for my taste, so userspace files |
| 15 | * get less checking than kernel files. |
| 16 | */ |
| 17 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
| 18 | |
Jeff Dike | 42daba3 | 2007-10-16 01:26:47 -0700 | [diff] [blame] | 19 | /* This is to get size_t */ |
Richard Weinberger | 298e20b | 2015-05-31 19:50:57 +0200 | [diff] [blame] | 20 | #ifndef __UM_HOST__ |
Paolo 'Blaisorblade' Giarrusso | c2f239d | 2007-05-06 14:51:52 -0700 | [diff] [blame] | 21 | #include <linux/types.h> |
Jeff Dike | 42daba3 | 2007-10-16 01:26:47 -0700 | [diff] [blame] | 22 | #else |
| 23 | #include <stddef.h> |
| 24 | #endif |
Paolo 'Blaisorblade' Giarrusso | c2f239d | 2007-05-06 14:51:52 -0700 | [diff] [blame] | 25 | |
Paolo 'Blaisorblade' Giarrusso | 9cf85b3 | 2006-04-10 22:53:31 -0700 | [diff] [blame] | 26 | extern void panic(const char *fmt, ...) |
| 27 | __attribute__ ((format (printf, 1, 2))); |
Jeff Dike | 9c8d638 | 2007-11-14 17:00:31 -0800 | [diff] [blame] | 28 | |
Geert Uytterhoeven | 9429ec9 | 2012-08-16 20:15:05 +0200 | [diff] [blame] | 29 | /* Requires preincluding include/linux/kern_levels.h */ |
| 30 | #define UM_KERN_EMERG KERN_EMERG |
| 31 | #define UM_KERN_ALERT KERN_ALERT |
| 32 | #define UM_KERN_CRIT KERN_CRIT |
| 33 | #define UM_KERN_ERR KERN_ERR |
| 34 | #define UM_KERN_WARNING KERN_WARNING |
| 35 | #define UM_KERN_NOTICE KERN_NOTICE |
| 36 | #define UM_KERN_INFO KERN_INFO |
| 37 | #define UM_KERN_DEBUG KERN_DEBUG |
| 38 | #define UM_KERN_CONT KERN_CONT |
| 39 | |
Jeff Dike | 9c8d638 | 2007-11-14 17:00:31 -0800 | [diff] [blame] | 40 | #ifdef UML_CONFIG_PRINTK |
Paolo 'Blaisorblade' Giarrusso | 9cf85b3 | 2006-04-10 22:53:31 -0700 | [diff] [blame] | 41 | extern int printk(const char *fmt, ...) |
| 42 | __attribute__ ((format (printf, 1, 2))); |
Jeff Dike | 9c8d638 | 2007-11-14 17:00:31 -0800 | [diff] [blame] | 43 | #else |
| 44 | static inline int printk(const char *fmt, ...) |
| 45 | { |
| 46 | return 0; |
| 47 | } |
| 48 | #endif |
| 49 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | extern int in_aton(char *str); |
Paolo 'Blaisorblade' Giarrusso | c2f239d | 2007-05-06 14:51:52 -0700 | [diff] [blame] | 51 | extern size_t strlcpy(char *, const char *, size_t); |
| 52 | extern size_t strlcat(char *, const char *, size_t); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
Al Viro | 05c46db | 2011-08-18 20:04:59 +0100 | [diff] [blame] | 54 | /* Copied from linux/compiler-gcc.h since we can't include it directly */ |
| 55 | #define barrier() __asm__ __volatile__("": : :"memory") |
| 56 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | #endif |