From: "Roger Pau Monné" <roger.pau@citrix.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: "Anthony PERARD" <anthony@xenproject.org>,
qemu-devel@nongnu.org,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Paul Durrant" <paul@xen.org>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH 2/2] xen: do not use '%ms' scanf specifier
Date: Thu, 9 Jan 2025 17:55:20 +0100 [thread overview]
Message-ID: <Z3__eDp4hShe79Pl@macbook.local> (raw)
In-Reply-To: <974ab6743d168d34babd458fe5e2e7766bb280b4.camel@infradead.org>
On Thu, Jan 09, 2025 at 11:25:13AM +0000, David Woodhouse wrote:
> On Thu, 2025-01-09 at 11:59 +0100, Anthony PERARD wrote:
> >
> > > char label[32];
> > > XenDevice *xendev = NULL;
> > > XenConsole *con;
> > > @@ -550,7 +551,10 @@ static void xen_console_device_create(XenBackendInstance *backend,
> > > goto fail;
> > > }
> > >
> > > - if (xs_node_scanf(xsh, XBT_NULL, fe, "type", errp, "%ms", &type) != 1) {
> > > + node_path = g_strdup_printf("%s/type", fe);
> > > + type = qemu_xen_xs_read(xsh, XBT_NULL, node_path, NULL);
> > > + g_free(node_path);
> >
> > I feel like we want "xs_node_read()" which would be similair to
> > xs_node_vscanf() but would simply return the result of
> > qemu_xen_xs_read(). This would avoid the need format of the node path in
> > several place in the code. But it's OK like that as well.
>
> If you look at the other callers of qemu_xen_xs_read(), it looks like
> the majority of them create the path with snprintf and then pass it in.
> Or with g_strdup_printf(), pass it in, then free it afterwards.
>
> So perhaps qemu_xen_xs_read() should be a printf-style function too,
> with its last arg(s) being the node name.
I just went with Anthony suggestion and introduced xs_node_read(), as
I didn't want to play with qemu_xen_xs_read(). Not that I think the
suggestion is not valid, just seemed more work than what I wanted to
do right now.
Thanks, Roger.
next prev parent reply other threads:[~2025-01-09 16:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 9:31 [PATCH 0/2] xen: error handling and FreeBSD compatibility fixes Roger Pau Monne
2025-01-07 9:31 ` [PATCH 1/2] xen/console: fix error handling in xen_console_device_create() Roger Pau Monne
2025-01-09 10:13 ` Anthony PERARD
2025-01-09 16:06 ` Roger Pau Monné
2025-01-07 9:31 ` [PATCH 2/2] xen: do not use '%ms' scanf specifier Roger Pau Monne
2025-01-09 10:59 ` Anthony PERARD
2025-01-09 11:25 ` David Woodhouse
2025-01-09 16:55 ` Roger Pau Monné [this message]
2025-01-10 8:08 ` David Woodhouse
2025-01-10 8:16 ` Philippe Mathieu-Daudé
2025-01-10 8:21 ` David Woodhouse
2025-01-09 16:15 ` Roger Pau Monné
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=Z3__eDp4hShe79Pl@macbook.local \
--to=roger.pau@citrix.com \
--cc=anthony@xenproject.org \
--cc=dwmw2@infradead.org \
--cc=edgar.iglesias@gmail.com \
--cc=marcandre.lureau@redhat.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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.