qdev: Introduce FWPathProvider interface
[qemu.git] / include / hw / fw-path-provider.h
1 /*
2 * Firmware patch provider class and helpers definitions.
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 #ifndef FW_PATH_PROVIDER_H
18 #define FW_PATH_PROVIDER_H 1
19
20 #include "qemu-common.h"
21 #include "qom/object.h"
22
23 #define TYPE_FW_PATH_PROVIDER "fw-path-provider"
24
25 #define FW_PATH_PROVIDER_CLASS(klass) \
26 OBJECT_CLASS_CHECK(FWPathProviderClass, (klass), TYPE_FW_PATH_PROVIDER)
27 #define FW_PATH_PROVIDER_GET_CLASS(obj) \
28 OBJECT_GET_CLASS(FWPathProviderClass, (obj), TYPE_FW_PATH_PROVIDER)
29 #define FW_PATH_PROVIDER(obj) \
30 INTERFACE_CHECK(FWPathProvider, (obj), TYPE_FW_PATH_PROVIDER)
31
32 typedef struct FWPathProvider {
33 Object parent_obj;
34 } FWPathProvider;
35
36 typedef struct FWPathProviderClass {
37 InterfaceClass parent_class;
38
39 char *(*get_dev_path)(FWPathProvider *p, BusState *bus, DeviceState *dev);
40 } FWPathProviderClass;
41
42 char *fw_path_provider_get_dev_path(FWPathProvider *p, BusState *bus,
43 DeviceState *dev);
44 char *fw_path_provider_try_get_dev_path(Object *o, BusState *bus,
45 DeviceState *dev);
46
47 #endif /* FW_PATH_PROVIDER_H */