qualcomm/qbox
Loading...
Searching...
No Matches
qemu-instance-order.h
1/*
2 * Copyright (c) 2026 Qualcomm Innovation Center, Inc. All Rights Reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef _LIBQBOX_QEMU_INSTANCE_ORDER_H
8#define _LIBQBOX_QEMU_INSTANCE_ORDER_H
9
10#include <vector>
11
12/*
13 * Process-wide registry of the QEMU instances, used to decide the order in
14 * which they are initialized (see QemuInstance::init()).
15 */
16namespace qemu_instance_order {
17
18class Entry
19{
20public:
21 virtual ~Entry() = default;
22
23 /* Name used in diagnostics */
24 virtual const char* instance_name() const = 0;
25
26 /* The instance hosts a VNC display */
27 virtual bool instance_has_vnc() const = 0;
28
29 /* Initialize the instance if it is not already */
30 virtual void instance_init_early() = 0;
31};
32
33void register_instance(Entry* e);
34void unregister_instance(Entry* e);
35
36/*
37 * Returns the registered instances to the first caller only, and an empty
38 * list to every later caller. The first QEMU instance being initialized uses
39 * it to initialize the VNC instance before anything else.
40 */
41std::vector<Entry*> claim_first_init();
42
43} // namespace qemu_instance_order
44
45#endif
Definition qemu-instance-order.h:19