]> git.proxmox.com Git - mirror_qemu.git/blame - migration/qemu-file.h
hw/fsi: Added FSI documentation
[mirror_qemu.git] / migration / qemu-file.h
CommitLineData
701a8f76
PB
1/*
2 * QEMU System Emulator
3 *
4 * Copyright (c) 2003-2008 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
175de524 24
08a0aee1
JQ
25#ifndef MIGRATION_QEMU_FILE_H
26#define MIGRATION_QEMU_FILE_H
deb22f9a 27
dcaf446e 28#include <zlib.h>
6a0acfff 29#include "exec/cpu-common.h"
c6ad5be7 30#include "io/channel.h"
dcaf446e 31
77ef2dc1
DB
32QEMUFile *qemu_file_new_input(QIOChannel *ioc);
33QEMUFile *qemu_file_new_output(QIOChannel *ioc);
701a8f76 34int qemu_fclose(QEMUFile *f);
fbfa6404 35
fbfa6404 36/*
e9c0eed7 37 * qemu_file_transferred:
fbfa6404 38 *
e9c0eed7
JQ
39 * No flush is performed and the reported amount will include the size
40 * of any queued buffers, on top of the amount actually transferred.
fbfa6404
DB
41 *
42 * Returns: the total bytes transferred and queued
43 */
e9c0eed7 44uint64_t qemu_file_transferred(QEMUFile *f);
fbfa6404 45
6181ec24
OW
46/*
47 * put_buffer without copying the buffer.
48 * The buffer should be available till it is sent asynchronously.
49 */
53f09a10
PB
50void qemu_put_buffer_async(QEMUFile *f, const uint8_t *buf, size_t size,
51 bool may_free);
701a8f76 52
08a0aee1 53#include "migration/qemu-file-types.h"
deb22f9a 54
394b9407
PB
55size_t coroutine_mixed_fn qemu_peek_buffer(QEMUFile *f, uint8_t **buf, size_t size, size_t offset);
56size_t coroutine_mixed_fn qemu_get_buffer_in_place(QEMUFile *f, uint8_t **buf, size_t size);
dcaf446e
XG
57ssize_t qemu_put_compression_data(QEMUFile *f, z_stream *stream,
58 const uint8_t *p, size_t size);
44f0eadc 59int qemu_put_qemu_file(QEMUFile *f_des, QEMUFile *f_src);
4024cc85 60bool qemu_file_buffer_empty(QEMUFile *file);
9504fb51 61
548f52ea
DDAG
62/*
63 * Note that you can only peek continuous bytes from where the current pointer
64 * is; you aren't guaranteed to be able to peak to +n bytes unless you've
65 * previously peeked +n-1.
66 */
394b9407 67int coroutine_mixed_fn qemu_peek_byte(QEMUFile *f, int offset);
c961514f 68void qemu_file_skip(QEMUFile *f, int size);
60bb3c58 69int qemu_file_get_error_obj_any(QEMUFile *f1, QEMUFile *f2, Error **errp);
3d661c8a 70void qemu_file_set_error_obj(QEMUFile *f, int ret, Error *err);
7aa6070d 71int qemu_file_get_error_obj(QEMUFile *f, Error **errp);
c961514f 72void qemu_file_set_error(QEMUFile *f, int ret);
e1a8c9b6 73int qemu_file_shutdown(QEMUFile *f);
adc468e9 74QEMUFile *qemu_file_get_return_path(QEMUFile *f);
be07a0ed 75int qemu_fflush(QEMUFile *f);
a800cd5c 76void qemu_file_set_blocking(QEMUFile *f, bool block);
c7a7db4b 77int qemu_file_get_to_fd(QEMUFile *f, int fd, size_t size);
701a8f76 78
c6ad5be7 79QIOChannel *qemu_file_get_ioc(QEMUFile *file);
08a0aee1 80
701a8f76 81#endif