ia64/xen-unstable

annotate xen/include/xen/lib.h @ 8520:b866ed85fad3

Add cpumask_scnprintf() and cpulist_scnprintf(). This also
adds the bitmap_scnprintf functions and scnprintf itself.

Add dirty cpu and cpu affinity info to 'q'-key debug output.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Sat Jan 07 18:17:13 2006 +0100 (2006-01-07)
parents a480b2990961
children b9b411b50587
rev   line source
kaf24@1210 1 #ifndef __LIB_H__
kaf24@1210 2 #define __LIB_H__
kaf24@1210 3
kaf24@4809 4 #include <xen/inttypes.h>
kaf24@1210 5 #include <stdarg.h>
kaf24@3827 6 #include <xen/config.h>
kaf24@1210 7 #include <xen/types.h>
cl349@5285 8 #include <xen/xmalloc.h>
kaf24@1486 9 #include <xen/string.h>
kaf24@1210 10
kaf24@3827 11 #define BUG() do { \
kaf24@3875 12 debugtrace_dump(); \
kaf24@3827 13 printk("BUG at %s:%d\n", __FILE__, __LINE__); \
kaf24@3827 14 FORCE_CRASH(); \
kaf24@3827 15 } while ( 0 )
kaf24@3827 16
kaf24@3848 17 #define BUG_ON(_p) do { if (_p) BUG(); } while ( 0 )
kaf24@3848 18
kaf24@1210 19 #ifndef NDEBUG
mafetter@4799 20 #define ASSERT(_p) { if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s\n", #_p , __LINE__, __FILE__); BUG(); } }
kaf24@1210 21 #else
kaf24@1210 22 #define ASSERT(_p) ((void)0)
kaf24@1210 23 #endif
kaf24@1210 24
kaf24@2635 25 #define SWAP(_a, _b) \
kaf24@2635 26 do { typeof(_a) _t = (_a); (_a) = (_b); (_b) = _t; } while ( 0 )
kaf24@2635 27
iap10@4606 28 #define DIV_ROUND(x, y) (((x) + (y) / 2) / (y))
arun@3920 29
kaf24@3354 30 #define reserve_bootmem(_p,_l) ((void)0)
kaf24@1210 31
cl349@2448 32 struct domain;
cl349@2448 33
kaf24@3338 34 void cmdline_parse(char *cmdline);
kaf24@3338 35
kaf24@3827 36 #ifndef NDEBUG
kaf24@3875 37 extern int debugtrace_send_to_console;
kaf24@3875 38 extern void debugtrace_dump(void);
kaf24@3827 39 extern void debugtrace_printk(const char *fmt, ...);
kaf24@3827 40 #else
kaf24@3875 41 #define debugtrace_dump() ((void)0)
kaf24@3875 42 #define debugtrace_printk(_f, ...) ((void)0)
kaf24@3827 43 #endif
kaf24@3827 44
kaf24@4654 45 /* Allows us to use '%p' as general-purpose machine-word format char. */
kaf24@4654 46 #define _p(_x) ((void *)(unsigned long)(_x))
kaf24@4654 47 #define printk(_f , _a...) printf( _f , ## _a )
kaf24@4654 48 extern void printf(const char *format, ...)
kaf24@4654 49 __attribute__ ((format (printf, 1, 2)));
kaf24@4654 50 extern void panic(const char *format, ...);
kaf24@4654 51 extern long vm_assist(struct domain *, unsigned int, unsigned int);
kaf24@1210 52
kaf24@1210 53 /* vsprintf.c */
kaf24@1210 54 extern int sprintf(char * buf, const char * fmt, ...)
kaf24@4654 55 __attribute__ ((format (printf, 2, 3)));
kaf24@8520 56 extern int vsprintf(char *buf, const char *, va_list)
kaf24@8520 57 __attribute__ ((format (printf, 2, 0)));
kaf24@1210 58 extern int snprintf(char * buf, size_t size, const char * fmt, ...)
kaf24@4654 59 __attribute__ ((format (printf, 3, 4)));
kaf24@8520 60 extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
kaf24@8520 61 __attribute__ ((format (printf, 3, 0)));
kaf24@8520 62 extern int scnprintf(char * buf, size_t size, const char * fmt, ...)
kaf24@8520 63 __attribute__ ((format (printf, 3, 4)));
kaf24@8520 64 extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args)
kaf24@8520 65 __attribute__ ((format (printf, 3, 0)));
kaf24@1210 66
kaf24@4850 67 long simple_strtol(
kaf24@4850 68 const char *cp,char **endp, unsigned int base);
kaf24@4850 69 unsigned long simple_strtoul(
kaf24@4850 70 const char *cp,char **endp, unsigned int base);
kaf24@4850 71 long long simple_strtoll(
kaf24@4850 72 const char *cp,char **endp, unsigned int base);
kaf24@4850 73 unsigned long long simple_strtoull(
kaf24@4850 74 const char *cp,char **endp, unsigned int base);
kaf24@4850 75
kaf24@5018 76 unsigned long long parse_size_and_unit(char *s);
kaf24@1210 77
kaf24@1210 78 #endif /* __LIB_H__ */