Lines Matching defs:ss
5960 i_ddi_soft_state *ss;
5965 ss = kmem_zalloc(sizeof (*ss), KM_SLEEP);
5966 mutex_init(&ss->lock, NULL, MUTEX_DRIVER, NULL);
5967 ss->size = size;
5970 ss->n_items = MIN_N_ITEMS;
5976 ss->n_items = 1 << bitlog;
5979 ASSERT(ss->n_items >= n_items);
5981 ss->array = kmem_zalloc(ss->n_items * sizeof (void *), KM_SLEEP);
5983 *state_p = ss;
5997 i_ddi_soft_state *ss = (i_ddi_soft_state *)state;
6004 mutex_enter(&ss->lock);
6005 if (ss->size == 0) {
6006 mutex_exit(&ss->lock);
6012 array = ss->array; /* NULL if ss->n_items == 0 */
6013 ASSERT(ss->n_items != 0 && array != NULL);
6018 if (item < ss->n_items && array[item] != NULL) {
6019 mutex_exit(&ss->lock);
6026 new_element = kmem_zalloc(ss->size, KM_SLEEP);
6031 if (item >= ss->n_items) {
6053 new_n_items = ss->n_items;
6064 bcopy(array, new_array, ss->n_items * sizeof (void *));
6070 dirty->array = ss->array;
6071 dirty->n_items = ss->n_items;
6072 dirty->next = ss->next;
6073 ss->next = dirty;
6075 ss->array = (array = new_array);
6076 ss->n_items = new_n_items;
6079 ASSERT(array != NULL && item < ss->n_items && array[item] == NULL);
6083 mutex_exit(&ss->lock);
6109 i_ddi_soft_state *ss = (i_ddi_soft_state *)state;
6111 ASSERT((ss != NULL) && (item >= 0));
6113 if (item < ss->n_items && ss->array != NULL)
6114 return (ss->array[item]);
6131 i_ddi_soft_state *ss = (i_ddi_soft_state *)state;
6136 if (ss == NULL) {
6144 mutex_enter(&ss->lock);
6146 if ((array = ss->array) == NULL || ss->size == 0) {
6149 } else if (item < 0 || item >= ss->n_items) {
6151 msg, item, ss->n_items - 1, mod_containing_pc(caller()));
6157 mutex_exit(&ss->lock);
6160 kmem_free(element, ss->size);
6167 * Note that we don't grab the ss->lock mutex, even though
6179 i_ddi_soft_state *ss, *dirty;
6184 (ss = (i_ddi_soft_state *)(*state_p)) == NULL) {
6190 if (ss->size == 0) {
6196 if (ss->n_items > 0) {
6197 for (item = 0; item < ss->n_items; item++)
6198 ddi_soft_state_free(ss, item);
6199 kmem_free(ss->array, ss->n_items * sizeof (void *));
6205 for (dirty = ss->next; dirty; dirty = ss->next) {
6206 ss->next = dirty->next;
6211 mutex_destroy(&ss->lock);
6212 kmem_free(ss, sizeof (*ss));
6334 i_ddi_strid *ss;
6347 ss = kmem_alloc(sizeof (*ss), KM_SLEEP);
6348 ss->strid_chunksz = n_items;
6349 ss->strid_spacesz = n_items;
6350 ss->strid_space = id_space_create("strid", 1, n_items);
6351 ss->strid_bystr = mod_hash_create_strhash("strid_bystr", hash_sz,
6353 ss->strid_byid = mod_hash_create_idhash("strid_byid", hash_sz,
6355 *strid_p = (ddi_strid *)ss;
6363 i_ddi_strid *ss = (i_ddi_strid *)strid;
6367 ASSERT(ss && str);
6368 if ((ss == NULL) || (str == NULL))
6381 if ((id = id_allocff_nosleep(ss->strid_space)) == (id_t)-1) {
6382 id_space_extend(ss->strid_space, ss->strid_spacesz,
6383 ss->strid_spacesz + ss->strid_chunksz);
6384 ss->strid_spacesz += ss->strid_chunksz;
6385 if ((id = id_allocff_nosleep(ss->strid_space)) == (id_t)-1)
6395 if (mod_hash_insert(ss->strid_bystr, (mod_hash_key_t)s,
6400 if (mod_hash_insert(ss->strid_byid, (mod_hash_key_t)(intptr_t)id,
6421 i_ddi_strid *ss = (i_ddi_strid *)strid;
6425 ASSERT(ss && str);
6426 if (ss && str && (mod_hash_find(ss->strid_bystr,
6436 i_ddi_strid *ss = (i_ddi_strid *)strid;
6440 ASSERT(ss && id > 0);
6441 if (ss && (id > 0) && (mod_hash_find(ss->strid_byid,
6451 i_ddi_strid *ss = (i_ddi_strid *)strid;
6454 ASSERT(ss && id > 0);
6455 if ((ss == NULL) || (id <= 0))
6460 (void) mod_hash_destroy(ss->strid_byid, (mod_hash_key_t)(uintptr_t)id);
6461 id_free(ss->strid_space, id);
6464 (void) mod_hash_destroy(ss->strid_bystr, (mod_hash_key_t)str);
6471 i_ddi_strid *ss;
6477 ss = (i_ddi_strid *)(*strid_p);
6478 if (ss == NULL)
6482 if (ss->strid_byid)
6483 mod_hash_destroy_hash(ss->strid_byid);
6484 if (ss->strid_byid)
6485 mod_hash_destroy_hash(ss->strid_bystr);
6486 if (ss->strid_space)
6487 id_space_destroy(ss->strid_space);
6488 kmem_free(ss, sizeof (*ss));