Lines Matching full:slot
76 static void do_osd_del(u_int type, struct osd *osd, u_int slot,
102 * destructor, because NULL destructor means unused slot. in osd_register()
109 * First, we try to find unused slot. in osd_register()
113 OSD_DEBUG("Unused slot found (type=%u, slot=%u).", in osd_register()
119 * If no unused slot was found, allocate one. in osd_register()
135 OSD_DEBUG("New slot allocated (type=%u, slot=%u).", in osd_register()
150 osd_deregister(u_int type, u_int slot) in osd_deregister() argument
155 KASSERT(slot > 0, ("Invalid slot.")); in osd_deregister()
159 KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot.")); in osd_deregister()
162 * Free all OSD for the given slot. in osd_deregister()
166 do_osd_del(type, osd, slot, 1); in osd_deregister()
170 * Set destructor to NULL to free the slot. We don't bother actually in osd_deregister()
177 osdm[type].osd_destructors[slot - 1] = NULL; in osd_deregister()
178 OSD_DEBUG("Slot deregistration (type=%u, slot=%u).", type, slot); in osd_deregister()
185 osd_set(u_int type, struct osd *osd, u_int slot, void *value) in osd_set() argument
188 return (osd_set_reserved(type, osd, slot, NULL, value)); in osd_set()
192 osd_reserve(u_int slot) in osd_reserve() argument
195 KASSERT(slot > 0, ("Invalid slot.")); in osd_reserve()
197 OSD_DEBUG("Reserving slot array (slot=%u).", slot); in osd_reserve()
198 return (malloc(sizeof(void *) * slot, M_OSD, M_WAITOK | M_ZERO)); in osd_reserve()
202 osd_set_reserved(u_int type, struct osd *osd, u_int slot, void **rsv, in osd_set_reserved() argument
208 KASSERT(slot > 0, ("Invalid slot.")); in osd_set_reserved()
211 KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot.")); in osd_set_reserved()
213 if (slot > osd->osd_nslots) { in osd_set_reserved()
218 "Not allocating null slot (type=%u, slot=%u).", in osd_set_reserved()
219 type, slot); in osd_set_reserved()
242 newptr = realloc(osd->osd_slots, sizeof(void *) * slot, in osd_set_reserved()
258 OSD_DEBUG("Setting first slot (type=%u).", type); in osd_set_reserved()
262 osd->osd_nslots = slot; in osd_set_reserved()
265 OSD_DEBUG("Setting slot value (type=%u, slot=%u, value=%p).", type, in osd_set_reserved()
266 slot, value); in osd_set_reserved()
267 osd->osd_slots[slot - 1] = value; in osd_set_reserved()
276 OSD_DEBUG("Discarding reserved slot array."); in osd_free_reserved()
281 osd_get_unlocked(u_int type, struct osd *osd, u_int slot) in osd_get_unlocked() argument
285 KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot.")); in osd_get_unlocked()
287 if (slot > osd->osd_nslots) { in osd_get_unlocked()
289 OSD_DEBUG("Slot doesn't exist (type=%u, slot=%u).", type, slot); in osd_get_unlocked()
291 value = atomic_load_ptr(&osd->osd_slots[slot - 1]); in osd_get_unlocked()
292 OSD_DEBUG("Returning slot value (type=%u, slot=%u, value=%p).", in osd_get_unlocked()
293 type, slot, value); in osd_get_unlocked()
299 osd_get(u_int type, struct osd *osd, u_int slot) in osd_get() argument
305 KASSERT(slot > 0, ("Invalid slot.")); in osd_get()
308 value = osd_get_unlocked(type, osd, slot); in osd_get()
314 osd_del(u_int type, struct osd *osd, u_int slot) in osd_del() argument
319 do_osd_del(type, osd, slot, 0); in osd_del()
324 do_osd_del(u_int type, struct osd *osd, u_int slot, int list_locked) in do_osd_del() argument
329 KASSERT(slot > 0, ("Invalid slot.")); in do_osd_del()
330 KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot.")); in do_osd_del()
332 OSD_DEBUG("Deleting slot (type=%u, slot=%u).", type, slot); in do_osd_del()
334 if (slot > osd->osd_nslots) { in do_osd_del()
335 OSD_DEBUG("Slot doesn't exist (type=%u, slot=%u).", type, slot); in do_osd_del()
338 if (osd->osd_slots[slot - 1] != NULL) { in do_osd_del()
339 osdm[type].osd_destructors[slot - 1](osd->osd_slots[slot - 1]); in do_osd_del()
340 osd->osd_slots[slot - 1] = NULL; in do_osd_del()
344 OSD_DEBUG("Slot still has a value (type=%u, slot=%u).", in do_osd_del()
360 } else if (slot == osd->osd_nslots) { in do_osd_del()
361 /* This was the last slot. */ in do_osd_del()
385 * Call this method for every slot that defines it, stopping if an in osd_call()
391 /* Hole in the slot map; avoid dereferencing. */ in osd_call()
422 OSD_DEBUG("Unused slot (type=%u, slot=%u).", type, i); in osd_exit()