Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Jan 2016 06:28:24 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 206516] [patch] Teach ofw_bus_parse_xref_list_alloc to be able to return the length of the parsed list
Message-ID:  <bug-206516-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help

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@FreeBSD.org
          Reporter: sgalabov@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.


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-206516-8>