Lines Matching refs:slot

77 static void do_osd_del(u_int type, struct osd *osd, u_int slot,
103 * destructor, because NULL destructor means unused slot.
110 * First, we try to find unused slot.
114 OSD_DEBUG("Unused slot found (type=%u, slot=%u).",
120 * If no unused slot was found, allocate one.
136 OSD_DEBUG("New slot allocated (type=%u, slot=%u).",
151 osd_deregister(u_int type, u_int slot)
156 KASSERT(slot > 0, ("Invalid slot."));
157 KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot."));
162 * Free all OSD for the given slot.
166 do_osd_del(type, osd, slot, 1);
169 * Set destructor to NULL to free the slot.
171 osdm[type].osd_destructors[slot - 1] = NULL;
172 if (slot == osdm[type].osd_ntslots) {
188 OSD_DEBUG("Deregistration of the last slot (type=%u, slot=%u).",
189 type, slot);
191 OSD_DEBUG("Slot deregistration (type=%u, slot=%u).",
192 type, slot);
199 osd_set(u_int type, struct osd *osd, u_int slot, void *value)
202 return (osd_set_reserved(type, osd, slot, NULL, value));
206 osd_reserve(u_int slot)
209 KASSERT(slot > 0, ("Invalid slot."));
211 OSD_DEBUG("Reserving slot array (slot=%u).", slot);
212 return (malloc(sizeof(void *) * slot, M_OSD, M_WAITOK | M_ZERO));
216 osd_set_reserved(u_int type, struct osd *osd, u_int slot, void **rsv,
222 KASSERT(slot > 0, ("Invalid slot."));
223 KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot."));
226 if (slot > osd->osd_nslots) {
231 "Not allocating null slot (type=%u, slot=%u).",
232 type, slot);
255 newptr = realloc(osd->osd_slots, sizeof(void *) * slot,
271 OSD_DEBUG("Setting first slot (type=%u).", type);
275 osd->osd_nslots = slot;
278 OSD_DEBUG("Setting slot value (type=%u, slot=%u, value=%p).", type,
279 slot, value);
280 osd->osd_slots[slot - 1] = value;
289 OSD_DEBUG("Discarding reserved slot array.");
294 osd_get(u_int type, struct osd *osd, u_int slot)
300 KASSERT(slot > 0, ("Invalid slot."));
301 KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot."));
304 if (slot > osd->osd_nslots) {
306 OSD_DEBUG("Slot doesn't exist (type=%u, slot=%u).", type, slot);
308 value = osd->osd_slots[slot - 1];
309 OSD_DEBUG("Returning slot value (type=%u, slot=%u, value=%p).",
310 type, slot, value);
317 osd_del(u_int type, struct osd *osd, u_int slot)
322 do_osd_del(type, osd, slot, 0);
327 do_osd_del(u_int type, struct osd *osd, u_int slot, int list_locked)
332 KASSERT(slot > 0, ("Invalid slot."));
333 KASSERT(osdm[type].osd_destructors[slot - 1] != NULL, ("Unused slot."));
335 OSD_DEBUG("Deleting slot (type=%u, slot=%u).", type, slot);
337 if (slot > osd->osd_nslots) {
338 OSD_DEBUG("Slot doesn't exist (type=%u, slot=%u).", type, slot);
341 if (osd->osd_slots[slot - 1] != NULL) {
342 osdm[type].osd_destructors[slot - 1](osd->osd_slots[slot - 1]);
343 osd->osd_slots[slot - 1] = NULL;
347 OSD_DEBUG("Slot still has a value (type=%u, slot=%u).",
363 } else if (slot == osd->osd_nslots) {
364 /* This was the last slot. */
388 * Call this method for every slot that defines it, stopping if an
422 OSD_DEBUG("Unused slot (type=%u, slot=%u).", type, i);