• Matthew Wilcox's avatar
    ida: Add new API · 5ade60dd
    Matthew Wilcox authored
    Add ida_alloc(), ida_alloc_min(), ida_alloc_max(), ida_alloc_range()
    and ida_free().  The ida_alloc_max() and ida_alloc_range() functions
    differ from ida_simple_get() in that they take an inclusive 'max'
    parameter instead of an exclusive 'end' parameter.  Callers are about
    evenly split whether they'd like inclusive or exclusive parameters and
    'max' is easier to document than 'end'.
    
    Change the IDA allocation to first attempt to allocate a bit using
    existing memory, and only allocate memory afterwards.  Also change the
    behaviour of 'min' > INT_MAX from being a BUG() to returning -ENOSPC.
    
    Leave compatibility wrappers in place for ida_simple_get() and
    ida_simple_remove() to avoid changing all callers.
    Signed-off-by: default avatarMatthew Wilcox <willy@infradead.org>
    5ade60dd
idr.c 18.3 KB