ia64/xen-unstable

view xen/include/xen/lib.h @ 12232:dd62270df2ad

[XEN] Add 'loglvl' and 'guest_loglvl' boot parameters.

<lvl> := none|error|warning|info|debug|all

loglvl=<lvl_print_always>[/<lvl_print_ratelimit>]
<lvl_print_always>: log level which is always printed
<lvl_print_rlimit>: log level which is rate-limit printed

'loglvl' applies to non-guest-related messages.
'guest_loglvl' applies to guest-related messages.

Defaults: loglvl=warning ; guest_loglvl=none/warning

Also clean up hvm_print_line().

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@localhost.localdomain
date Thu Nov 02 22:24:20 2006 +0000 (2006-11-02)
parents 444496ecb14e
children 3e2d3d737624
line source
1 #ifndef __LIB_H__
2 #define __LIB_H__
4 #include <xen/inttypes.h>
5 #include <xen/stdarg.h>
6 #include <xen/config.h>
7 #include <xen/types.h>
8 #include <xen/xmalloc.h>
9 #include <xen/string.h>
11 extern void __bug(char *file, int line) __attribute__((noreturn));
12 #define BUG() __bug(__FILE__, __LINE__)
13 #define BUG_ON(_p) do { if (_p) BUG(); } while ( 0 )
15 /* Force a compilation error if condition is true */
16 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2 * !!(condition)]))
18 #ifndef NDEBUG
19 #define ASSERT(_p) \
20 do { \
21 if ( unlikely(!(_p)) ) \
22 { \
23 printk("Assertion '%s' failed, line %d, file %s\n", #_p , \
24 __LINE__, __FILE__); \
25 BUG(); \
26 } \
27 } while ( 0 )
28 #else
29 #define ASSERT(_p) ((void)0)
30 #endif
32 #define SWAP(_a, _b) \
33 do { typeof(_a) _t = (_a); (_a) = (_b); (_b) = _t; } while ( 0 )
35 #define DIV_ROUND(x, y) (((x) + (y) / 2) / (y))
37 #define reserve_bootmem(_p,_l) ((void)0)
39 struct domain;
41 void cmdline_parse(char *cmdline);
43 /*#define DEBUG_TRACE_DUMP*/
44 #ifdef DEBUG_TRACE_DUMP
45 extern void debugtrace_dump(void);
46 extern void debugtrace_printk(const char *fmt, ...);
47 #else
48 #define debugtrace_dump() ((void)0)
49 #define debugtrace_printk(_f, ...) ((void)0)
50 #endif
52 /* Allows us to use '%p' as general-purpose machine-word format char. */
53 #define _p(_x) ((void *)(unsigned long)(_x))
54 extern void printk(const char *format, ...)
55 __attribute__ ((format (printf, 1, 2)));
56 extern void panic(const char *format, ...)
57 __attribute__ ((format (printf, 1, 2)));
58 extern long vm_assist(struct domain *, unsigned int, unsigned int);
59 extern int __printk_ratelimit(int ratelimit_ms, int ratelimit_burst);
60 extern int printk_ratelimit(void);
62 /* vsprintf.c */
63 extern int sprintf(char * buf, const char * fmt, ...)
64 __attribute__ ((format (printf, 2, 3)));
65 extern int vsprintf(char *buf, const char *, va_list)
66 __attribute__ ((format (printf, 2, 0)));
67 extern int snprintf(char * buf, size_t size, const char * fmt, ...)
68 __attribute__ ((format (printf, 3, 4)));
69 extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
70 __attribute__ ((format (printf, 3, 0)));
71 extern int scnprintf(char * buf, size_t size, const char * fmt, ...)
72 __attribute__ ((format (printf, 3, 4)));
73 extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
74 __attribute__ ((format (printf, 3, 0)));
76 long simple_strtol(
77 const char *cp,char **endp, unsigned int base);
78 unsigned long simple_strtoul(
79 const char *cp,char **endp, unsigned int base);
80 long long simple_strtoll(
81 const char *cp,char **endp, unsigned int base);
82 unsigned long long simple_strtoull(
83 const char *cp,char **endp, unsigned int base);
85 unsigned long long parse_size_and_unit(const char *s, char **ps);
87 #define TAINT_UNSAFE_SMP (1<<0)
88 #define TAINT_MACHINE_CHECK (1<<1)
89 #define TAINT_BAD_PAGE (1<<2)
90 #define TAINT_SYNC_CONSOLE (1<<3)
91 extern int tainted;
92 #define TAINT_STRING_MAX_LEN 20
93 extern char *print_tainted(char *str);
94 extern void add_taint(unsigned);
96 #endif /* __LIB_H__ */