mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
rust/irq: Add a helper to convert [InterruptSource] to pointer
This is useful when taking an InterruptSource slice and passing it to C function. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250210030051.2562726-4-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
7f2d4181a3
commit
e6f1195f55
1 changed files with 6 additions and 0 deletions
|
@ -83,6 +83,12 @@ where
|
|||
pub(crate) const fn as_ptr(&self) -> *mut *mut IRQState {
|
||||
self.cell.as_ptr()
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) const fn slice_as_ptr(slice: &[Self]) -> *mut *mut IRQState {
|
||||
assert!(!slice.is_empty());
|
||||
slice[0].as_ptr()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for InterruptSource {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue