Lines Matching defs:usp

38 fmd_ustat_chunk_init(fmd_ustat_t *usp, fmd_stat_t *base, uint_t len)
47 ASSERT(RW_WRITE_HELD(&usp->us_lock));
48 fmd_list_append(&usp->us_chunks, cp);
54 fmd_ustat_chunk_hold(fmd_ustat_t *usp, fmd_ustat_chunk_t *cp)
56 ASSERT(RW_WRITE_HELD(&usp->us_lock));
62 fmd_ustat_chunk_rele(fmd_ustat_t *usp, fmd_ustat_chunk_t *cp)
64 ASSERT(RW_WRITE_HELD(&usp->us_lock));
74 fmd_list_delete(&usp->us_chunks, cp);
82 fmd_ustat_t *usp = fmd_zalloc(sizeof (fmd_ustat_t), FMD_SLEEP);
84 (void) pthread_rwlock_init(&usp->us_lock, NULL);
85 usp->us_hashlen = fmd.d_str_buckets;
86 usp->us_hash = fmd_zalloc(sizeof (void *) * usp->us_hashlen, FMD_SLEEP);
88 return (usp);
92 fmd_ustat_destroy(fmd_ustat_t *usp)
97 (void) pthread_rwlock_wrlock(&usp->us_lock);
99 for (i = 0; i < usp->us_hashlen; i++) {
100 for (ep = usp->us_hash[i]; ep != NULL; ep = np) {
105 fmd_ustat_chunk_rele(usp, ep->use_chunk);
112 ASSERT(usp->us_chunks.l_next == NULL);
113 ASSERT(usp->us_chunks.l_prev == NULL);
115 fmd_free(usp->us_hash, sizeof (void *) * usp->us_hashlen);
116 fmd_free(usp, sizeof (fmd_ustat_t));
120 fmd_ustat_snapshot(fmd_ustat_t *usp, fmd_ustat_snap_t *uss)
126 (void) pthread_rwlock_wrlock(&usp->us_lock);
128 uss->uss_buf = sp = malloc(sizeof (fmd_stat_t) * usp->us_nelems);
129 uss->uss_len = usp->us_nelems;
132 (void) pthread_rwlock_unlock(&usp->us_lock);
136 for (i = 0; i < usp->us_hashlen; i++) {
137 for (ep = usp->us_hash[i]; ep != NULL; ep = ep->use_next) {
147 (void) pthread_rwlock_unlock(&usp->us_lock);
152 fmd_ustat_delete_locked(fmd_ustat_t *usp, uint_t n, fmd_stat_t *sp, int strfree)
154 ASSERT(RW_WRITE_HELD(&usp->us_lock));
157 uint_t h = fmd_strhash(sp->fmds_name) % usp->us_hashlen;
158 fmd_ustat_elem_t *ep, **pp = &usp->us_hash[h];
174 fmd_ustat_chunk_rele(usp, ep->use_chunk);
178 usp->us_nelems--;
183 fmd_ustat_insert(fmd_ustat_t *usp, uint_t flags,
200 (void) pthread_rwlock_wrlock(&usp->us_lock);
203 cp = fmd_ustat_chunk_init(usp, stats, n);
242 h = fmd_strhash(sp->fmds_name) % usp->us_hashlen;
244 for (ep = usp->us_hash[h]; ep != NULL; ep = ep->use_next) {
258 ep->use_next = usp->us_hash[h];
259 usp->us_hash[h] = ep;
264 fmd_ustat_chunk_hold(usp, cp);
266 usp->us_nelems++;
277 fmd_ustat_delete_locked(usp, i, stats, FMD_B_FALSE);
298 fmd_ustat_chunk_rele(usp, cp);
300 (void) pthread_rwlock_unlock(&usp->us_lock);
305 fmd_ustat_delete(fmd_ustat_t *usp, uint_t n, fmd_stat_t *sp)
307 (void) pthread_rwlock_wrlock(&usp->us_lock);
308 fmd_ustat_delete_locked(usp, n, sp, FMD_B_TRUE);
309 (void) pthread_rwlock_unlock(&usp->us_lock);
317 fmd_ustat_delete_references(fmd_ustat_t *usp)
322 (void) pthread_rwlock_wrlock(&usp->us_lock);
324 for (i = 0; i < usp->us_hashlen; i++) {
325 for (pp = &usp->us_hash[i], ep = *pp; ep != NULL; ep = *pp) {
336 usp->us_nelems--;
340 (void) pthread_rwlock_unlock(&usp->us_lock);