1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>idr/ida Functions</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The Linux Kernel API"><link rel="up" href="kernel-lib.html" title="Chapter&#160;3.&#160;Basic Kernel Library Functions"><link rel="prev" href="API-crc-ccitt.html" title="crc_ccitt"><link rel="next" href="API-idr-preload.html" title="idr_preload"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">idr/ida Functions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-crc-ccitt.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;3.&#160;Basic Kernel Library Functions</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-idr-preload.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idr"></a>idr/ida Functions</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="refentrytitle"><a href="API-idr-preload.html"><span class="phrase">idr_preload</span></a></span><span class="refpurpose"> &#8212; 
2  preload for <code class="function">idr_alloc</code>
3 </span></dt><dt><span class="refentrytitle"><a href="API-idr-alloc.html"><span class="phrase">idr_alloc</span></a></span><span class="refpurpose"> &#8212; 
4     allocate new idr entry
5 </span></dt><dt><span class="refentrytitle"><a href="API-idr-alloc-cyclic.html"><span class="phrase">idr_alloc_cyclic</span></a></span><span class="refpurpose"> &#8212; 
6     allocate new idr entry in a cyclical fashion
7 </span></dt><dt><span class="refentrytitle"><a href="API-idr-remove.html"><span class="phrase">idr_remove</span></a></span><span class="refpurpose"> &#8212; 
8     remove the given id and free its slot
9 </span></dt><dt><span class="refentrytitle"><a href="API-idr-destroy.html"><span class="phrase">idr_destroy</span></a></span><span class="refpurpose"> &#8212; 
10     release all cached layers within an idr tree
11 </span></dt><dt><span class="refentrytitle"><a href="API-idr-for-each.html"><span class="phrase">idr_for_each</span></a></span><span class="refpurpose"> &#8212; 
12     iterate through all stored pointers
13 </span></dt><dt><span class="refentrytitle"><a href="API-idr-get-next.html"><span class="phrase">idr_get_next</span></a></span><span class="refpurpose"> &#8212; 
14     lookup next object of id to given id.
15 </span></dt><dt><span class="refentrytitle"><a href="API-idr-replace.html"><span class="phrase">idr_replace</span></a></span><span class="refpurpose"> &#8212; 
16     replace pointer for given id
17 </span></dt><dt><span class="refentrytitle"><a href="API-idr-init.html"><span class="phrase">idr_init</span></a></span><span class="refpurpose"> &#8212; 
18     initialize idr handle
19 </span></dt><dt><span class="refentrytitle"><a href="API-ida-pre-get.html"><span class="phrase">ida_pre_get</span></a></span><span class="refpurpose"> &#8212; 
20     reserve resources for ida allocation
21 </span></dt><dt><span class="refentrytitle"><a href="API-ida-get-new-above.html"><span class="phrase">ida_get_new_above</span></a></span><span class="refpurpose"> &#8212; 
22     allocate new ID above or equal to a start id
23 </span></dt><dt><span class="refentrytitle"><a href="API-ida-remove.html"><span class="phrase">ida_remove</span></a></span><span class="refpurpose"> &#8212; 
24     remove the given ID
25 </span></dt><dt><span class="refentrytitle"><a href="API-ida-destroy.html"><span class="phrase">ida_destroy</span></a></span><span class="refpurpose"> &#8212; 
26     release all cached layers within an ida tree
27 </span></dt><dt><span class="refentrytitle"><a href="API-ida-simple-get.html"><span class="phrase">ida_simple_get</span></a></span><span class="refpurpose"> &#8212; 
28     get a new id.
29 </span></dt><dt><span class="refentrytitle"><a href="API-ida-simple-remove.html"><span class="phrase">ida_simple_remove</span></a></span><span class="refpurpose"> &#8212; 
30     remove an allocated id.
31 </span></dt><dt><span class="refentrytitle"><a href="API-ida-init.html"><span class="phrase">ida_init</span></a></span><span class="refpurpose"> &#8212; 
32     initialize ida handle
33 </span></dt></dl></div><p>
34   idr synchronization (stolen from radix-tree.h)
35   </p><p>
36   <code class="function">idr_find</code> is able to be called locklessly, using RCU. The caller must
37   ensure calls to this function are made within <code class="function">rcu_read_lock</code> regions.
38   Other readers (lock-free or otherwise) and modifications may be running
39   concurrently.
40   </p><p>
41   It is still required that the caller manage the synchronization and
42   lifetimes of the items. So if RCU lock-free lookups are used, typically
43   this would mean that the items have their own locks, or are amenable to
44   lock-free access; and that the items are freed by RCU (or only freed after
45   having been deleted from the idr tree *and* a <code class="function">synchronize_rcu</code> grace
46   period).
47</p><p>
48   IDA - IDR based ID allocator
49   </p><p>
50   This is id allocator without id -&gt; pointer translation.  Memory
51   usage is much lower than full blown idr because each id only
52   occupies a bit.  ida uses a custom leaf node which contains
53   IDA_BITMAP_BITS slots.
54   </p><p>
55   2007-04-25  written by Tejun Heo &lt;htejun<em class="parameter"><code>gmail</code></em>.com&gt;
56</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-crc-ccitt.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="kernel-lib.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-idr-preload.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">crc_ccitt</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">idr_preload</span></td></tr></table></div></body></html>
57