| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | /* 
 | 
					
						
							| 
									
										
										
										
											2007-11-14 17:00:31 -08:00
										 |  |  |  * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  |  * Licensed under the GPL | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef __USER_H__
 | 
					
						
							|  |  |  | #define __USER_H__
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-18 20:01:49 +01:00
										 |  |  | #include <generated/asm-offsets.h>
 | 
					
						
							| 
									
										
										
										
											2007-11-14 17:00:31 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-05-06 14:51:09 -07:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * The usual definition - copied here because the kernel provides its own, | 
					
						
							|  |  |  |  * fancier, type-safe, definition.  Using that one would require | 
					
						
							|  |  |  |  * copying too much infrastructure for my taste, so userspace files | 
					
						
							|  |  |  |  * get less checking than kernel files. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-10-16 01:26:47 -07:00
										 |  |  | /* This is to get size_t */ | 
					
						
							|  |  |  | #ifdef __KERNEL__
 | 
					
						
							| 
									
										
										
										
											2007-05-06 14:51:52 -07:00
										 |  |  | #include <linux/types.h>
 | 
					
						
							| 
									
										
										
										
											2007-10-16 01:26:47 -07:00
										 |  |  | #else
 | 
					
						
							|  |  |  | #include <stddef.h>
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2007-05-06 14:51:52 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-10 22:53:31 -07:00
										 |  |  | extern void panic(const char *fmt, ...) | 
					
						
							|  |  |  | 	__attribute__ ((format (printf, 1, 2))); | 
					
						
							| 
									
										
										
										
											2007-11-14 17:00:31 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												um: Preinclude include/linux/kern_levels.h
The userspace part of UML uses the asm-offsets.h generator mechanism to
create definitions for UM_KERN_<LEVEL> that match the in-kernel
KERN_<LEVEL> constant definitions.
As of commit 04d2c8c83d0e3ac5f78aeede51babb3236200112 ("printk: convert
the format for KERN_<LEVEL> to a 2 byte pattern"), KERN_<LEVEL> is no
longer expanded to the literal '"<LEVEL>"', but to '"\001" "LEVEL"', i.e.
it contains two parts.
However, the combo of DEFINE_STR() in
arch/x86/um/shared/sysdep/kernel-offsets.h and sed-y in Kbuild doesn't
support string literals consisting of multiple parts. Hence for all
UM_KERN_<LEVEL> definitions, only the SOH character is retained in the actual
definition, while the remainder ends up in the comment. E.g. in
include/generated/asm-offsets.h we get
    #define UM_KERN_INFO "\001" /* "6" KERN_INFO */
instead of
    #define UM_KERN_INFO "\001" "6" /* KERN_INFO */
This causes spurious '^A' output in some kernel messages:
    Calibrating delay loop... 4640.76 BogoMIPS (lpj=23203840)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 256
    ^AChecking that host ptys support output SIGIO...Yes
    ^AChecking that host ptys support SIGIO on close...No, enabling workaround
    ^AUsing 2.6 host AIO
    NET: Registered protocol family 16
    bio: create slab <bio-0> at 0
    Switching to clocksource itimer
To fix this:
  - Move the mapping from UM_KERN_<LEVEL> to KERN_<LEVEL> from
    arch/um/include/shared/common-offsets.h to
    arch/um/include/shared/user.h, which is preincluded for all userspace
    parts,
  - Preinclude include/linux/kern_levels.h for all userspace parts, to
    obtain the in-kernel KERN_<LEVEL> constant definitions. This doesn't
    violate the kernel/userspace separation, as include/linux/kern_levels.h
    is self-contained and doesn't expose any other kernel internals.
  - Remove the now unused STR() and DEFINE_STR() macros.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
											
										 
											2012-08-16 20:15:05 +02:00
										 |  |  | /* Requires preincluding include/linux/kern_levels.h */ | 
					
						
							|  |  |  | #define UM_KERN_EMERG	KERN_EMERG
 | 
					
						
							|  |  |  | #define UM_KERN_ALERT	KERN_ALERT
 | 
					
						
							|  |  |  | #define UM_KERN_CRIT	KERN_CRIT
 | 
					
						
							|  |  |  | #define UM_KERN_ERR	KERN_ERR
 | 
					
						
							|  |  |  | #define UM_KERN_WARNING	KERN_WARNING
 | 
					
						
							|  |  |  | #define UM_KERN_NOTICE	KERN_NOTICE
 | 
					
						
							|  |  |  | #define UM_KERN_INFO	KERN_INFO
 | 
					
						
							|  |  |  | #define UM_KERN_DEBUG	KERN_DEBUG
 | 
					
						
							|  |  |  | #define UM_KERN_CONT	KERN_CONT
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-14 17:00:31 -08:00
										 |  |  | #ifdef UML_CONFIG_PRINTK
 | 
					
						
							| 
									
										
										
										
											2006-04-10 22:53:31 -07:00
										 |  |  | extern int printk(const char *fmt, ...) | 
					
						
							|  |  |  | 	__attribute__ ((format (printf, 1, 2))); | 
					
						
							| 
									
										
										
										
											2007-11-14 17:00:31 -08:00
										 |  |  | #else
 | 
					
						
							|  |  |  | static inline int printk(const char *fmt, ...) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | extern int in_aton(char *str); | 
					
						
							| 
									
										
										
										
											2007-05-06 14:51:52 -07:00
										 |  |  | extern size_t strlcpy(char *, const char *, size_t); | 
					
						
							|  |  |  | extern size_t strlcat(char *, const char *, size_t); | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-18 20:04:59 +01:00
										 |  |  | /* Copied from linux/compiler-gcc.h since we can't include it directly */ | 
					
						
							|  |  |  | #define barrier() __asm__ __volatile__("": : :"memory")
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #endif
 |