qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Levon <john.levon@nutanix.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Cédric Le Goater" <clg@redhat.com>,
	qemu-devel@nongnu.org,
	"Thanos Makatos" <thanos.makatos@nutanix.com>,
	"Mark Cave-Ayland" <mark.caveayland@nutanix.com>
Subject: Re: [PATCH v2 4/5] vfio-user: simplify vfio_user_recv_one()
Date: Tue, 25 Nov 2025 23:46:00 +0530	[thread overview]
Message-ID: <aSXyYNzpuYAxAfAr@lent> (raw)
In-Reply-To: <CAFEAcA8+3=ZErD=pxs8Ne9+D1ZXujBKh000XiQs4egXayw9tcg@mail.gmail.com>

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	other threads:[~2025-11-25 18:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17 15:56 [PATCH v2 0/5] vfio-user coverity fixes John Levon
2025-11-17 15:56 ` [PATCH v2 1/5] vfio-user: simplify vfio_user_process() John Levon
2025-11-18 14:15   ` Cédric Le Goater
2025-11-17 15:56 ` [PATCH v2 2/5] vfio-user: clarify partial message handling John Levon
2025-11-18 14:15   ` Cédric Le Goater
2025-11-17 15:56 ` [PATCH v2 3/5] vfio-user: refactor out header handling John Levon
2025-11-18 14:38   ` Cédric Le Goater
2025-11-17 15:56 ` [PATCH v2 4/5] vfio-user: simplify vfio_user_recv_one() John Levon
2025-11-18 14:57   ` Cédric Le Goater
2025-11-18 15:03     ` John Levon
2025-11-25  7:43       ` Cédric Le Goater
2025-11-25 17:13     ` Peter Maydell
2025-11-25 18:16       ` John Levon [this message]
2025-11-25 16:20   ` Thanos Makatos
2025-11-17 15:56 ` [PATCH v2 5/5] vfio-user: recycle msg on failure John Levon
2025-11-17 15:58   ` John Levon
2025-11-18 15:18     ` Philippe Mathieu-Daudé
2025-11-18 17:43       ` John Levon
2025-11-19 13:45       ` John Levon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aSXyYNzpuYAxAfAr@lent \
    --to=john.levon@nutanix.com \
    --cc=clg@redhat.com \
    --cc=mark.caveayland@nutanix.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thanos.makatos@nutanix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).