xref: /kvm-unit-tests/lib/libcflat.h (revision 7d36db351752e29ad27eaafe3f102de7064e429b)
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 unsigned short u16;
27 typedef unsigned u32;
28 typedef unsigned long ulong;
29 typedef unsigned long long u64;
30 typedef unsigned long size_t;
31 typedef _Bool bool;
32 
33 #define true 1
34 #define false 0
35 
36 extern void exit(int code);
37 extern void panic(char *fmt, ...);
38 
39 extern unsigned long strlen(const char *buf);
40 extern char *strcat(char *dest, const char *src);
41 
42 extern int printf(const char *fmt, ...);
43 extern int vsnprintf(char *buf, int size, const char *fmt, va_list va);
44 
45 extern void puts(const char *s);
46 
47 extern void *memset(void *s, int c, size_t n);
48 
49 #define ARRAY_SIZE(_a)  (sizeof(_a)/sizeof((_a)[0]))
50 
51 #endif
52