Revision 1431b6a1 hw/qdev.h
b/hw/qdev.h | ||
---|---|---|
49 | 49 |
|
50 | 50 |
/* Set properties between creation and init. */ |
51 | 51 |
void qdev_set_prop_int(DeviceState *dev, const char *name, uint64_t value); |
52 |
void qdev_set_prop_dev(DeviceState *dev, const char *name, DeviceState *value); |
|
52 | 53 |
void qdev_set_prop_ptr(DeviceState *dev, const char *name, void *value); |
53 | 54 |
void qdev_set_netdev(DeviceState *dev, NICInfo *nd); |
54 | 55 |
|
... | ... | |
59 | 60 |
|
60 | 61 |
/*** Device API. ***/ |
61 | 62 |
|
63 |
typedef enum { |
|
64 |
PROP_TYPE_INT, |
|
65 |
PROP_TYPE_PTR, |
|
66 |
PROP_TYPE_DEV |
|
67 |
} DevicePropType; |
|
68 |
|
|
69 |
typedef struct { |
|
70 |
const char *name; |
|
71 |
DevicePropType type; |
|
72 |
} DevicePropList; |
|
73 |
|
|
62 | 74 |
typedef struct DeviceInfo DeviceInfo; |
63 | 75 |
|
64 | 76 |
typedef void (*qdev_initfn)(DeviceState *dev, DeviceInfo *info); |
... | ... | |
68 | 80 |
struct DeviceInfo { |
69 | 81 |
qdev_initfn init; |
70 | 82 |
BusType bus_type; |
83 |
DevicePropList *props; |
|
71 | 84 |
}; |
72 | 85 |
|
73 | 86 |
void qdev_register(const char *name, int size, DeviceInfo *info); |
... | ... | |
83 | 96 |
|
84 | 97 |
BusState *qdev_get_parent_bus(DeviceState *dev); |
85 | 98 |
uint64_t qdev_get_prop_int(DeviceState *dev, const char *name, uint64_t def); |
99 |
DeviceState *qdev_get_prop_dev(DeviceState *dev, const char *name); |
|
100 |
/* FIXME: Remove opaque pointer properties. */ |
|
86 | 101 |
void *qdev_get_prop_ptr(DeviceState *dev, const char *name); |
87 | 102 |
|
88 | 103 |
/* Convery from a base type to a parent type, with compile time checking. */ |
Also available in: Unified diff