]> git.proxmox.com Git - mirror_qemu.git/blame - include/qemu/yank.h
util/uri: Remove uri_string_unescape()
[mirror_qemu.git] / include / qemu / yank.h
CommitLineData
50186051
LS
1/*
2 * QEMU yank feature
3 *
4 * Copyright (c) Lukas Straub <lukasstraub2@web.de>
5 *
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 */
9
10#ifndef YANK_H
11#define YANK_H
12
13#include "qapi/qapi-types-yank.h"
14
15typedef void (YankFn)(void *opaque);
16
17/**
18 * yank_register_instance: Register a new instance.
19 *
20 * This registers a new instance for yanking. Must be called before any yank
21 * function is registered for this instance.
22 *
23 * This function is thread-safe.
24 *
25 * @instance: The instance.
26 * @errp: Error object.
27 *
d02d06f8 28 * Returns true on success or false if an error occurred.
50186051
LS
29 */
30bool yank_register_instance(const YankInstance *instance, Error **errp);
31
32/**
33 * yank_unregister_instance: Unregister a instance.
34 *
35 * This unregisters a instance. Must be called only after every yank function
36 * of the instance has been unregistered.
37 *
38 * This function is thread-safe.
39 *
40 * @instance: The instance.
41 */
42void yank_unregister_instance(const YankInstance *instance);
43
44/**
45 * yank_register_function: Register a yank function
46 *
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".
50 *
51 * This function is thread-safe.
52 *
53 * @instance: The instance.
54 * @func: The yank function.
55 * @opaque: Will be passed to the yank function.
56 */
57void yank_register_function(const YankInstance *instance,
58 YankFn *func,
59 void *opaque);
60
61/**
62 * yank_unregister_function: Unregister a yank function
63 *
64 * This unregisters a yank function.
65 *
66 * This function is thread-safe.
67 *
68 * @instance: The instance.
69 * @func: func that was passed to yank_register_function.
70 * @opaque: opaque that was passed to yank_register_function.
71 */
72void yank_unregister_function(const YankInstance *instance,
73 YankFn *func,
74 void *opaque);
75
50186051
LS
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) })
79
80#define CHARDEV_YANK_INSTANCE(the_id) (&(YankInstance) { \
81 .type = YANK_INSTANCE_TYPE_CHARDEV, \
82 .u.chardev.id = (the_id) })
83
84#define MIGRATION_YANK_INSTANCE (&(YankInstance) { \
85 .type = YANK_INSTANCE_TYPE_MIGRATION })
86
87#endif