[Bug 206516] [patch] Teach ofw_bus_parse_xref_list_alloc to be able to return the length of the parsed list

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Jan 23 06:28:25 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206516

            Bug ID: 206516
           Summary: [patch] Teach ofw_bus_parse_xref_list_alloc to be able
                    to return the length of the parsed list
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Keywords: patch
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: sgalabov at gmail.com
          Keywords: patch

Created attachment 165990
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=165990&action=edit
Teach ofw_bus_parse_xref_list_alloc to be able to return the length of the
parsed list

Currently, there is no easy way to know in advance how many entries a list
parsed by ofw_bus_parse_xref_list_alloc() in sys/dev/ofw/ofw_bus_subr.c has.

The attached patch allows us to pass an idx of -1 to
ofw_bus_parse_xref_list_alloc(), in which case it would either return an error
(negative) or the number of entries in the parsed list (non-negative).

This would be useful if we don't know in advance how many entries such a list
has, but we need to get them (and store them) all - we can call
ofw_bus_parse_xref_list_alloc with idx = -1, see how many entries to allocate
memory for, and then loop through the entries to get each one of them.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list