From: Greg Kurz <groug@kaod.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Laurent Vivier <lvivier@redhat.com>,
QEMU Developers <qemu-devel@nongnu.org>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH] qtest: ask endianness of the target in qtest_init()
Date: Fri, 7 Oct 2016 11:57:38 +0200 [thread overview]
Message-ID: <20161007115738.6f5ddbad@bahia> (raw)
In-Reply-To: <CAFEAcA_3LO8NyQr=6OHZAEmpTtoXscoUUUcDSr+Pf_9X2wS=NA@mail.gmail.com>
On Fri, 7 Oct 2016 10:36:58 +0100
Peter Maydell <peter.maydell@linaro.org> wrote:
> On 7 October 2016 at 08:31, Greg Kurz <groug@kaod.org> wrote:
> > On Fri, 7 Oct 2016 09:10:14 +0200
> > Laurent Vivier <lvivier@redhat.com> wrote:
> >
> >> On 06/10/2016 22:45, Peter Maydell wrote:
> >> > On 6 October 2016 at 11:56, Laurent Vivier <lvivier@redhat.com> wrote:
> >> >> + /* ask endianness of the target */
> >> >> +
> >> >> + qtest_sendf(s, "endianness\n");
> >> >> + args = qtest_rsp(s, 1);
> >> >> + g_assert(strcmp(args[1], "big") == 0 || strcmp(args[1], "little") == 0);
> >> >> + s->big_endian = strcmp(args[1], "big") == 0;
> >> >> + g_strfreev(args);
> >> >
> >> > This would be better in its own utility function, I think.
> >>
> >> Yes, I agree, but my wondering was how to name it :P ,
> >> qtest_big_endian() and target_big_endian() are already in use, and as it
> >> is a 6 lines function, used once, I guessed we could inline it here.
> >>
> >
> > This is TARGET_WORDS_BIGENDIAN which is constant for a single QEMU
> > run... why moving it to a function ? Unless there are plans to
> > have dynamic target endianness in QEMU, I guess it makes more
> > sense to open code as you did.
>
> I thought it would be better in its own function simply
> because "query the QEMU process for the value of
> TARGET_WORDS_BIGENDIAN" is a simple well defined and
> self contained operation, which isn't very tightly
> coupled to the init-the-connection stuff that qtest_init()
> does. qtest_init() is already a fairly long function and
> so I think it makes for more maintainable code to have
> a (static, local) qtest_query_target_endianness() function
> rather than inlining it.
>
> thanks
> -- PMM
It's a matter of taste, but your point makes sense.
I'd say let the maintainer decide, but...
$ ./scripts/get_maintainer.pl -f tests/libqtest.c
get_maintainer.pl: No maintainers found, printing recent contributors.
get_maintainer.pl: Do not blindly cc: them on patches! Use common sense.
Cheers.
--
Greg
next prev parent reply other threads:[~2016-10-07 9:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-06 18:56 [Qemu-devel] [PATCH] qtest: ask endianness of the target in qtest_init() Laurent Vivier
2016-10-06 20:45 ` Peter Maydell
2016-10-07 7:10 ` Laurent Vivier
2016-10-07 7:31 ` Greg Kurz
2016-10-07 9:36 ` Peter Maydell
2016-10-07 9:57 ` Greg Kurz [this message]
2016-10-06 20:46 ` Greg Kurz
2016-10-06 23:55 ` David Gibson
2016-10-07 7:14 ` Greg Kurz
2016-10-07 9:39 ` Peter Maydell
2016-10-07 10:10 ` Greg Kurz
2016-10-10 1:30 ` David Gibson
2016-10-10 1:28 ` David Gibson
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=20161007115738.6f5ddbad@bahia \
--to=groug@kaod.org \
--cc=david@gibson.dropbear.id.au \
--cc=lvivier@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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 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).