From: Markus Armbruster <armbru@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: jasowang@redhat.com, mst@redhat.com, peterx@redhat.com,
farosas@suse.de, raphael.s.norwitz@gmail.com,
bchaney@akamai.com, qemu-devel@nongnu.org, berrange@redhat.com,
pbonzini@redhat.com, yc-core@yandex-team.ru,
mark.caveayland@nutanix.com, Jason Wang <jasowangio@gmail.com>
Subject: Re: [PATCH v19 01/15] net/tap: rework tap_parse_script
Date: Tue, 21 Jul 2026 08:07:48 +0200 [thread overview]
Message-ID: <87wluoswnf.fsf@pond.sub.org> (raw)
In-Reply-To: <20260714154246.1242856-2-vsementsov@yandex-team.ru> (Vladimir Sementsov-Ogievskiy's message of "Tue, 14 Jul 2026 18:42:29 +0300")
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> writes:
> Factor out tap_is_explicit_no_script() helper, to simplify
> further changes.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
> net/tap.c | 27 +++++++++++++++++++++------
> 1 file changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/net/tap.c b/net/tap.c
> index 57ffb09885c..fedd48c48d2 100644
> --- a/net/tap.c
> +++ b/net/tap.c
> @@ -92,19 +92,34 @@ static void launch_script(const char *setup_script, const char *ifname,
> static void tap_send(void *opaque);
> static void tap_writable(void *opaque);
>
> -static char *tap_parse_script(const char *script_arg, const char *default_path)
> +static bool tap_is_explicit_no_script(const char *script_arg)
> {
> - g_autofree char *res = g_strdup(script_arg);
> + if (!script_arg) {
> + return false;
> + }
>
> - if (!res) {
> - res = get_relocated_path(default_path);
> + if (script_arg[0] == '\0') {
> + return true;
> + }
> +
> + if (strcmp(script_arg, "no") == 0) {
> + return true;
> }
>
> - if (res[0] == '\0' || strcmp(res, "no") == 0) {
> + return false;
> +}
> +
> +static char *tap_parse_script(const char *script_arg, const char *default_path)
> +{
> + if (tap_is_explicit_no_script(script_arg)) {
> return NULL;
> }
>
> - return g_steal_pointer(&res);
> + if (!script_arg) {
> + return get_relocated_path(default_path);
> + }
> +
> + return g_strdup(script_arg);
> }
>
> static void tap_update_fd_handler(TAPState *s)
Before the patch, we default @script_arg to get_relocated_path(default)
first, then check for "" or "no". After the patch, we do it the other
way round. Works, because get_relocated_path() never returns "" or
"no". Worth mentioning in the commit message?
The new order feels slightly clearer to me.
Reviewed-by: Markus Armbruster <armbru@redhat.com>
next prev parent reply other threads:[~2026-07-21 6:08 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 15:42 [PATCH v19 00/15] virtio-net: live-TAP local migration Vladimir Sementsov-Ogievskiy
2026-07-14 15:42 ` [PATCH v19 01/15] net/tap: rework tap_parse_script Vladimir Sementsov-Ogievskiy
2026-07-21 6:07 ` Markus Armbruster [this message]
2026-07-21 6:59 ` Vladimir Sementsov-Ogievskiy
2026-07-14 15:42 ` [PATCH v19 02/15] net/tap: improve script/downscript options documentation Vladimir Sementsov-Ogievskiy
2026-07-14 15:42 ` [PATCH v19 03/15] net/tap: deprecate "no" as special value for script/downscript Vladimir Sementsov-Ogievskiy
2026-07-21 6:34 ` Markus Armbruster
2026-07-21 7:04 ` Vladimir Sementsov-Ogievskiy
2026-07-14 15:42 ` [PATCH v19 04/15] net/tap: move vhost-net open() calls to tap_parse_vhost_fds() Vladimir Sementsov-Ogievskiy
2026-07-14 15:42 ` [PATCH v19 05/15] net/tap: move vhost initialization to tap_setup_vhost() Vladimir Sementsov-Ogievskiy
2026-07-14 15:42 ` [PATCH v19 06/15] net/tap: use container_of instead of DO_UPCAST Vladimir Sementsov-Ogievskiy
2026-07-14 15:42 ` [PATCH v19 07/15] net/tap: QOMify tap backend Vladimir Sementsov-Ogievskiy
2026-07-14 15:42 ` [PATCH v19 08/15] net/tap: add TYPE_VMSTATE_IF interface Vladimir Sementsov-Ogievskiy
2026-07-14 15:42 ` [PATCH v19 09/15] qapi: add local migration parameter Vladimir Sementsov-Ogievskiy
2026-07-21 6:47 ` Markus Armbruster
2026-07-21 7:14 ` Vladimir Sementsov-Ogievskiy
2026-07-14 15:42 ` [PATCH v19 10/15] migration/channel: check that transfer is UNIX socket when "local" set Vladimir Sementsov-Ogievskiy
2026-07-14 15:42 ` [PATCH v19 11/15] virtio-net: support local migration of backend Vladimir Sementsov-Ogievskiy
2026-07-14 15:42 ` [PATCH v19 12/15] net/tap: disable read polling for stopped VM Vladimir Sementsov-Ogievskiy
2026-07-15 14:51 ` Chaney, Ben
2026-07-16 18:31 ` Vladimir Sementsov-Ogievskiy
2026-07-14 15:42 ` [PATCH v19 13/15] net/tap: support local migration with virtio-net Vladimir Sementsov-Ogievskiy
2026-07-15 8:10 ` Vladimir Sementsov-Ogievskiy
2026-07-15 14:54 ` Chaney, Ben
2026-07-16 18:34 ` Vladimir Sementsov-Ogievskiy
2026-07-21 6:57 ` Markus Armbruster
2026-07-21 7:16 ` Vladimir Sementsov-Ogievskiy
2026-07-14 15:42 ` [PATCH v19 14/15] tests/functional: add skipWithoutSudo() decorator Vladimir Sementsov-Ogievskiy
2026-07-14 15:42 ` [PATCH v19 15/15] tests/functional: add test_tap_migration Vladimir Sementsov-Ogievskiy
2026-07-15 14:46 ` [PATCH v19 00/15] virtio-net: live-TAP local migration Chaney, Ben
2026-07-16 18:34 ` Vladimir Sementsov-Ogievskiy
2026-07-15 15:01 ` Michael Tokarev
2026-07-15 15:48 ` Michael S. Tsirkin
2026-07-15 15:52 ` Daniel P. Berrangé
2026-07-15 16:00 ` Peter Xu
2026-07-15 20:21 ` Vladimir Sementsov-Ogievskiy
2026-07-15 20:32 ` Michael S. Tsirkin
2026-07-15 22:11 ` Vladimir Sementsov-Ogievskiy
2026-07-15 22:45 ` Michael S. Tsirkin
2026-07-16 0:30 ` Vladimir Sementsov-Ogievskiy
2026-07-16 5:18 ` Michael S. Tsirkin
2026-07-16 8:58 ` Vladimir Sementsov-Ogievskiy
2026-07-15 20:10 ` Vladimir Sementsov-Ogievskiy
2026-07-15 20:20 ` Michael S. Tsirkin
2026-07-15 20:48 ` Vladimir Sementsov-Ogievskiy
2026-07-15 21:23 ` Michael S. Tsirkin
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=87wluoswnf.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=bchaney@akamai.com \
--cc=berrange@redhat.com \
--cc=farosas@suse.de \
--cc=jasowang@redhat.com \
--cc=jasowangio@gmail.com \
--cc=mark.caveayland@nutanix.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=raphael.s.norwitz@gmail.com \
--cc=vsementsov@yandex-team.ru \
--cc=yc-core@yandex-team.ru \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.