]> Git Repo - qemu.git/blob - hw/core/fw-path-provider.c
qdev: Introduce FWPathProvider interface
[qemu.git] / hw / core / fw-path-provider.c
1 /*
2  *  Firmware patch provider class and helpers.
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; under version 2 of the License.
7  *
8  *  This program is distributed in the hope that it will be useful,
9  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  *  GNU General Public License for more details.
12  *
13  *  You should have received a copy of the GNU General Public License
14  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
15  */
16
17 #include "hw/fw-path-provider.h"
18
19 char *fw_path_provider_get_dev_path(FWPathProvider *p, BusState *bus,
20                                     DeviceState *dev)
21 {
22     FWPathProviderClass *k = FW_PATH_PROVIDER_GET_CLASS(p);
23
24     return k->get_dev_path(p, bus, dev);
25 }
26
27 char *fw_path_provider_try_get_dev_path(Object *o, BusState *bus,
28                                         DeviceState *dev)
29 {
30     FWPathProvider *p = (FWPathProvider *)
31         object_dynamic_cast(o, TYPE_FW_PATH_PROVIDER);
32
33     if (p) {
34         return fw_path_provider_get_dev_path(p, bus, dev);
35     }
36
37     return NULL;
38 }
39
40 static const TypeInfo fw_path_provider_info = {
41     .name          = TYPE_FW_PATH_PROVIDER,
42     .parent        = TYPE_INTERFACE,
43     .class_size    = sizeof(FWPathProviderClass),
44 };
45
46 static void fw_path_provider_register_types(void)
47 {
48     type_register_static(&fw_path_provider_info);
49 }
50
51 type_init(fw_path_provider_register_types)
This page took 0.024881 seconds and 4 git commands to generate.