• Luis R. Rodriguez's avatar
    crda: add a reglib iterator reglib_for_each_country() · ebcbfcf4
    Luis R. Rodriguez authored
    To allow for a simple library on reglib.c we want to enable
    an iterator over the regulatory database that does not have
    to lock the file, or pass references to the file. We instead
    add an iterator reglib_get_country_idx() which will use a
    new reglib_get_country_idx(), that does an O(n) search for
    each new regulatory domain it needs to read.
    The trade off here is to allow for a simple reglib.c implementation
    at the cost that upon each iteration reglib_get_country_idx()
    we will will be opening the regdb, and verifying the db signature.
    Given that the only user of this iterator is regdbdump though and
    that this is used for debugging for now this is trade off I am
    willing to live with.
    Systems that want to use the regdb as a database for fine tuning
    radio parameters dynamically and reading this file very *often*
    (seconds, minutes, who knows what the future holds) may want to
    consider a slight optimization of exporting the direct mmap()
    through the library but we are I think light years away from that.
    Signed-off-by: 's avatarLuis R. Rodriguez <mcgrof@qca.qualcomm.com>
reglib.c 6.62 KB