qga: fix guest-get-disks regression
[qemu/ar7.git] / include / qemu / yank.h
blob5375a1f19529f58e3f39d1c9771bdd34112a79de
1 /*
2 * QEMU yank feature
4 * Copyright (c) Lukas Straub <lukasstraub2@web.de>
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 */
10 #ifndef YANK_H
11 #define YANK_H
13 #include "qapi/qapi-types-yank.h"
15 typedef void (YankFn)(void *opaque);
17 /**
18 * yank_register_instance: Register a new instance.
20 * This registers a new instance for yanking. Must be called before any yank
21 * function is registered for this instance.
23 * This function is thread-safe.
25 * @instance: The instance.
26 * @errp: Error object.
28 * Returns true on success or false if an error occured.
30 bool yank_register_instance(const YankInstance *instance, Error **errp);
32 /**
33 * yank_unregister_instance: Unregister a instance.
35 * This unregisters a instance. Must be called only after every yank function
36 * of the instance has been unregistered.
38 * This function is thread-safe.
40 * @instance: The instance.
42 void yank_unregister_instance(const YankInstance *instance);
44 /**
45 * yank_register_function: Register a yank function
47 * This registers a yank function. All limitations of qmp oob commands apply
48 * to the yank function as well. See docs/devel/qapi-code-gen.txt under
49 * "An OOB-capable command handler must satisfy the following conditions".
51 * This function is thread-safe.
53 * @instance: The instance.
54 * @func: The yank function.
55 * @opaque: Will be passed to the yank function.
57 void yank_register_function(const YankInstance *instance,
58 YankFn *func,
59 void *opaque);
61 /**
62 * yank_unregister_function: Unregister a yank function
64 * This unregisters a yank function.
66 * This function is thread-safe.
68 * @instance: The instance.
69 * @func: func that was passed to yank_register_function.
70 * @opaque: opaque that was passed to yank_register_function.
72 void yank_unregister_function(const YankInstance *instance,
73 YankFn *func,
74 void *opaque);
76 #define BLOCKDEV_YANK_INSTANCE(the_node_name) (&(YankInstance) { \
77 .type = YANK_INSTANCE_TYPE_BLOCK_NODE, \
78 .u.block_node.node_name = (the_node_name) })
80 #define CHARDEV_YANK_INSTANCE(the_id) (&(YankInstance) { \
81 .type = YANK_INSTANCE_TYPE_CHARDEV, \
82 .u.chardev.id = (the_id) })
84 #define MIGRATION_YANK_INSTANCE (&(YankInstance) { \
85 .type = YANK_INSTANCE_TYPE_MIGRATION })
87 #endif