xref: /qemu/include/migration/cpr.h (revision aa90f1161bb17a4863e16ec2f75104cff0752d4e)
1e7d79011SSteve Sistare /*
2e7d79011SSteve Sistare  * Copyright (c) 2021, 2024 Oracle and/or its affiliates.
3e7d79011SSteve Sistare  *
4e7d79011SSteve Sistare  * This work is licensed under the terms of the GNU GPL, version 2 or later.
5e7d79011SSteve Sistare  * See the COPYING file in the top-level directory.
6e7d79011SSteve Sistare  */
7e7d79011SSteve Sistare 
8e7d79011SSteve Sistare #ifndef MIGRATION_CPR_H
9e7d79011SSteve Sistare #define MIGRATION_CPR_H
10e7d79011SSteve Sistare 
11e7d79011SSteve Sistare #include "qapi/qapi-types-migration.h"
12e7d79011SSteve Sistare 
13624e6e65SSteve Sistare #define MIG_MODE_NONE           -1
14624e6e65SSteve Sistare 
15e7d79011SSteve Sistare #define QEMU_CPR_FILE_MAGIC     0x51435052
16e7d79011SSteve Sistare #define QEMU_CPR_FILE_VERSION   0x00000001
17e7d79011SSteve Sistare 
18e7d79011SSteve Sistare void cpr_save_fd(const char *name, int id, int fd);
19e7d79011SSteve Sistare void cpr_delete_fd(const char *name, int id);
20e7d79011SSteve Sistare int cpr_find_fd(const char *name, int id);
21e7d79011SSteve Sistare 
22624e6e65SSteve Sistare MigMode cpr_get_incoming_mode(void);
23624e6e65SSteve Sistare void cpr_set_incoming_mode(MigMode mode);
24*1632a201SSteve Sistare bool cpr_is_incoming(void);
25624e6e65SSteve Sistare 
26e7d79011SSteve Sistare int cpr_state_save(MigrationChannel *channel, Error **errp);
27e7d79011SSteve Sistare int cpr_state_load(MigrationChannel *channel, Error **errp);
28e7d79011SSteve Sistare void cpr_state_close(void);
29e7d79011SSteve Sistare struct QIOChannel *cpr_state_ioc(void);
30e7d79011SSteve Sistare 
31b3698869SSteve Sistare QEMUFile *cpr_transfer_output(MigrationChannel *channel, Error **errp);
32b3698869SSteve Sistare QEMUFile *cpr_transfer_input(MigrationChannel *channel, Error **errp);
33b3698869SSteve Sistare 
34e7d79011SSteve Sistare #endif
35