xref: /kvm-unit-tests/lib/libcflat.h (revision fd5d3dc60d413d77a93da79e65cc945aeb87cf4d)
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License, version 2, as
4  * published by the Free Software Foundation.
5  *
6  * This program is distributed in the hope that it will be useful,
7  * but WITHOUT ANY WARRANTY; without even the implied warranty of
8  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9  * GNU General Public License for more details.
10  *
11  * You should have received a copy of the GNU General Public License
12  * along with this program; if not, write to the Free Software
13  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
14  *
15  * Copyright IBM Corp. 2008
16  *
17  * Authors: Hollis Blanchard <hollisb@us.ibm.com>
18  */
19 
20 #ifndef __LIBCFLAT_H
21 #define __LIBCFLAT_H
22 
23 #include <stdarg.h>
24 
25 typedef unsigned char u8;
26 typedef signed char s8;
27 typedef unsigned short u16;
28 typedef signed short s16;
29 typedef unsigned u32;
30 typedef signed s32;
31 typedef unsigned long ulong;
32 typedef unsigned long long u64;
33 typedef signed long long s64;
34 typedef unsigned long size_t;
35 typedef _Bool bool;
36 
37 #define true 1
38 #define false 0
39 
40 extern void exit(int code);
41 extern void panic(char *fmt, ...);
42 
43 extern unsigned long strlen(const char *buf);
44 extern char *strcat(char *dest, const char *src);
45 
46 extern int printf(const char *fmt, ...);
47 extern int vsnprintf(char *buf, int size, const char *fmt, va_list va);
48 
49 extern void puts(const char *s);
50 
51 extern void *memset(void *s, int c, size_t n);
52 
53 extern long atol(const char *ptr);
54 #define ARRAY_SIZE(_a)  (sizeof(_a)/sizeof((_a)[0]))
55 
56 #endif
57