migration: Split qemu-file.h
Split the file into public and internal interfaces. I have to rename the external one because we can't have two include files with the same name in the same directory. Build system gets confused. The only exported functions are the ones that handle basic types. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
107da9acb5
commit
08a0aee15c
@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qemu/log.h"
|
||||
#include "hw/i2c/i2c.h"
|
||||
#include "hw/i2c/i2c-ddc.h"
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "hw/s390x/s390_flic.h"
|
||||
#include "trace.h"
|
||||
#include "hw/qdev.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "sysemu/kvm.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "hw/s390x/s390_flic.h"
|
||||
#include "hw/s390x/adapter.h"
|
||||
#include "trace.h"
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "hw/boards.h"
|
||||
#include "qmp-commands.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "hw/s390x/storage-keys.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "sysemu/kvm.h"
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "exec/memory.h"
|
||||
#include "hw/irq.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "migration/qemu-file-types.h"
|
||||
#include "qemu/module.h"
|
||||
#include "sysemu/reset.h"
|
||||
|
||||
|
164
include/migration/qemu-file-types.h
Normal file
164
include/migration/qemu-file-types.h
Normal file
@ -0,0 +1,164 @@
|
||||
/*
|
||||
* QEMU System Emulator
|
||||
*
|
||||
* Copyright (c) 2003-2008 Fabrice Bellard
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_FILE_H
|
||||
#define QEMU_FILE_H
|
||||
|
||||
void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, size_t size);
|
||||
void qemu_put_byte(QEMUFile *f, int v);
|
||||
|
||||
#define qemu_put_sbyte qemu_put_byte
|
||||
|
||||
void qemu_put_be16(QEMUFile *f, unsigned int v);
|
||||
void qemu_put_be32(QEMUFile *f, unsigned int v);
|
||||
void qemu_put_be64(QEMUFile *f, uint64_t v);
|
||||
size_t qemu_get_buffer(QEMUFile *f, uint8_t *buf, size_t size);
|
||||
|
||||
int qemu_get_byte(QEMUFile *f);
|
||||
|
||||
static inline unsigned int qemu_get_ubyte(QEMUFile *f)
|
||||
{
|
||||
return (unsigned int)qemu_get_byte(f);
|
||||
}
|
||||
|
||||
#define qemu_get_sbyte qemu_get_byte
|
||||
|
||||
unsigned int qemu_get_be16(QEMUFile *f);
|
||||
unsigned int qemu_get_be32(QEMUFile *f);
|
||||
uint64_t qemu_get_be64(QEMUFile *f);
|
||||
|
||||
static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv)
|
||||
{
|
||||
qemu_put_be64(f, *pv);
|
||||
}
|
||||
|
||||
static inline void qemu_put_be32s(QEMUFile *f, const uint32_t *pv)
|
||||
{
|
||||
qemu_put_be32(f, *pv);
|
||||
}
|
||||
|
||||
static inline void qemu_put_be16s(QEMUFile *f, const uint16_t *pv)
|
||||
{
|
||||
qemu_put_be16(f, *pv);
|
||||
}
|
||||
|
||||
static inline void qemu_put_8s(QEMUFile *f, const uint8_t *pv)
|
||||
{
|
||||
qemu_put_byte(f, *pv);
|
||||
}
|
||||
|
||||
static inline void qemu_get_be64s(QEMUFile *f, uint64_t *pv)
|
||||
{
|
||||
*pv = qemu_get_be64(f);
|
||||
}
|
||||
|
||||
static inline void qemu_get_be32s(QEMUFile *f, uint32_t *pv)
|
||||
{
|
||||
*pv = qemu_get_be32(f);
|
||||
}
|
||||
|
||||
static inline void qemu_get_be16s(QEMUFile *f, uint16_t *pv)
|
||||
{
|
||||
*pv = qemu_get_be16(f);
|
||||
}
|
||||
|
||||
static inline void qemu_get_8s(QEMUFile *f, uint8_t *pv)
|
||||
{
|
||||
*pv = qemu_get_byte(f);
|
||||
}
|
||||
|
||||
/* Signed versions for type safety */
|
||||
static inline void qemu_put_sbe16(QEMUFile *f, int v)
|
||||
{
|
||||
qemu_put_be16(f, (unsigned int)v);
|
||||
}
|
||||
|
||||
static inline void qemu_put_sbe32(QEMUFile *f, int v)
|
||||
{
|
||||
qemu_put_be32(f, (unsigned int)v);
|
||||
}
|
||||
|
||||
static inline void qemu_put_sbe64(QEMUFile *f, int64_t v)
|
||||
{
|
||||
qemu_put_be64(f, (uint64_t)v);
|
||||
}
|
||||
|
||||
static inline int qemu_get_sbe16(QEMUFile *f)
|
||||
{
|
||||
return (int)qemu_get_be16(f);
|
||||
}
|
||||
|
||||
static inline int qemu_get_sbe32(QEMUFile *f)
|
||||
{
|
||||
return (int)qemu_get_be32(f);
|
||||
}
|
||||
|
||||
static inline int64_t qemu_get_sbe64(QEMUFile *f)
|
||||
{
|
||||
return (int64_t)qemu_get_be64(f);
|
||||
}
|
||||
|
||||
static inline void qemu_put_s8s(QEMUFile *f, const int8_t *pv)
|
||||
{
|
||||
qemu_put_8s(f, (const uint8_t *)pv);
|
||||
}
|
||||
|
||||
static inline void qemu_put_sbe16s(QEMUFile *f, const int16_t *pv)
|
||||
{
|
||||
qemu_put_be16s(f, (const uint16_t *)pv);
|
||||
}
|
||||
|
||||
static inline void qemu_put_sbe32s(QEMUFile *f, const int32_t *pv)
|
||||
{
|
||||
qemu_put_be32s(f, (const uint32_t *)pv);
|
||||
}
|
||||
|
||||
static inline void qemu_put_sbe64s(QEMUFile *f, const int64_t *pv)
|
||||
{
|
||||
qemu_put_be64s(f, (const uint64_t *)pv);
|
||||
}
|
||||
|
||||
static inline void qemu_get_s8s(QEMUFile *f, int8_t *pv)
|
||||
{
|
||||
qemu_get_8s(f, (uint8_t *)pv);
|
||||
}
|
||||
|
||||
static inline void qemu_get_sbe16s(QEMUFile *f, int16_t *pv)
|
||||
{
|
||||
qemu_get_be16s(f, (uint16_t *)pv);
|
||||
}
|
||||
|
||||
static inline void qemu_get_sbe32s(QEMUFile *f, int32_t *pv)
|
||||
{
|
||||
qemu_get_be32s(f, (uint32_t *)pv);
|
||||
}
|
||||
|
||||
static inline void qemu_get_sbe64s(QEMUFile *f, int64_t *pv)
|
||||
{
|
||||
qemu_get_be64s(f, (uint64_t *)pv);
|
||||
}
|
||||
|
||||
int qemu_file_rate_limit(QEMUFile *f);
|
||||
|
||||
#endif
|
@ -26,7 +26,7 @@
|
||||
#include "migration/block.h"
|
||||
#include "migration/migration.h"
|
||||
#include "sysemu/blockdev.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "qemu-file.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qemu-file-channel.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "qemu-file.h"
|
||||
#include "savevm.h"
|
||||
#include "migration/colo.h"
|
||||
#include "migration/block.h"
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "migration/migration.h"
|
||||
#include "savevm.h"
|
||||
#include "qemu-file-channel.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "qemu-file.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "block/block.h"
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "qemu-common.h"
|
||||
#include "exec/target_page.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "qemu-file.h"
|
||||
#include "savevm.h"
|
||||
#include "postcopy-ram.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
|
@ -24,7 +24,8 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-file-channel.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "qemu-file.h"
|
||||
#include "io/channel-socket.h"
|
||||
#include "qemu/iov.h"
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "qemu/sockets.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "qemu-file.h"
|
||||
#include "trace.h"
|
||||
|
||||
#define IO_BUF_SIZE 32768
|
||||
|
@ -22,11 +22,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef QEMU_FILE_H
|
||||
#define QEMU_FILE_H
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#ifndef MIGRATION_QEMU_FILE_H
|
||||
#define MIGRATION_QEMU_FILE_H
|
||||
|
||||
/* Read a chunk of data from a file at the given position. The pos argument
|
||||
* can be ignored if the file is only be used for streaming. The number of
|
||||
@ -122,8 +119,6 @@ int qemu_get_fd(QEMUFile *f);
|
||||
int qemu_fclose(QEMUFile *f);
|
||||
int64_t qemu_ftell(QEMUFile *f);
|
||||
int64_t qemu_ftell_fast(QEMUFile *f);
|
||||
void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, size_t size);
|
||||
void qemu_put_byte(QEMUFile *f, int v);
|
||||
/*
|
||||
* put_buffer without copying the buffer.
|
||||
* The buffer should be available till it is sent asynchronously.
|
||||
@ -133,19 +128,9 @@ void qemu_put_buffer_async(QEMUFile *f, const uint8_t *buf, size_t size,
|
||||
bool qemu_file_mode_is_not_valid(const char *mode);
|
||||
bool qemu_file_is_writable(QEMUFile *f);
|
||||
|
||||
#include "migration/qemu-file-types.h"
|
||||
|
||||
static inline void qemu_put_ubyte(QEMUFile *f, unsigned int v)
|
||||
{
|
||||
qemu_put_byte(f, (int)v);
|
||||
}
|
||||
|
||||
#define qemu_put_sbyte qemu_put_byte
|
||||
|
||||
void qemu_put_be16(QEMUFile *f, unsigned int v);
|
||||
void qemu_put_be32(QEMUFile *f, unsigned int v);
|
||||
void qemu_put_be64(QEMUFile *f, uint64_t v);
|
||||
size_t qemu_peek_buffer(QEMUFile *f, uint8_t **buf, size_t size, size_t offset);
|
||||
size_t qemu_get_buffer(QEMUFile *f, uint8_t *buf, size_t size);
|
||||
size_t qemu_get_buffer_in_place(QEMUFile *f, uint8_t **buf, size_t size);
|
||||
ssize_t qemu_put_compression_data(QEMUFile *f, const uint8_t *p, size_t size,
|
||||
int level);
|
||||
@ -157,22 +142,8 @@ int qemu_put_qemu_file(QEMUFile *f_des, QEMUFile *f_src);
|
||||
* previously peeked +n-1.
|
||||
*/
|
||||
int qemu_peek_byte(QEMUFile *f, int offset);
|
||||
int qemu_get_byte(QEMUFile *f);
|
||||
void qemu_file_skip(QEMUFile *f, int size);
|
||||
void qemu_update_position(QEMUFile *f, size_t size);
|
||||
|
||||
static inline unsigned int qemu_get_ubyte(QEMUFile *f)
|
||||
{
|
||||
return (unsigned int)qemu_get_byte(f);
|
||||
}
|
||||
|
||||
#define qemu_get_sbyte qemu_get_byte
|
||||
|
||||
unsigned int qemu_get_be16(QEMUFile *f);
|
||||
unsigned int qemu_get_be32(QEMUFile *f);
|
||||
uint64_t qemu_get_be64(QEMUFile *f);
|
||||
|
||||
int qemu_file_rate_limit(QEMUFile *f);
|
||||
void qemu_file_reset_rate_limit(QEMUFile *f);
|
||||
void qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate);
|
||||
int64_t qemu_file_get_rate_limit(QEMUFile *f);
|
||||
@ -183,127 +154,7 @@ QEMUFile *qemu_file_get_return_path(QEMUFile *f);
|
||||
void qemu_fflush(QEMUFile *f);
|
||||
void qemu_file_set_blocking(QEMUFile *f, bool block);
|
||||
|
||||
static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv)
|
||||
{
|
||||
qemu_put_be64(f, *pv);
|
||||
}
|
||||
|
||||
static inline void qemu_put_be32s(QEMUFile *f, const uint32_t *pv)
|
||||
{
|
||||
qemu_put_be32(f, *pv);
|
||||
}
|
||||
|
||||
static inline void qemu_put_be16s(QEMUFile *f, const uint16_t *pv)
|
||||
{
|
||||
qemu_put_be16(f, *pv);
|
||||
}
|
||||
|
||||
static inline void qemu_put_8s(QEMUFile *f, const uint8_t *pv)
|
||||
{
|
||||
qemu_put_byte(f, *pv);
|
||||
}
|
||||
|
||||
static inline void qemu_get_be64s(QEMUFile *f, uint64_t *pv)
|
||||
{
|
||||
*pv = qemu_get_be64(f);
|
||||
}
|
||||
|
||||
static inline void qemu_get_be32s(QEMUFile *f, uint32_t *pv)
|
||||
{
|
||||
*pv = qemu_get_be32(f);
|
||||
}
|
||||
|
||||
static inline void qemu_get_be16s(QEMUFile *f, uint16_t *pv)
|
||||
{
|
||||
*pv = qemu_get_be16(f);
|
||||
}
|
||||
|
||||
static inline void qemu_get_8s(QEMUFile *f, uint8_t *pv)
|
||||
{
|
||||
*pv = qemu_get_byte(f);
|
||||
}
|
||||
|
||||
// Signed versions for type safety
|
||||
static inline void qemu_put_sbuffer(QEMUFile *f, const int8_t *buf, size_t size)
|
||||
{
|
||||
qemu_put_buffer(f, (const uint8_t *)buf, size);
|
||||
}
|
||||
|
||||
static inline void qemu_put_sbe16(QEMUFile *f, int v)
|
||||
{
|
||||
qemu_put_be16(f, (unsigned int)v);
|
||||
}
|
||||
|
||||
static inline void qemu_put_sbe32(QEMUFile *f, int v)
|
||||
{
|
||||
qemu_put_be32(f, (unsigned int)v);
|
||||
}
|
||||
|
||||
static inline void qemu_put_sbe64(QEMUFile *f, int64_t v)
|
||||
{
|
||||
qemu_put_be64(f, (uint64_t)v);
|
||||
}
|
||||
|
||||
static inline size_t qemu_get_sbuffer(QEMUFile *f, int8_t *buf, int size)
|
||||
{
|
||||
return qemu_get_buffer(f, (uint8_t *)buf, size);
|
||||
}
|
||||
|
||||
static inline int qemu_get_sbe16(QEMUFile *f)
|
||||
{
|
||||
return (int)qemu_get_be16(f);
|
||||
}
|
||||
|
||||
static inline int qemu_get_sbe32(QEMUFile *f)
|
||||
{
|
||||
return (int)qemu_get_be32(f);
|
||||
}
|
||||
|
||||
static inline int64_t qemu_get_sbe64(QEMUFile *f)
|
||||
{
|
||||
return (int64_t)qemu_get_be64(f);
|
||||
}
|
||||
|
||||
static inline void qemu_put_s8s(QEMUFile *f, const int8_t *pv)
|
||||
{
|
||||
qemu_put_8s(f, (const uint8_t *)pv);
|
||||
}
|
||||
|
||||
static inline void qemu_put_sbe16s(QEMUFile *f, const int16_t *pv)
|
||||
{
|
||||
qemu_put_be16s(f, (const uint16_t *)pv);
|
||||
}
|
||||
|
||||
static inline void qemu_put_sbe32s(QEMUFile *f, const int32_t *pv)
|
||||
{
|
||||
qemu_put_be32s(f, (const uint32_t *)pv);
|
||||
}
|
||||
|
||||
static inline void qemu_put_sbe64s(QEMUFile *f, const int64_t *pv)
|
||||
{
|
||||
qemu_put_be64s(f, (const uint64_t *)pv);
|
||||
}
|
||||
|
||||
static inline void qemu_get_s8s(QEMUFile *f, int8_t *pv)
|
||||
{
|
||||
qemu_get_8s(f, (uint8_t *)pv);
|
||||
}
|
||||
|
||||
static inline void qemu_get_sbe16s(QEMUFile *f, int16_t *pv)
|
||||
{
|
||||
qemu_get_be16s(f, (uint16_t *)pv);
|
||||
}
|
||||
|
||||
static inline void qemu_get_sbe32s(QEMUFile *f, int32_t *pv)
|
||||
{
|
||||
qemu_get_be32s(f, (uint32_t *)pv);
|
||||
}
|
||||
|
||||
static inline void qemu_get_sbe64s(QEMUFile *f, int64_t *pv)
|
||||
{
|
||||
qemu_get_be64s(f, (uint64_t *)pv);
|
||||
}
|
||||
|
||||
size_t qemu_get_counted_string(QEMUFile *f, char buf[256]);
|
||||
|
||||
|
||||
#endif
|
@ -37,7 +37,7 @@
|
||||
#include "qemu/main-loop.h"
|
||||
#include "xbzrle.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "qemu-file.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "postcopy-ram.h"
|
||||
#include "exec/address-spaces.h"
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "qemu-common.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "qemu-file.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "qemu-file-channel.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "qemu/timer.h"
|
||||
#include "migration/migration.h"
|
||||
#include "qemu-file-channel.h"
|
||||
#include "qemu-file.h"
|
||||
#include "savevm.h"
|
||||
#include "postcopy-ram.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "qapi/error.h"
|
||||
#include "channel.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "qemu-file.h"
|
||||
#include "io/channel-socket.h"
|
||||
#include "trace.h"
|
||||
|
||||
|
@ -12,8 +12,9 @@
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "qemu-file.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/queue.h"
|
||||
|
@ -13,8 +13,8 @@
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu-common.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "qemu-file.h"
|
||||
#include "qemu/bitops.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "trace.h"
|
||||
|
@ -27,7 +27,8 @@
|
||||
#include "qemu-common.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "migration/qemu-file-types.h"
|
||||
#include "../migration/qemu-file.h"
|
||||
#include "../migration/qemu-file-channel.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "io/channel-file.h"
|
||||
|
Loading…
Reference in New Issue
Block a user