Struct panda_sys::DeviceClass[][src]

#[repr(C)]
pub struct DeviceClass {
Show 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,

  1. object instantiation via object_initialize() and
  2. 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.

If a type derived directly from TYPE_DEVICE implements @realize, it does not need to implement @init and therefore does not need to store and call #DeviceClass' default @realize callback. For other types consult the documentation and implementation of the respective parent types.

Fields

parent_class: ObjectClasscategories: [c_ulong; 1]fw_name: *const c_chardesc: *const c_charprops: *mut Propertyuser_creatable: boolcannot_destroy_with_object_finalize_yet: boolhotpluggable: boolreset: Option<unsafe extern "C" fn(dev: *mut DeviceState)>realize: DeviceRealizeunrealize: DeviceUnrealizevmsd: *const VMStateDescriptioninit: qdev_initfnexit: qdev_eventbus_type: *const c_char

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.