Lines Matching refs:nhp

133 	topo_nodehash_t *nhp;
151 nhp = node->tn_phash;
152 for (i = 0; i < nhp->th_arrlen; i++) {
153 if (node == nhp->th_nodearr[i]) {
154 nhp->th_nodearr[i] = NULL;
181 while ((nhp = topo_list_next(&node->tn_children)) != NULL) {
182 for (i = 0; i < nhp->th_arrlen; i++) {
183 assert(nhp->th_nodearr[i] == NULL);
185 hmod = nhp->th_enum;
186 topo_mod_strfree(hmod, nhp->th_name);
187 topo_mod_free(hmod, nhp->th_nodearr,
188 nhp->th_arrlen * sizeof (tnode_t *));
189 topo_list_delete(&node->tn_children, nhp);
190 topo_mod_free(hmod, nhp, sizeof (topo_nodehash_t));
282 topo_nodehash_t *nhp;
289 for (nhp = topo_list_next(&pnode->tn_children); nhp != NULL;
290 nhp = topo_list_next(nhp)) {
291 if (strcmp(nhp->th_name, name) == 0)
295 if (nhp) {
296 *min = nhp->th_range.tr_min;
297 *max = nhp->th_range.tr_max;
316 node_create_seterror(topo_mod_t *mod, tnode_t *pnode, topo_nodehash_t *nhp,
324 if (nhp != NULL) {
325 if (nhp->th_name != NULL)
326 topo_mod_strfree(mod, nhp->th_name);
327 if (nhp->th_nodearr != NULL) {
328 topo_mod_free(mod, nhp->th_nodearr,
329 nhp->th_arrlen * sizeof (tnode_t *));
331 topo_mod_free(mod, nhp, sizeof (topo_nodehash_t));
341 topo_nodehash_t *nhp;
348 for (nhp = topo_list_next(&pnode->tn_children); nhp != NULL;
349 nhp = topo_list_next(nhp)) {
350 if (strcmp(nhp->th_name, name) == 0)
359 if ((nhp = topo_mod_zalloc(mod, sizeof (topo_nodehash_t))) == NULL)
360 return (node_create_seterror(mod, pnode, nhp, EMOD_NOMEM));
362 if ((nhp->th_name = topo_mod_strdup(mod, name)) == NULL)
363 return (node_create_seterror(mod, pnode, nhp, EMOD_NOMEM));
365 nhp->th_arrlen = max - min + 1;
367 if ((nhp->th_nodearr = topo_mod_zalloc(mod,
368 nhp->th_arrlen * sizeof (tnode_t *))) == NULL)
369 return (node_create_seterror(mod, pnode, nhp, EMOD_NOMEM));
371 nhp->th_range.tr_min = min;
372 nhp->th_range.tr_max = max;
373 nhp->th_enum = mod;
379 topo_list_append(&pnode->tn_children, nhp);
389 node_extend_seterror(topo_mod_t *mod, tnode_t *pnode, topo_nodehash_t *nhp,
397 if (nhp != NULL) {
398 if (nhp->th_name != NULL)
399 topo_mod_strfree(mod, nhp->th_name);
400 if (nhp->th_nodearr != NULL) {
401 topo_mod_free(mod, nhp->th_nodearr,
402 nhp->th_arrlen * sizeof (tnode_t *));
404 topo_mod_free(mod, nhp, sizeof (topo_nodehash_t));
427 topo_nodehash_t *nhp = NULL;
441 for (nhp = topo_list_next(&pnode->tn_children); nhp != NULL;
442 nhp = topo_list_next(nhp)) {
443 if (strcmp(nhp->th_name, name) == 0)
447 if (nhp) {
449 newmax = nhp->th_range.tr_max + incr;
450 arrlen = newmax - nhp->th_range.tr_min + 1;
461 bcopy(nhp->th_nodearr, nodearr, nhp->th_arrlen *
468 topo_mod_free(mod, nhp->th_nodearr,
469 nhp->th_arrlen * sizeof (tnode_t *));
470 nhp->th_nodearr = nodearr;
472 nhp->th_arrlen = arrlen;
473 nhp->th_range.tr_max = newmax;
475 *min = nhp->th_range.tr_min;
476 *max = nhp->th_range.tr_max;
487 nhp->th_range.tr_min, nhp->th_range.tr_max);
496 topo_nodehash_t *nhp;
500 for (nhp = topo_list_next(&pnode->tn_children); nhp != NULL;
501 nhp = topo_list_next(nhp)) {
502 if (strcmp(nhp->th_name, name) == 0) {
507 if (nhp == NULL) {
512 for (i = 0; i < nhp->th_arrlen; i++)
513 assert(nhp->th_nodearr[i] == NULL);
515 topo_list_delete(&pnode->tn_children, nhp);
518 mod = nhp->th_enum;
519 if (nhp->th_name != NULL)
520 topo_mod_strfree(mod, nhp->th_name);
521 if (nhp->th_nodearr != NULL) {
522 topo_mod_free(mod, nhp->th_nodearr,
523 nhp->th_arrlen * sizeof (tnode_t *));
525 topo_mod_free(mod, nhp, sizeof (topo_nodehash_t));
535 topo_nodehash_t *nhp;
541 for (nhp = topo_list_next(&pnode->tn_children); nhp != NULL;
542 nhp = topo_list_next(nhp)) {
543 if (strcmp(nhp->th_name, name) == 0) {
545 if (inst > nhp->th_range.tr_max ||
546 inst < nhp->th_range.tr_min) {
551 h = topo_node_hash(nhp, inst);
552 node = nhp->th_nodearr[h];
563 topo_node_hash(topo_nodehash_t *nhp, topo_instance_t inst)
565 return ((inst - nhp->th_range.tr_min) % nhp->th_arrlen);
645 topo_nodehash_t *nhp;
648 for (nhp = topo_list_next(&pnode->tn_children); nhp != NULL;
649 nhp = topo_list_next(nhp)) {
650 if (strcmp(nhp->th_name, name) == 0) {
652 if (inst > nhp->th_range.tr_max ||
653 inst < nhp->th_range.tr_min)
657 h = topo_node_hash(nhp, inst);
658 if (nhp->th_nodearr[h] != NULL)
667 if (nhp == NULL)
680 node->tn_name = nhp->th_name;
682 node->tn_phash = nhp;
706 nhp->th_nodearr[h] = node;
734 topo_nodehash_t *nhp;
746 for (nhp = topo_list_next(&pnode->tn_children); nhp != NULL;
747 nhp = topo_list_next(nhp)) {
748 if (strcmp(nhp->th_name, name) == 0) {
750 if (inst > nhp->th_range.tr_max ||
751 inst < nhp->th_range.tr_min) {
756 h = topo_node_hash(nhp, inst);
757 if (nhp->th_nodearr[h] != NULL) {
768 if (nhp == NULL) {
784 node->tn_name = nhp->th_name;
786 node->tn_phash = nhp;
841 nhp->th_nodearr[h] = node;