block: Mark bdrv_cow_child() and callers GRAPH_RDLOCK
[qemu/kevin.git] / include / migration / blocker.h
bloba687ac0efea8b1096f4e45bda580dea59e660bc2
1 /*
2 * QEMU migration blockers
4 * Copyright IBM, Corp. 2008
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #ifndef MIGRATION_BLOCKER_H
15 #define MIGRATION_BLOCKER_H
17 #include "qapi/qapi-types-migration.h"
19 #define MIG_MODE_ALL MIG_MODE__MAX
21 /**
22 * @migrate_add_blocker - prevent all modes of migration from proceeding
24 * @reasonp - address of an error to be returned whenever migration is attempted
26 * @errp - [out] The reason (if any) we cannot block migration right now.
28 * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set.
30 * *@reasonp is freed and set to NULL if failure is returned.
31 * On success, the caller must not free @reasonp, except by
32 * calling migrate_del_blocker.
34 int migrate_add_blocker(Error **reasonp, Error **errp);
36 /**
37 * @migrate_add_blocker_internal - prevent all modes of migration from
38 * proceeding, but ignore -only-migratable
40 * @reasonp - address of an error to be returned whenever migration is attempted
42 * @errp - [out] The reason (if any) we cannot block migration right now.
44 * @returns - 0 on success, -EBUSY on failure, with errp set.
46 * Some of the migration blockers can be temporary (e.g., for a few seconds),
47 * so it shouldn't need to conflict with "-only-migratable". For those cases,
48 * we can call this function rather than @migrate_add_blocker().
50 * *@reasonp is freed and set to NULL if failure is returned.
51 * On success, the caller must not free @reasonp, except by
52 * calling migrate_del_blocker.
54 int migrate_add_blocker_internal(Error **reasonp, Error **errp);
56 /**
57 * @migrate_del_blocker - remove a migration blocker from all modes and free it.
59 * @reasonp - address of the error blocking migration
61 * This function frees *@reasonp and sets it to NULL.
63 void migrate_del_blocker(Error **reasonp);
65 /**
66 * @migrate_add_blocker_normal - prevent normal migration mode from proceeding
68 * @reasonp - address of an error to be returned whenever migration is attempted
70 * @errp - [out] The reason (if any) we cannot block migration right now.
72 * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set.
74 * *@reasonp is freed and set to NULL if failure is returned.
75 * On success, the caller must not free @reasonp, except by
76 * calling migrate_del_blocker.
78 int migrate_add_blocker_normal(Error **reasonp, Error **errp);
80 /**
81 * @migrate_add_blocker_modes - prevent some modes of migration from proceeding
83 * @reasonp - address of an error to be returned whenever migration is attempted
85 * @errp - [out] The reason (if any) we cannot block migration right now.
87 * @mode - one or more migration modes to be blocked. The list is terminated
88 * by -1 or MIG_MODE_ALL. For the latter, all modes are blocked.
90 * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set.
92 * *@reasonp is freed and set to NULL if failure is returned.
93 * On success, the caller must not free *@reasonp before the blocker is removed.
95 int migrate_add_blocker_modes(Error **reasonp, Error **errp, MigMode mode, ...);
97 #endif