1 /* Common header file that is included by all of qemu. */
5 /* we put basic includes here to avoid repeating them in device drivers */
27 #define ENOMEDIUM ENODEV
33 #define lseek _lseeki64
35 extern int qemu_ftruncate64(int, int64_t);
36 #define ftruncate qemu_ftruncate64
39 static inline char *realpath(const char *path, char *resolved_path)
41 _fullpath(resolved_path, path, _MAX_PATH);
51 /* FIXME: Remove NEED_CPU_H. */
54 #include "config-host.h"
63 #endif /* !defined(NEED_CPU_H) */
66 #define xglue(x, y) x ## y
67 #define glue(x, y) xglue(x, y)
68 #define stringify(s) tostring(s)
69 #define tostring(s) #s
74 #define __builtin_expect(x, n) (x)
77 #define likely(x) __builtin_expect(!!(x), 1)
78 #define unlikely(x) __builtin_expect(!!(x), 0)
82 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
85 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
89 #if (__GNUC__ < 3) || defined(__APPLE__)
90 #define always_inline inline
92 #define always_inline __attribute__ (( always_inline )) inline
97 typedef struct QEMUBH QEMUBH;
99 typedef void QEMUBHFunc(void *opaque);
101 QEMUBH *qemu_bh_new(QEMUBHFunc *cb, void *opaque);
102 void qemu_bh_schedule(QEMUBH *bh);
103 void qemu_bh_cancel(QEMUBH *bh);
104 void qemu_bh_delete(QEMUBH *bh);
105 int qemu_bh_poll(void);
107 uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
110 void pstrcpy(char *buf, int buf_size, const char *str);
111 char *pstrcat(char *buf, int buf_size, const char *s);
112 int strstart(const char *str, const char *val, const char **ptr);
113 int stristart(const char *str, const char *val, const char **ptr);
114 time_t mktimegm(struct tm *tm);
116 /* Error handling. */
118 void hw_error(const char *fmt, ...)
119 __attribute__ ((__format__ (__printf__, 1, 2)))
120 __attribute__ ((__noreturn__));
123 typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
124 typedef int IOCanRWHandler(void *opaque);
125 typedef void IOHandler(void *opaque);
127 struct ParallelIOArg {
132 typedef int (*DMA_transfer_handler) (void *opaque, int nchan, int pos, int size);
134 /* A load of opaque types so that device init declarations don't have to
135 pull in all the real definitions. */
136 typedef struct NICInfo NICInfo;
137 typedef struct AudioState AudioState;
138 typedef struct BlockDriverState BlockDriverState;
139 typedef struct DisplayState DisplayState;
140 typedef struct TextConsole TextConsole;
141 typedef struct CharDriverState CharDriverState;
142 typedef struct VLANState VLANState;
143 typedef struct QEMUFile QEMUFile;
144 typedef struct i2c_bus i2c_bus;
145 typedef struct i2c_slave i2c_slave;
146 typedef struct SMBusDevice SMBusDevice;
147 typedef struct QEMUTimer QEMUTimer;
148 typedef struct PCIBus PCIBus;
149 typedef struct PCIDevice PCIDevice;
150 typedef struct SerialState SerialState;
151 typedef struct IRQState *qemu_irq;
152 struct pcmcia_card_s;