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