-
- * What you need to do is, since we don't keep the counter as part of
- * id / ptr pair, to keep a copy of it in the pointed to structure
- * (or else where) so that when you ask for a ptr you can varify that
- * the returned ptr is correct by comparing the id it contains with the one
- * you asked for. In other words, we only did half the reuse protection.
- * Since the code depends on your code doing this check, we ignore high
- * order bits in the id, not just the count, but bits that would, if used,
- * index outside of the allocated ids. In other words, if the largest id
- * currently allocated is 32 a look up will only look at the low 5 bits of
- * the id. Since you will want to keep this id in the structure anyway
- * (if for no other reason than to be able to eliminate the id when the
- * structure is found in some other way) this seems reasonable. If you
- * really think otherwise, the code to check these bits here, it is just
- * disabled with a #if 0.
-
-
- * So here are the complete details:
-
- * include <linux/idr.h>
-
- * void idr_init(struct idr *idp)
-
- * This function is use to set up the handle (idp) that you will pass
- * to the rest of the functions. The structure is defined in the
- * header.
-
- * int idr_pre_get(struct idr *idp, unsigned gfp_mask)
-
- * This function should be called prior to locking and calling the
- * following function. It pre allocates enough memory to satisfy the
- * worst possible allocation. Unless gfp_mask is GFP_ATOMIC, it can
- * sleep, so must not be called with any spinlocks held. If the system is
- * REALLY out of memory this function returns 0, other wise 1.
-
- * int idr_get_new(struct idr *idp, void *ptr, int *id);
-
- * This is the allocate id function. It should be called with any
- * required locks. In fact, in the SMP case, you MUST lock prior to
- * calling this function to avoid possible out of memory problems.
- * If memory is required, it will return -EAGAIN, you should unlock
- * and go back to the idr_pre_get() call. If the idr is full, it
- * will return a -ENOSPC. ptr is the pointer you want associated
- * with the id. The value is returned in the "id" field. idr_get_new()
- * returns a value in the range 0 ... 0x7fffffff
-
- * int idr_get_new_above(struct idr *idp, void *ptr, int start_id, int *id);
-
- * Like idr_get_new(), but the returned id is guaranteed to be at or
- * above start_id.
-
- * void *idr_find(struct idr *idp, int id);
-
- * returns the "ptr", given the id. A NULL return indicates that the
- * id is not valid (or you passed NULL in the idr_get_new(), shame on
- * you). This function must be called with a spinlock that prevents
- * calling either idr_get_new() or idr_remove() or idr_find() while it
- * is working.
-
- * void idr_remove(struct idr *idp, int id);
-
- * removes the given id, freeing that slot and any memory that may
- * now be unused. See idr_find() for locking restrictions.
-
- * int idr_full(struct idr *idp);
-
- * Returns true if the idr is full and false if not.
-