• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/src/linux/linux-2.6/lib/

Lines Matching refs:id

9  * Small id to pointer translation service.
12 * by the id to obtain the pointer. The bitmap makes allocating
13 * a new id quick.
15 * You call it to allocate an id (an int) an associate with that id a
17 * id to a user for him to pass back at a later time. You then pass
18 * that id to this code and it returns your pointer.
22 * don't need to go to the memory "store" during an id allocate, just
103 int l, id;
106 id = *starting_id;
114 n = (id >> (IDR_BITS*l)) & IDR_MASK;
120 id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1;
122 *starting_id = id;
129 id = ((id >> sh) ^ n ^ m) << sh;
131 if ((id >= MAX_ID_BIT) || (id < 0))
149 * users pointer and return the raw id.
160 n = id;
167 return(id);
173 int layers, v, id;
176 id = starting_id;
187 * id is larger than the currently allocated space.
189 while ((layers < (MAX_LEVEL - 1)) && (id >= (1 << (layers*IDR_BITS)))) {
216 v = sub_alloc(idp, ptr, &id);
223 * idr_get_new_above - allocate new idr entry above or equal to a start id
226 * @start_id: id to start search at
227 * @id: pointer to the allocated handle
229 * This is the allocate id function. It should be called with any
236 * @id returns a value in the range 0 ... 0x7fffffff
238 int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id)
253 *id = rv;
262 * @id: pointer to the allocated handle
264 * This is the allocate id function. It should be called with any
271 * @id returns a value in the range 0 ... 0x7fffffff
273 int idr_get_new(struct idr *idp, void *ptr, int *id)
288 *id = rv;
293 static void idr_remove_warning(int id)
295 printk("idr_remove called for id=%d which is not allocated.\n", id);
299 static void sub_remove(struct idr *idp, int shift, int id)
310 n = (id >> shift) & IDR_MASK;
316 n = id & IDR_MASK;
327 idr_remove_warning(id);
331 * idr_remove - remove the given id and free it's slot
333 * @id: unique key
335 void idr_remove(struct idr *idp, int id)
340 id &= MAX_ID_MASK;
342 sub_remove(idp, (idp->layers - 1) * IDR_BITS, id);
374 * idr_find - return pointer for given id
376 * @id: lookup key
378 * Return the pointer given the id it has been registered with. A %NULL
379 * return indicates that @id is not valid or you passed %NULL in
384 void *idr_find(struct idr *idp, int id)
393 id &= MAX_ID_MASK;
395 if (id >= (1 << n))
400 p = p->ary[(id >> n) & IDR_MASK];
407 * idr_replace - replace pointer for given id
409 * @ptr: pointer you want associated with the id
410 * @id: lookup key
412 * Replace the pointer registered with an id and return the old value.
413 * A -ENOENT return indicates that @id was not found.
414 * A -EINVAL return indicates that @id was not within valid constraints.
418 void *idr_replace(struct idr *idp, void *ptr, int id)
426 id &= MAX_ID_MASK;
428 if (id >= (1 << n))
433 p = p->ary[(id >> n) & IDR_MASK];
437 n = id & IDR_MASK;