From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Marc-André Lureau" <marcandre.lureau@gmail.com>,
"Thomas Huth" <thuth@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Lucien Murray-Pitts" <lucienmp.qemu@gmail.com>
Subject: Re: RFC: Why dont we move to newer capstone?
Date: Tue, 15 Oct 2019 11:12:23 +0100 [thread overview]
Message-ID: <20191015101223.GF22859@redhat.com> (raw)
In-Reply-To: <CAFEAcA8_MSHnGhr0R=YDqT7kZJTSOh-U5KmqGAJ5A3XuqV=-Qw@mail.gmail.com>
On Tue, Oct 15, 2019 at 10:57:44AM +0100, Peter Maydell wrote:
> On Tue, 15 Oct 2019 at 10:14, Daniel P. Berrangé <berrange@redhat.com> wrote:
> >
> > On Tue, Oct 15, 2019 at 11:02:43AM +0200, Marc-André Lureau wrote:
> > > I suppose the same applies to dtc (1.4.2 required by qemu, but xenial
> > > has 1.4.0... so we have to wait until April 26, 2020? 18.04 LTS
> > > release date + 2y).
> >
> > Possibly - depends on scope of changes between 1.4.0 & 1.4.2 - maybe it
> > is easy to conditionally support 1.4.0 too.
>
> We need fdt_first_subnode() and fdt_next_subnode() which only
> came in in 1.4.2.
Looks like those are just shims around fdt_next_node() which existed
in previous releases already, just to make code a little cleaner:
commit 4e76ec796c90d44d417f82d9db2d67cfe575f8ed
Author: Simon Glass <sjg@chromium.org>
Date: Fri Apr 26 05:43:31 2013 -0700
libfdt: Add fdt_next_subnode() to permit easy subnode iteration
Iterating through subnodes with libfdt is a little painful to write as we
need something like this:
for (depth = 0, count = 0,
offset = fdt_next_node(fdt, parent_offset, &depth);
(offset >= 0) && (depth > 0);
offset = fdt_next_node(fdt, offset, &depth)) {
if (depth == 1) {
/* code body */
}
}
Using fdt_next_subnode() we can instead write this, which is shorter and
easier to get right:
for (offset = fdt_first_subnode(fdt, parent_offset);
offset >= 0;
offset = fdt_next_subnode(fdt, offset)) {
/* code body */
}
Also, it doesn't require two levels of indentation for the loop body.
so I think we could indeed do conditional compilation where we provide a
local impl of fdt_first|next_subnode if we see older dtc present.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2019-10-15 10:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-05 10:11 RFC: Why dont we move to newer capstone? Lucien Murray-Pitts
2019-10-05 10:20 ` Lucien Murray-Pitts
2019-10-05 13:33 ` Peter Maydell
2019-10-15 8:27 ` Daniel P. Berrangé
2019-10-15 8:36 ` Thomas Huth
2019-10-15 8:47 ` Daniel P. Berrangé
2019-10-15 9:02 ` Marc-André Lureau
2019-10-15 9:14 ` Daniel P. Berrangé
2019-10-15 9:57 ` Peter Maydell
2019-10-15 10:12 ` Daniel P. Berrangé [this message]
2019-10-14 23:46 ` Richard Henderson
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=20191015101223.GF22859@redhat.com \
--to=berrange@redhat.com \
--cc=lucienmp.qemu@gmail.com \
--cc=marcandre.lureau@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.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 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.