summaryrefslogtreecommitdiffstats
path: root/lib/idr.c
diff options
context:
space:
mode:
authorMatthew Wilcox <mawilcox@microsoft.com>2017-11-28 15:39:51 -0500
committerMatthew Wilcox <mawilcox@microsoft.com>2018-02-06 16:41:28 -0500
commit7a4575778f4db109b8b78e6dba03271096793f88 (patch)
treeee9906456c359338a5e159066d383697830ae17a /lib/idr.c
parent460488c58ca8b9167463ac22ec9a2e33db351962 (diff)
idr: Rename idr_for_each_entry_ext
Most places in the kernel that we need to distinguish functions by the type of their arguments, we use '_ul' as a suffix for the unsigned long variant, not '_ext'. Also add kernel-doc. Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Diffstat (limited to 'lib/idr.c')
-rw-r--r--lib/idr.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/lib/idr.c b/lib/idr.c
index c3f16307b908..3df44d528b68 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -136,13 +136,13 @@ int idr_alloc_cyclic(struct idr *idr, void *ptr, int start, int end, gfp_t gfp)
136EXPORT_SYMBOL(idr_alloc_cyclic); 136EXPORT_SYMBOL(idr_alloc_cyclic);
137 137
138/** 138/**
139 * idr_for_each - iterate through all stored pointers 139 * idr_for_each() - Iterate through all stored pointers.
140 * @idr: idr handle 140 * @idr: IDR handle.
141 * @fn: function to be called for each pointer 141 * @fn: Function to be called for each pointer.
142 * @data: data passed to callback function 142 * @data: Data passed to callback function.
143 * 143 *
144 * The callback function will be called for each entry in @idr, passing 144 * The callback function will be called for each entry in @idr, passing
145 * the id, the pointer and the data pointer passed to this function. 145 * the ID, the entry and @data.
146 * 146 *
147 * If @fn returns anything other than %0, the iteration stops and that 147 * If @fn returns anything other than %0, the iteration stops and that
148 * value is returned from this function. 148 * value is returned from this function.
@@ -169,9 +169,9 @@ int idr_for_each(const struct idr *idr,
169EXPORT_SYMBOL(idr_for_each); 169EXPORT_SYMBOL(idr_for_each);
170 170
171/** 171/**
172 * idr_get_next - Find next populated entry 172 * idr_get_next() - Find next populated entry.
173 * @idr: idr handle 173 * @idr: IDR handle.
174 * @nextid: Pointer to lowest possible ID to return 174 * @nextid: Pointer to an ID.
175 * 175 *
176 * Returns the next populated entry in the tree with an ID greater than 176 * Returns the next populated entry in the tree with an ID greater than
177 * or equal to the value pointed to by @nextid. On exit, @nextid is updated 177 * or equal to the value pointed to by @nextid. On exit, @nextid is updated
@@ -192,7 +192,17 @@ void *idr_get_next(struct idr *idr, int *nextid)
192} 192}
193EXPORT_SYMBOL(idr_get_next); 193EXPORT_SYMBOL(idr_get_next);
194 194
195void *idr_get_next_ext(struct idr *idr, unsigned long *nextid) 195/**
196 * idr_get_next_ul() - Find next populated entry.
197 * @idr: IDR handle.
198 * @nextid: Pointer to an ID.
199 *
200 * Returns the next populated entry in the tree with an ID greater than
201 * or equal to the value pointed to by @nextid. On exit, @nextid is updated
202 * to the ID of the found value. To use in a loop, the value pointed to by
203 * nextid must be incremented by the user.
204 */
205void *idr_get_next_ul(struct idr *idr, unsigned long *nextid)
196{ 206{
197 struct radix_tree_iter iter; 207 struct radix_tree_iter iter;
198 void __rcu **slot; 208 void __rcu **slot;
@@ -204,7 +214,7 @@ void *idr_get_next_ext(struct idr *idr, unsigned long *nextid)
204 *nextid = iter.index; 214 *nextid = iter.index;
205 return rcu_dereference_raw(*slot); 215 return rcu_dereference_raw(*slot);
206} 216}
207EXPORT_SYMBOL(idr_get_next_ext); 217EXPORT_SYMBOL(idr_get_next_ul);
208 218
209/** 219/**
210 * idr_replace() - replace pointer for given ID. 220 * idr_replace() - replace pointer for given ID.