Re: [PATCH 06/10] rust: add bindings for timer

2025-02-08 Thread Zhao Liu
> Please keep init_full(); init() would be a version without some of the > arguments (e.g. the TimerListGroup, or the attributes). Done. ... > > > > +scale: u32, > > While at it, can you add constants for the scale, i.e. > > pub const NS: u32 = bindings::SCALE_NS; > pub const U

Re: [PATCH 06/10] rust: add bindings for timer

2025-02-07 Thread Paolo Bonzini
On 2/7/25 14:33, Zhao Liu wrote: +pub use bindings::QEMUTimer; + +use crate::{ +bindings::{ +self, qemu_clock_get_ns, timer_del, timer_init_full, timer_mod, QEMUClockType, +QEMUTimerListGroup, +}, +callbacks::FnCall, +}; + +impl QEMUTimer { +pub fn new() -> Self {

Re: [PATCH 06/10] rust: add bindings for timer

2025-02-07 Thread Zhao Liu
> > +pub use bindings::QEMUTimer; > > + > > +use crate::{ > > +bindings::{ > > +self, qemu_clock_get_ns, timer_del, timer_init_full, timer_mod, > > QEMUClockType, > > +QEMUTimerListGroup, > > +}, > > +callbacks::FnCall, > > +}; > > + > > +impl QEMUTimer { > > +pub f

Re: [PATCH 06/10] rust: add bindings for timer

2025-01-29 Thread Paolo Bonzini
On Sat, Jan 25, 2025 at 1:32 PM Zhao Liu wrote: + c_nocopy = [ +'QEMUTimer', + ] + # Used to customize Drop trait + foreach struct : c_nocopy +bindgen_args += ['--no-copy', struct] + endforeach Nice. +pub use bindings::QEMUTimer; + +use crate::{ +bindings::{ +self

[PATCH 06/10] rust: add bindings for timer

2025-01-25 Thread Zhao Liu
Add timer bindings to help handle idiomatic Rust callbacks. Additionally, wrap QEMUClockType in ClockType binding to avoid unsafe calls in device code. Signed-off-by: Zhao Liu --- Changes since RFC: * Use FnCall to support timer callback. * Only add timer_init_full() binding. timer_new() is un