Struct panda_sys::DeviceClass [−][src]
#[repr(C)]pub struct DeviceClass {}Show 15 fields
pub parent_class: ObjectClass, pub categories: [c_ulong; 1], pub fw_name: *const c_char, pub desc: *const c_char, pub props: *mut Property, pub user_creatable: bool, pub cannot_destroy_with_object_finalize_yet: bool, pub hotpluggable: bool, pub reset: Option<unsafe extern "C" fn(dev: *mut DeviceState)>, pub realize: DeviceRealize, pub unrealize: DeviceUnrealize, pub vmsd: *const VMStateDescription, pub init: qdev_initfn, pub exit: qdev_event, pub bus_type: *const c_char,
Expand description
DeviceClass: @props: Properties accessing state fields. @realize: Callback function invoked when the #DeviceState:realized property is changed to %true. The default invokes @init if not %NULL. @unrealize: Callback function invoked when the #DeviceState:realized property is changed to %false. @init: Callback function invoked when the #DeviceState::realized property is changed to %true. Deprecated, new types inheriting directly from TYPE_DEVICE should use @realize instead, new leaf types should consult their respective parent type. @hotpluggable: indicates if #DeviceClass is hotpluggable, available as readonly “hotpluggable” property of #DeviceState instance
Realization
Devices are constructed in two stages,
- object instantiation via object_initialize() and
- device realization via #DeviceState:realized property. The former may not fail (it might assert or exit), the latter may return error information to the caller and must be re-entrant. Trivial field initializations should go into #TypeInfo.instance_init. Operations depending on @props static properties should go into @realize. After successful realization, setting static properties will fail.
As an interim step, the #DeviceState:realized property can also be set with qdev_init_nofail(). In the future, devices will propagate this state change to their children and along busses they expose. The point in time will be deferred to machine creation, so that values set in @realize will not be introspectable beforehand. Therefore devices must not create children during @realize; they should initialize them via object_initialize() in their own #TypeInfo.instance_init and forward the realization events appropriately.
The @init callback is considered private to a particular bus implementation (immediate abstract child types of TYPE_DEVICE). Derived leaf types set an “init” callback on their parent class instead.
Any type may override the @realize and/or @unrealize callbacks but needs to call the parent type’s implementation if keeping their functionality is desired. Refer to QOM documentation for further discussion and examples.
Fields
parent_class: ObjectClass
categories: [c_ulong; 1]
fw_name: *const c_char
desc: *const c_char
props: *mut Property
user_creatable: bool
cannot_destroy_with_object_finalize_yet: bool
hotpluggable: bool
reset: Option<unsafe extern "C" fn(dev: *mut DeviceState)>
realize: DeviceRealize
unrealize: DeviceUnrealize
vmsd: *const VMStateDescription
init: qdev_initfn
exit: qdev_event
bus_type: *const c_char
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for DeviceClass
impl !Send for DeviceClass
impl !Sync for DeviceClass
impl Unpin for DeviceClass
impl UnwindSafe for DeviceClass
Blanket Implementations
Mutably borrows from an owned value. Read more