hw/arm/mps2-tz: Make initsvtor0 setting board-specific
[qemu/ar7.git] / include / qemu / yank.h
blob5b93c70cbf94f77fc44d4169b2c64596190eec5a
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 /**
77 * yank_generic_iochannel: Generic yank function for iochannel
79 * This is a generic yank function which will call qio_channel_shutdown on the
80 * provided QIOChannel.
82 * @opaque: QIOChannel to shutdown
84 void yank_generic_iochannel(void *opaque);
86 #define BLOCKDEV_YANK_INSTANCE(the_node_name) (&(YankInstance) { \
87 .type = YANK_INSTANCE_TYPE_BLOCK_NODE, \
88 .u.block_node.node_name = (the_node_name) })
90 #define CHARDEV_YANK_INSTANCE(the_id) (&(YankInstance) { \
91 .type = YANK_INSTANCE_TYPE_CHARDEV, \
92 .u.chardev.id = (the_id) })
94 #define MIGRATION_YANK_INSTANCE (&(YankInstance) { \
95 .type = YANK_INSTANCE_TYPE_MIGRATION })
97 #endif