Lines Matching refs:v

38 #define	NV_NAME(v) \  argument
39 (((v)->v_flags & MDB_NV_EXTNAME) ? (v)->v_ename : (v)->v_lname)
41 #define NV_SIZE(v) \ argument
42 (((v)->v_flags & MDB_NV_EXTNAME) ? sizeof (mdb_var_t) : \
43 sizeof (mdb_var_t) + strlen((v)->v_lname))
72 mdb_var_t *v; in nv_var_alloc() local
79 v = mdb_alloc(nbytes, um_flags); in nv_var_alloc()
81 if (v == NULL) in nv_var_alloc()
85 v->v_ename = name; in nv_var_alloc()
86 v->v_lname[0] = '\0'; in nv_var_alloc()
92 (void) strcpy(v->v_lname, name); in nv_var_alloc()
93 v->v_ename = NULL; in nv_var_alloc()
96 v->v_uvalue = value; in nv_var_alloc()
97 v->v_flags = flags & ~(MDB_NV_SILENT | MDB_NV_INTERPOS); in nv_var_alloc()
98 v->v_disc = disc; in nv_var_alloc()
99 v->v_next = next; in nv_var_alloc()
101 return (v); in nv_var_alloc()
105 nv_var_free(mdb_var_t *v, uint_t um_flags) in nv_var_free() argument
110 if (v->v_flags & MDB_NV_OVERLOAD) { in nv_var_free()
113 for (w = v->v_ndef; w != NULL; w = nw) { in nv_var_free()
119 mdb_free(v, NV_SIZE(v)); in nv_var_free()
145 mdb_var_t *v, *w; in mdb_nv_destroy() local
152 for (v = nv->nv_hash[i]; v != NULL; v = w) { in mdb_nv_destroy()
153 w = v->v_next; in mdb_nv_destroy()
154 nv_var_free(v, nv->nv_um_flags); in mdb_nv_destroy()
165 mdb_var_t *v; in mdb_nv_lookup() local
167 for (v = nv->nv_hash[i]; v != NULL; v = v->v_next) { in mdb_nv_lookup()
168 if (strcmp(NV_NAME(v), name) == 0) in mdb_nv_lookup()
169 return (v); in mdb_nv_lookup()
180 nv_var_interpos(mdb_nv_t *nv, size_t i, mdb_var_t *v, mdb_var_t *w) in nv_var_interpos() argument
184 while (*pvp != v) { in nv_var_interpos()
191 w->v_next = v->v_next; in nv_var_interpos()
192 w->v_ndef = v; in nv_var_interpos()
193 v->v_next = NULL; in nv_var_interpos()
203 nv_var_overload(mdb_var_t *v, mdb_var_t *w) in nv_var_overload() argument
205 while (v->v_ndef != NULL) in nv_var_overload()
206 v = v->v_ndef; in nv_var_overload()
208 v->v_ndef = w; in nv_var_overload()
216 mdb_var_t *v, *w, **new_hash = in nv_resize() local
237 for (v = nv->nv_hash[i]; v != NULL; v = w) { in nv_resize()
238 w = v->v_next; in nv_resize()
240 bucket = nv_hashstring(NV_NAME(v)) % new_hashsz; in nv_resize()
241 v->v_next = new_hash[bucket]; in nv_resize()
242 new_hash[bucket] = v; in nv_resize()
263 mdb_var_t *v; in mdb_nv_insert() local
280 for (v = nv->nv_hash[i]; v != NULL; v = v->v_next) { in mdb_nv_insert()
281 if (strcmp(NV_NAME(v), name) == 0) { in mdb_nv_insert()
282 if (v->v_flags & MDB_NV_OVERLOAD) { in mdb_nv_insert()
283 mdb_var_t *w = nv_var_alloc(NV_NAME(v), disc, in mdb_nv_insert()
292 v = nv_var_interpos(nv, i, v, w); in mdb_nv_insert()
294 v = nv_var_overload(v, w); in mdb_nv_insert()
296 } else if (v->v_flags & MDB_NV_RDONLY) { in mdb_nv_insert()
299 "variable '%s'\n", NV_NAME(v)); in mdb_nv_insert()
302 v->v_uvalue = value; in mdb_nv_insert()
304 ASSERT(v != NULL); in mdb_nv_insert()
305 return (v); in mdb_nv_insert()
313 v = nv_var_alloc(name, disc, value, flags, nv->nv_um_flags, in mdb_nv_insert()
316 if (v == NULL) { in mdb_nv_insert()
321 nv->nv_hash[i] = v; in mdb_nv_insert()
324 return (v); in mdb_nv_insert()
328 nv_var_defn_remove(mdb_var_t *v, mdb_var_t *corpse, uint_t um_flags) in nv_var_defn_remove() argument
330 mdb_var_t *w = v; in nv_var_defn_remove()
332 while (v->v_ndef != NULL && v->v_ndef != corpse) in nv_var_defn_remove()
333 v = v->v_ndef; in nv_var_defn_remove()
335 if (v == NULL) { in nv_var_defn_remove()
340 v->v_ndef = corpse->v_ndef; in nv_var_defn_remove()
350 mdb_var_t *v = nv->nv_hash[i]; in mdb_nv_remove() local
358 if (v != corpse) { in mdb_nv_remove()
360 if (strcmp(NV_NAME(v), cname) == 0) { in mdb_nv_remove()
362 nv_var_defn_remove(v, corpse, in mdb_nv_remove()
369 if (v->v_next == corpse) in mdb_nv_remove()
372 } while ((v = v->v_next) != NULL); in mdb_nv_remove()
374 if (v == NULL) in mdb_nv_remove()
377 pvp = &v->v_next; in mdb_nv_remove()
415 mdb_var_t *v = nv->nv_iter_elt; in mdb_nv_advance() local
418 if (v == NULL) in mdb_nv_advance()
421 if (v->v_next != NULL) { in mdb_nv_advance()
422 nv->nv_iter_elt = v->v_next; in mdb_nv_advance()
423 return (v); in mdb_nv_advance()
434 return (v); in mdb_nv_advance()
463 mdb_var_t *v, **vpp = vps; in mdb_nv_sort_iter() local
466 for (mdb_nv_rewind(nv); (v = mdb_nv_advance(nv)) != NULL; ) in mdb_nv_sort_iter()
467 *vpp++ = v; in mdb_nv_sort_iter()
483 mdb_nv_defn_iter(mdb_var_t *v, int (*func)(mdb_var_t *, void *), void *private) in mdb_nv_defn_iter() argument
485 if (func(v, private) == -1 || !(v->v_flags & MDB_NV_OVERLOAD)) in mdb_nv_defn_iter()
488 for (v = v->v_ndef; v != NULL; v = v->v_ndef) { in mdb_nv_defn_iter()
489 if (func(v, private) == -1) in mdb_nv_defn_iter()
495 mdb_nv_get_value(const mdb_var_t *v) in mdb_nv_get_value() argument
497 if (v->v_disc) in mdb_nv_get_value()
498 return (v->v_disc->disc_get(v)); in mdb_nv_get_value()
500 return (v->v_uvalue); in mdb_nv_get_value()
504 mdb_nv_set_value(mdb_var_t *v, uintmax_t l) in mdb_nv_set_value() argument
506 if (v->v_flags & MDB_NV_RDONLY) { in mdb_nv_set_value()
507 warn("cannot modify read-only variable '%s'\n", NV_NAME(v)); in mdb_nv_set_value()
511 if (v->v_disc) in mdb_nv_set_value()
512 v->v_disc->disc_set(v, l); in mdb_nv_set_value()
514 v->v_uvalue = l; in mdb_nv_set_value()
518 mdb_nv_get_cookie(const mdb_var_t *v) in mdb_nv_get_cookie() argument
520 if (v->v_disc) in mdb_nv_get_cookie()
521 return ((void *)(uintptr_t)v->v_disc->disc_get(v)); in mdb_nv_get_cookie()
523 return (MDB_NV_COOKIE(v)); in mdb_nv_get_cookie()
527 mdb_nv_set_cookie(mdb_var_t *v, void *cookie) in mdb_nv_set_cookie() argument
529 mdb_nv_set_value(v, (uintmax_t)(uintptr_t)cookie); in mdb_nv_set_cookie()
533 mdb_nv_get_name(const mdb_var_t *v) in mdb_nv_get_name() argument
535 return (NV_NAME(v)); in mdb_nv_get_name()
539 mdb_nv_get_ndef(const mdb_var_t *v) in mdb_nv_get_ndef() argument
541 if (v->v_flags & MDB_NV_OVERLOAD) in mdb_nv_get_ndef()
542 return (v->v_ndef); in mdb_nv_get_ndef()