qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFC: Why dont we move to newer capstone?


From: Daniel P . Berrangé
Subject: Re: RFC: Why dont we move to newer capstone?
Date: Tue, 15 Oct 2019 11:12:23 +0100
User-agent: Mutt/1.12.1 (2019-06-15)

On Tue, Oct 15, 2019 at 10:57:44AM +0100, Peter Maydell wrote:
> On Tue, 15 Oct 2019 at 10:14, Daniel P. Berrangé <address@hidden> 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 <address@hidden>
  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 :|



reply via email to

[Prev in Thread] Current Thread [Next in Thread]