Statistics
| Branch: | Revision:

root / qemu-common.h @ 7aaabde7

History | View | Annotate | Download (1.7 kB)

1 faf07963 pbrook
/* Common header file that is included by all of qemu.  */
2 faf07963 pbrook
#ifndef QEMU_COMMON_H
3 faf07963 pbrook
#define QEMU_COMMON_H
4 faf07963 pbrook
5 faf07963 pbrook
/* we put basic includes here to avoid repeating them in device drivers */
6 faf07963 pbrook
#include <stdlib.h>
7 faf07963 pbrook
#include <stdio.h>
8 faf07963 pbrook
#include <stdarg.h>
9 faf07963 pbrook
#include <string.h>
10 faf07963 pbrook
#include <inttypes.h>
11 faf07963 pbrook
#include <limits.h>
12 faf07963 pbrook
#include <time.h>
13 faf07963 pbrook
#include <ctype.h>
14 faf07963 pbrook
#include <errno.h>
15 faf07963 pbrook
#include <unistd.h>
16 faf07963 pbrook
#include <fcntl.h>
17 faf07963 pbrook
#include <sys/stat.h>
18 faf07963 pbrook
19 faf07963 pbrook
#ifndef O_LARGEFILE
20 faf07963 pbrook
#define O_LARGEFILE 0
21 faf07963 pbrook
#endif
22 faf07963 pbrook
#ifndef O_BINARY
23 faf07963 pbrook
#define O_BINARY 0
24 faf07963 pbrook
#endif
25 faf07963 pbrook
26 faf07963 pbrook
#ifndef ENOMEDIUM
27 faf07963 pbrook
#define ENOMEDIUM ENODEV
28 faf07963 pbrook
#endif
29 faf07963 pbrook
30 faf07963 pbrook
#ifdef _WIN32
31 faf07963 pbrook
#include <windows.h>
32 faf07963 pbrook
#define fsync _commit
33 faf07963 pbrook
#define lseek _lseeki64
34 faf07963 pbrook
#define ENOTSUP 4096
35 faf07963 pbrook
extern int qemu_ftruncate64(int, int64_t);
36 faf07963 pbrook
#define ftruncate qemu_ftruncate64
37 faf07963 pbrook
38 faf07963 pbrook
39 faf07963 pbrook
static inline char *realpath(const char *path, char *resolved_path)
40 faf07963 pbrook
{
41 faf07963 pbrook
    _fullpath(resolved_path, path, _MAX_PATH);
42 faf07963 pbrook
    return resolved_path;
43 faf07963 pbrook
}
44 faf07963 pbrook
45 faf07963 pbrook
#define PRId64 "I64d"
46 faf07963 pbrook
#define PRIx64 "I64x"
47 faf07963 pbrook
#define PRIu64 "I64u"
48 faf07963 pbrook
#define PRIo64 "I64o"
49 faf07963 pbrook
#endif
50 faf07963 pbrook
51 faf07963 pbrook
/* FIXME: Remove NEED_CPU_H.  */
52 faf07963 pbrook
#ifndef NEED_CPU_H
53 faf07963 pbrook
54 faf07963 pbrook
#include "config-host.h"
55 faf07963 pbrook
#include <setjmp.h>
56 faf07963 pbrook
#include "osdep.h"
57 faf07963 pbrook
#include "bswap.h"
58 faf07963 pbrook
59 faf07963 pbrook
#else
60 faf07963 pbrook
61 faf07963 pbrook
#include "cpu.h"
62 faf07963 pbrook
63 faf07963 pbrook
#endif /* !defined(NEED_CPU_H) */
64 faf07963 pbrook
65 faf07963 pbrook
/* bottom halves */
66 faf07963 pbrook
typedef struct QEMUBH QEMUBH;
67 faf07963 pbrook
68 faf07963 pbrook
typedef void QEMUBHFunc(void *opaque);
69 faf07963 pbrook
70 faf07963 pbrook
QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque);
71 faf07963 pbrook
void qemu_bh_schedule(QEMUBH *bh);
72 faf07963 pbrook
void qemu_bh_cancel(QEMUBH *bh);
73 faf07963 pbrook
void qemu_bh_delete(QEMUBH *bh);
74 faf07963 pbrook
int qemu_bh_poll(void);
75 faf07963 pbrook
76 faf07963 pbrook
/* cutils.c */
77 faf07963 pbrook
void pstrcpy(char *buf, int buf_size, const char *str);
78 faf07963 pbrook
char *pstrcat(char *buf, int buf_size, const char *s);
79 faf07963 pbrook
int strstart(const char *str, const char *val, const char **ptr);
80 faf07963 pbrook
int stristart(const char *str, const char *val, const char **ptr);
81 faf07963 pbrook
time_t mktimegm(struct tm *tm);
82 faf07963 pbrook
83 faf07963 pbrook
#endif