xref: /qemu/include/migration/cpr.h (revision d9ce74873a6a5a7c504379857461e4ae64fcf0cd)
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);
21*f95fd60aSSteve Sistare void cpr_resave_fd(const char *name, int id, int fd);
22*f95fd60aSSteve Sistare int cpr_open_fd(const char *path, int flags, const char *name, int id,
23*f95fd60aSSteve Sistare                 Error **errp);
24e7d79011SSteve Sistare 
25624e6e65SSteve Sistare MigMode cpr_get_incoming_mode(void);
26624e6e65SSteve Sistare void cpr_set_incoming_mode(MigMode mode);
271632a201SSteve Sistare bool cpr_is_incoming(void);
28624e6e65SSteve Sistare 
29e7d79011SSteve Sistare int cpr_state_save(MigrationChannel *channel, Error **errp);
30e7d79011SSteve Sistare int cpr_state_load(MigrationChannel *channel, Error **errp);
31e7d79011SSteve Sistare void cpr_state_close(void);
32e7d79011SSteve Sistare struct QIOChannel *cpr_state_ioc(void);
33e7d79011SSteve Sistare 
34*f95fd60aSSteve Sistare bool cpr_incoming_needed(void *opaque);
35*f95fd60aSSteve Sistare 
36b3698869SSteve Sistare QEMUFile *cpr_transfer_output(MigrationChannel *channel, Error **errp);
37b3698869SSteve Sistare QEMUFile *cpr_transfer_input(MigrationChannel *channel, Error **errp);
38b3698869SSteve Sistare 
39e7d79011SSteve Sistare #endif
40