xref: /openbmc/linux/arch/um/include/shared/user.h (revision f5ff432d)
1f2f4bf5aSAlex Dewar /* SPDX-License-Identifier: GPL-2.0 */
28569c914SAl Viro /*
38569c914SAl Viro  * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
48569c914SAl Viro  */
58569c914SAl Viro 
68569c914SAl Viro #ifndef __USER_H__
78569c914SAl Viro #define __USER_H__
88569c914SAl Viro 
99e636452SAl Viro #include <generated/asm-offsets.h>
108569c914SAl Viro 
118569c914SAl Viro /*
128569c914SAl Viro  * The usual definition - copied here because the kernel provides its own,
138569c914SAl Viro  * fancier, type-safe, definition.  Using that one would require
148569c914SAl Viro  * copying too much infrastructure for my taste, so userspace files
158569c914SAl Viro  * get less checking than kernel files.
168569c914SAl Viro  */
178569c914SAl Viro #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
188569c914SAl Viro 
19af3e1610SJason A. Donenfeld /* This is to get size_t and NULL */
20298e20baSRichard Weinberger #ifndef __UM_HOST__
218569c914SAl Viro #include <linux/types.h>
228569c914SAl Viro #else
238569c914SAl Viro #include <stddef.h>
24af3e1610SJason A. Donenfeld #include <sys/types.h>
258569c914SAl Viro #endif
268569c914SAl Viro 
278569c914SAl Viro extern void panic(const char *fmt, ...)
288569c914SAl Viro 	__attribute__ ((format (printf, 1, 2)));
298569c914SAl Viro 
309429ec96SGeert Uytterhoeven /* Requires preincluding include/linux/kern_levels.h */
319429ec96SGeert Uytterhoeven #define UM_KERN_EMERG	KERN_EMERG
329429ec96SGeert Uytterhoeven #define UM_KERN_ALERT	KERN_ALERT
339429ec96SGeert Uytterhoeven #define UM_KERN_CRIT	KERN_CRIT
349429ec96SGeert Uytterhoeven #define UM_KERN_ERR	KERN_ERR
359429ec96SGeert Uytterhoeven #define UM_KERN_WARNING	KERN_WARNING
369429ec96SGeert Uytterhoeven #define UM_KERN_NOTICE	KERN_NOTICE
379429ec96SGeert Uytterhoeven #define UM_KERN_INFO	KERN_INFO
389429ec96SGeert Uytterhoeven #define UM_KERN_DEBUG	KERN_DEBUG
399429ec96SGeert Uytterhoeven #define UM_KERN_CONT	KERN_CONT
409429ec96SGeert Uytterhoeven 
418569c914SAl Viro #ifdef UML_CONFIG_PRINTK
4233701557SChris Down #define printk(...) _printk(__VA_ARGS__)
4333701557SChris Down extern int _printk(const char *fmt, ...)
448569c914SAl Viro 	__attribute__ ((format (printf, 1, 2)));
458569c914SAl Viro #else
printk(const char * fmt,...)468569c914SAl Viro static inline int printk(const char *fmt, ...)
478569c914SAl Viro {
488569c914SAl Viro 	return 0;
498569c914SAl Viro }
508569c914SAl Viro #endif
518569c914SAl Viro 
528569c914SAl Viro extern int in_aton(char *str);
538569c914SAl Viro extern size_t strlcat(char *, const char *, size_t);
54*f0a6b583SAzeem Shaikh extern size_t strscpy(char *, const char *, size_t);
558569c914SAl Viro 
5605c46db4SAl Viro /* Copied from linux/compiler-gcc.h since we can't include it directly */
5705c46db4SAl Viro #define barrier() __asm__ __volatile__("": : :"memory")
5805c46db4SAl Viro 
598569c914SAl Viro #endif
60