'\" t .\" Title: idr_for_each .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: June 2017 .\" Manual: Basic Kernel Library Functions .\" Source: Kernel Hackers Manual 4.11.3 .\" Language: English .\" .TH "IDR_FOR_EACH" "9" "June 2017" "Kernel Hackers Manual 4\&.11\&" "Basic Kernel Library Functions" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" idr_for_each \- iterate through all stored pointers .SH "SYNOPSIS" .HP \w'int\ idr_for_each('u .BI "int idr_for_each(const\ struct\ idr\ *\ " "idr" ", int\ (*" "fn" ")\ (int\ id,\ void\ *p,\ void\ *data), void\ *\ " "data" ");" .SH "ARGUMENTS" .PP \fIconst struct idr * idr\fR .RS 4 idr handle .RE .PP \fIint (*)(int id, void *p, void *data) fn\fR .RS 4 function to be called for each pointer .RE .PP \fIvoid * data\fR .RS 4 data passed to callback function .RE .SH "DESCRIPTION" .PP The callback function will be called for each entry in \fIidr\fR, passing the id, the pointer and the data pointer passed to this function\&. .PP If \fIfn\fR returns anything other than \fB0\fR, the iteration stops and that value is returned from this function\&. .PP \fBidr_for_each\fR can be called concurrently with \fBidr_alloc\fR and \fBidr_remove\fR if protected by RCU\&. Newly added entries may not be seen and deleted entries may be seen, but adding and removing entries will not cause other entries to be skipped, nor spurious ones to be seen\&. .SH "COPYRIGHT" .br