<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><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.76.1" /><link rel="home" href="index.html" title="The Linux Kernel API" /><link rel="up" href="kernel-lib.html" title="Chapter 3. Basic Kernel Library Functions" /><link rel="prev" href="API-crc-ccitt.html" title="crc_ccitt" /><link rel="next" href="API-idr-pre-get.html" title="idr_pre_get" /></head><body><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> </td><th width="60%" align="center">Chapter 3. Basic Kernel Library Functions</th><td width="20%" align="right"> <a accesskey="n" href="API-idr-pre-get.html">Next</a></td></tr></table><hr /></div><div class="sect1" title="idr/ida Functions"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="idr"></a>idr/ida Functions</h2></div></div></div><div class="toc"><dl><dt><span class="refentrytitle"><a href="API-idr-pre-get.html"><span>idr_pre_get</span></a></span><span class="refpurpose"> — reserve resources for idr allocation </span></dt><dt><span class="refentrytitle"><a href="API-idr-get-new-above.html"><span>idr_get_new_above</span></a></span><span class="refpurpose"> — allocate new idr entry above or equal to a start id </span></dt><dt><span class="refentrytitle"><a href="API-idr-get-new.html"><span>idr_get_new</span></a></span><span class="refpurpose"> — allocate new idr entry </span></dt><dt><span class="refentrytitle"><a href="API-idr-remove.html"><span>idr_remove</span></a></span><span class="refpurpose"> — remove the given id and free its slot </span></dt><dt><span class="refentrytitle"><a href="API-idr-remove-all.html"><span>idr_remove_all</span></a></span><span class="refpurpose"> — remove all ids from the given idr tree </span></dt><dt><span class="refentrytitle"><a href="API-idr-destroy.html"><span>idr_destroy</span></a></span><span class="refpurpose"> — release all cached layers within an idr tree </span></dt><dt><span class="refentrytitle"><a href="API-idr-find.html"><span>idr_find</span></a></span><span class="refpurpose"> — return pointer for given id </span></dt><dt><span class="refentrytitle"><a href="API-idr-for-each.html"><span>idr_for_each</span></a></span><span class="refpurpose"> — iterate through all stored pointers </span></dt><dt><span class="refentrytitle"><a href="API-idr-get-next.html"><span>idr_get_next</span></a></span><span class="refpurpose"> — lookup next object of id to given id. </span></dt><dt><span class="refentrytitle"><a href="API-idr-replace.html"><span>idr_replace</span></a></span><span class="refpurpose"> — replace pointer for given id </span></dt><dt><span class="refentrytitle"><a href="API-idr-init.html"><span>idr_init</span></a></span><span class="refpurpose"> — initialize idr handle </span></dt><dt><span class="refentrytitle"><a href="API-ida-pre-get.html"><span>ida_pre_get</span></a></span><span class="refpurpose"> — reserve resources for ida allocation </span></dt><dt><span class="refentrytitle"><a href="API-ida-get-new-above.html"><span>ida_get_new_above</span></a></span><span class="refpurpose"> — allocate new ID above or equal to a start id </span></dt><dt><span class="refentrytitle"><a href="API-ida-get-new.html"><span>ida_get_new</span></a></span><span class="refpurpose"> — allocate new ID </span></dt><dt><span class="refentrytitle"><a href="API-ida-remove.html"><span>ida_remove</span></a></span><span class="refpurpose"> — remove the given ID </span></dt><dt><span class="refentrytitle"><a href="API-ida-destroy.html"><span>ida_destroy</span></a></span><span class="refpurpose"> — release all cached layers within an ida tree </span></dt><dt><span class="refentrytitle"><a href="API-ida-init.html"><span>ida_init</span></a></span><span class="refpurpose"> — initialize ida handle </span></dt></dl></div><p> idr synchronization (stolen from radix-tree.h) </p><p> <code class="function">idr_find</code> is able to be called locklessly, using RCU. The caller must ensure calls to this function are made within <code class="function">rcu_read_lock</code> regions. Other readers (lock-free or otherwise) and modifications may be running concurrently. </p><p> It is still required that the caller manage the synchronization and lifetimes of the items. So if RCU lock-free lookups are used, typically this would mean that the items have their own locks, or are amenable to lock-free access; and that the items are freed by RCU (or only freed after having been deleted from the idr tree *and* a <code class="function">synchronize_rcu</code> grace period). </p><p> IDA - IDR based ID allocator </p><p> This is id allocator without id -> pointer translation. Memory usage is much lower than full blown idr because each id only occupies a bit. ida uses a custom leaf node which contains IDA_BITMAP_BITS slots. </p><p> 2007-04-25 written by Tejun Heo <htejun<em class="parameter"><code>gmail</code></em>.com> </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> </td><td width="20%" align="center"><a accesskey="u" href="kernel-lib.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-idr-pre-get.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span>crc_ccitt</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span>idr_pre_get</span></td></tr></table></div></body></html>