On Thu, 20 Mar 2025 at 15:25, Zhao Liu wrote:
>
> > -use std::{ffi::CStr, ptr::addr_of_mut};
> > +use std::{ffi::CStr, mem, ptr::addr_of_mut};
>
> maybe mem::size_of (since there're 2 use cases :-))?
>
> >
> > use qemu_api::{
> > +bindings,
> > chardev::{CharBackend, Chardev, Event},
> >
> > > +// Some C users of this device embed its state struct into their own
> > > +// structs, so the size of the Rust version must not be any larger
> > > +// than the size of the C one. If this assert triggers you need to
> > > +// expand the padding_for_rust[] array in the C PL011State struct.
>
> -use std::{ffi::CStr, ptr::addr_of_mut};
> +use std::{ffi::CStr, mem, ptr::addr_of_mut};
maybe mem::size_of (since there're 2 use cases :-))?
>
> use qemu_api::{
> +bindings,
> chardev::{CharBackend, Chardev, Event},
> +static_assert,
This one looks like it breaks the alphabet
The PL011 device's C implementation exposes its PL011State struct to
users of the device, and one common usage pattern is to embed that
struct into the user's own state struct. (The internals of the
struct are technically visible to the C user of the device, but in
practice are treated as implemen