ia64/xen-unstable

view xen/include/xen/lib.h @ 4846:ddd290cc8f0d

bitkeeper revision 1.1399 (42820c16ZkkGzrd1OssY0unvIvY5Cw)

Merge http://xen.bkbits.net:8080/xeno-unstable.bk
into gandalf.hpl.hp.com:/var/bk/xeno-unstable.bk
author xenbk@gandalf.hpl.hp.com
date Wed May 11 13:43:50 2005 +0000 (2005-05-11)
parents ccc4ee412321 754aa05abf61
children d16ae85cb89e
line source
1 #ifndef __LIB_H__
2 #define __LIB_H__
4 #include <xen/inttypes.h>
5 #include <stdarg.h>
6 #include <xen/config.h>
7 #include <xen/types.h>
8 #include <xen/string.h>
10 #define BUG() do { \
11 debugtrace_dump(); \
12 printk("BUG at %s:%d\n", __FILE__, __LINE__); \
13 FORCE_CRASH(); \
14 } while ( 0 )
16 #define BUG_ON(_p) do { if (_p) BUG(); } while ( 0 )
18 #ifndef NDEBUG
19 #define ASSERT(_p) { if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s\n", #_p , __LINE__, __FILE__); BUG(); } }
20 #else
21 #define ASSERT(_p) ((void)0)
22 #endif
24 #define SWAP(_a, _b) \
25 do { typeof(_a) _t = (_a); (_a) = (_b); (_b) = _t; } while ( 0 )
27 #define DIV_ROUND(x, y) (((x) + (y) / 2) / (y))
29 #define reserve_bootmem(_p,_l) ((void)0)
31 struct domain;
33 void cmdline_parse(char *cmdline);
35 #ifndef NDEBUG
36 extern int debugtrace_send_to_console;
37 extern void debugtrace_dump(void);
38 extern void debugtrace_printk(const char *fmt, ...);
39 #else
40 #define debugtrace_dump() ((void)0)
41 #define debugtrace_printk(_f, ...) ((void)0)
42 #endif
44 /* Allows us to use '%p' as general-purpose machine-word format char. */
45 #define _p(_x) ((void *)(unsigned long)(_x))
46 #define printk(_f , _a...) printf( _f , ## _a )
47 extern void printf(const char *format, ...)
48 __attribute__ ((format (printf, 1, 2)));
49 extern void panic(const char *format, ...);
50 extern long vm_assist(struct domain *, unsigned int, unsigned int);
52 /* vsprintf.c */
53 extern int sprintf(char * buf, const char * fmt, ...)
54 __attribute__ ((format (printf, 2, 3)));
55 extern int vsprintf(char *buf, const char *, va_list);
56 extern int snprintf(char * buf, size_t size, const char * fmt, ...)
57 __attribute__ ((format (printf, 3, 4)));
58 extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
60 long simple_strtol(const char *cp,char **endp,unsigned int base);
61 unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base);
62 long long simple_strtoll(const char *cp,char **endp,unsigned int base);
64 #endif /* __LIB_H__ */