Re: [PATCH RFC 11/15] hw/virtio/vhost-user: create isolation region
Connor Kite <[email protected]>
| Newsgroups | org.nongnu.qemu-devel,dev.linux.lists.virtio-fs |
|---|---|
| Message-ID | <CA+spn3o8FRxRK6q8SAyXxjNhRBdCt7m3Si3hqD5JZ9WpVf+FWQ@mail.gmail.com> |
On Tue, Aug 4, 2026 at 4:03 AM Hanna Czenczek <[email protected]> wrote: > > > > > I guess the alternative would be to have an `isolation_mode_ctx` > > type of struct to hold all of the above. > > Yes, that’s what I thought, to have an object that would hold everything > that is used by the isolation code (and rather specific to the isolation > code). > You got it! A struct to hold all context specific to isolation mode will be in the next rev. ... > > I mean, in this case, I would have just used a plain C array because the > size is pre-determined by `nregions`, right. > > In general, *I* have not used GArray yet (no particular reason), which > is why I had not come in contact with the `&g_array_index()` pattern > yet, which had me stare in disbelief at first. (My main problem being > that the name `g_array_index` is written in lowercase and thus indicates > being a normal function, whereas macros in C are generally written in > uppercase to allow at-a-glance distinction. So it pretends to be a > normal function, but glib recommends a pattern of use > (`&g_array_index()`) that would never work with a normal function, and > that I find a dreadful decision by glib.) > > Hanna > g_array ugliness is now avoided by using g_new0 with nregions to allocate the memory.