On Tue, Nov 25, 2025 at 05:13:14PM +0000, Peter Maydell wrote:

> static int vfio_user_recv_one(VFIOUserProxy *proxy, Error **errp)
> {
>     /* common prep, header read, etc code here */
> 
>     switch (hdr.flags & VFIO_USER_TYPE) {
>     case VFIO_USER_REQUEST:
>         return vfio_user_handle_request(...stuff...);
>         break;
>     case VFIO_USER_REPLY:
>         return vfio_user_handle_request(...stuff...);
>         break;
>     default:
>         error_setg(errp, "unknown message type");
>         goto fatal;
>     }
> }

I did look at this variant, but it really wasn't that much nicer, and still had
a non-trivial amount of duplication.

If you feel super strongly I can present that version.

regards
john

Reply via email to