1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>idr_alloc_cyclic</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="idr.html" title="idr/ida Functions"><link rel="prev" href="API-idr-alloc.html" title="idr_alloc"><link rel="next" href="API-idr-remove.html" title="idr_remove"></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"><span class="phrase">idr_alloc_cyclic</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-idr-alloc.html">Prev</a> </td><th width="60%" align="center">idr/ida Functions</th><td width="20%" align="right"> <a accesskey="n" href="API-idr-remove.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-idr-alloc-cyclic"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>idr_alloc_cyclic — 2 allocate new idr entry in a cyclical fashion 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">idr_alloc_cyclic </b>(</code></td><td>struct idr * <var class="pdparam">idr</var>, </td></tr><tr><td> </td><td>void * <var class="pdparam">ptr</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">start</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">end</var>, </td></tr><tr><td> </td><td>gfp_t <var class="pdparam">gfp_mask</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1123596412"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>idr</code></em></span></dt><dd><p> 4 the (initialized) idr 5 </p></dd><dt><span class="term"><em class="parameter"><code>ptr</code></em></span></dt><dd><p> 6 pointer to be associated with the new id 7 </p></dd><dt><span class="term"><em class="parameter"><code>start</code></em></span></dt><dd><p> 8 the minimum id (inclusive) 9 </p></dd><dt><span class="term"><em class="parameter"><code>end</code></em></span></dt><dd><p> 10 the maximum id (exclusive, <= 0 for max) 11 </p></dd><dt><span class="term"><em class="parameter"><code>gfp_mask</code></em></span></dt><dd><p> 12 memory allocation flags 13 </p></dd></dl></div></div><div class="refsect1"><a name="idp1123602140"></a><h2>Description</h2><p> 14 Essentially the same as idr_alloc, but prefers to allocate progressively 15 higher ids if it can. If the <span class="quote">“<span class="quote">cur</span>”</span> counter wraps, then it will start again 16 at the <span class="quote">“<span class="quote">start</span>”</span> end of the range and allocate one that has already been used. 17</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-idr-alloc.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="idr.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-idr-remove.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">idr_alloc</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">idr_remove</span></td></tr></table></div></body></html> 18