Revision 5dafc53f hw/hw.h
b/hw/hw.h | ||
---|---|---|
7 | 7 |
|
8 | 8 |
/* VM Load/Save */ |
9 | 9 |
|
10 |
/* This function writes a chunk of data to a file at the given position. |
|
11 |
* The pos argument can be ignored if the file is only being used for |
|
12 |
* streaming. The handler should try to write all of the data it can. |
|
13 |
*/ |
|
14 |
typedef void (QEMUFilePutBufferFunc)(void *opaque, const uint8_t *buf, |
|
15 |
int64_t pos, int size); |
|
16 |
|
|
17 |
/* Read a chunk of data from a file at the given position. The pos argument |
|
18 |
* can be ignored if the file is only be used for streaming. The number of |
|
19 |
* bytes actually read should be returned. |
|
20 |
*/ |
|
21 |
typedef int (QEMUFileGetBufferFunc)(void *opaque, uint8_t *buf, |
|
22 |
int64_t pos, int size); |
|
23 |
|
|
24 |
/* Close a file and return an error code */ |
|
25 |
typedef int (QEMUFileCloseFunc)(void *opaque); |
|
26 |
|
|
27 |
/* Called to determine if the file has exceeded it's bandwidth allocation. The |
|
28 |
* bandwidth capping is a soft limit, not a hard limit. |
|
29 |
*/ |
|
30 |
typedef int (QEMUFileRateLimit)(void *opaque); |
|
31 |
|
|
32 |
QEMUFile *qemu_fopen_ops(void *opaque, QEMUFilePutBufferFunc *put_buffer, |
|
33 |
QEMUFileGetBufferFunc *get_buffer, |
|
34 |
QEMUFileCloseFunc *close, |
|
35 |
QEMUFileRateLimit *rate_limit); |
|
10 | 36 |
QEMUFile *qemu_fopen(const char *filename, const char *mode); |
37 |
QEMUFile *qemu_fopen_fd(int fd); |
|
11 | 38 |
void qemu_fflush(QEMUFile *f); |
12 |
void qemu_fclose(QEMUFile *f);
|
|
39 |
int qemu_fclose(QEMUFile *f);
|
|
13 | 40 |
void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size); |
14 | 41 |
void qemu_put_byte(QEMUFile *f, int v); |
15 | 42 |
void qemu_put_be16(QEMUFile *f, unsigned int v); |
... | ... | |
20 | 47 |
unsigned int qemu_get_be16(QEMUFile *f); |
21 | 48 |
unsigned int qemu_get_be32(QEMUFile *f); |
22 | 49 |
uint64_t qemu_get_be64(QEMUFile *f); |
50 |
int qemu_file_rate_limit(QEMUFile *f); |
|
51 |
|
|
52 |
/* Try to send any outstanding data. This function is useful when output is |
|
53 |
* halted due to rate limiting or EAGAIN errors occur as it can be used to |
|
54 |
* resume output. */ |
|
55 |
void qemu_file_put_notify(QEMUFile *f); |
|
23 | 56 |
|
24 | 57 |
static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv) |
25 | 58 |
{ |
Also available in: Unified diff