Lines Matching refs:linkp
94 dlmgmt_link_t *linkp = avl_first(&dlmgmt_id_avl); in dlmgmt_getlink_by_dev() local
96 for (; linkp != NULL; linkp = AVL_NEXT(&dlmgmt_id_avl, linkp)) { in dlmgmt_getlink_by_dev()
97 if (link_is_visible(linkp, zoneid) && in dlmgmt_getlink_by_dev()
98 (linkp->ll_class == DATALINK_CLASS_PHYS) && in dlmgmt_getlink_by_dev()
99 linkattr_equal(&(linkp->ll_head), FDEVNAME, devname, in dlmgmt_getlink_by_dev()
101 return (linkp); in dlmgmt_getlink_by_dev()
148 dlmgmt_link_t *linkp; in dlmgmt_upcall_create() local
176 if ((class == DATALINK_CLASS_PHYS) && (linkp = in dlmgmt_upcall_create()
178 if (linkattr_equal(&(linkp->ll_head), FPHYMAJ, in dlmgmt_upcall_create()
180 linkattr_equal(&(linkp->ll_head), FPHYINST, in dlmgmt_upcall_create()
182 (linkp->ll_flags & flags) == flags) { in dlmgmt_upcall_create()
189 err = linkattr_set(&(linkp->ll_head), FPHYMAJ, in dlmgmt_upcall_create()
194 err = linkattr_set(&(linkp->ll_head), FPHYINST, in dlmgmt_upcall_create()
202 if ((linkp->ll_flags & DLMGMT_ACTIVE) == 0) in dlmgmt_upcall_create()
205 if ((err = link_activate(linkp)) != 0) in dlmgmt_upcall_create()
207 linkp->ll_flags |= flags; in dlmgmt_upcall_create()
208 linkp->ll_gen++; in dlmgmt_upcall_create()
214 zoneid, flags, &linkp)) == EEXIST) { in dlmgmt_upcall_create()
232 &linkp); in dlmgmt_upcall_create()
245 (((err = linkattr_set(&linkp->ll_head, FDEVNAME, create->ld_devname, in dlmgmt_upcall_create()
247 ((err = linkattr_set(&linkp->ll_head, FPHYMAJ, &create->ld_phymaj, in dlmgmt_upcall_create()
249 ((err = linkattr_set(&linkp->ll_head, FPHYINST, &create->ld_phyinst, in dlmgmt_upcall_create()
251 (void) dlmgmt_destroy_common(linkp, flags); in dlmgmt_upcall_create()
255 if ((err == 0) && ((err = dlmgmt_write_db_entry(linkp->ll_link, linkp, in dlmgmt_upcall_create()
256 linkp->ll_flags)) != 0) && created) { in dlmgmt_upcall_create()
257 (void) dlmgmt_destroy_common(linkp, flags); in dlmgmt_upcall_create()
262 retvalp->lr_linkid = linkp->ll_linkid; in dlmgmt_upcall_create()
287 dlmgmt_link_t *linkp; in dlmgmt_upcall_update() local
299 if ((linkp = dlmgmt_getlink_by_dev(update->ld_devname, zoneid)) == in dlmgmt_upcall_update()
305 if ((err = dlmgmt_checkprivs(linkp->ll_class, cred)) != 0) in dlmgmt_upcall_update()
308 retvalp->lr_linkid = linkp->ll_linkid; in dlmgmt_upcall_update()
310 if (linkp->ll_media != media && linkp->ll_media != DL_OTHER) { in dlmgmt_upcall_update()
328 retvalp->lr_media = linkp->ll_media; in dlmgmt_upcall_update()
333 (strcmp(update->ld_devname, linkp->ll_link) != 0)) { in dlmgmt_upcall_update()
343 if (linkp->ll_media != media) { in dlmgmt_upcall_update()
344 linkp->ll_media = media; in dlmgmt_upcall_update()
345 linkp->ll_gen++; in dlmgmt_upcall_update()
346 (void) dlmgmt_write_db_entry(linkp->ll_link, linkp, in dlmgmt_upcall_update()
347 linkp->ll_flags); in dlmgmt_upcall_update()
363 dlmgmt_link_t *linkp = NULL; in dlmgmt_upcall_destroy() local
374 if ((linkp = link_by_id(linkid, zoneid)) == NULL) { in dlmgmt_upcall_destroy()
379 if ((err = dlmgmt_checkprivs(linkp->ll_class, cred)) != 0) in dlmgmt_upcall_destroy()
382 if (((linkp->ll_flags & flags) & DLMGMT_ACTIVE) != 0) { in dlmgmt_upcall_destroy()
383 if ((err = dlmgmt_delete_db_entry(linkp, DLMGMT_ACTIVE)) != 0) in dlmgmt_upcall_destroy()
388 if (((linkp->ll_flags & flags) & DLMGMT_PERSIST) != 0) { in dlmgmt_upcall_destroy()
389 if ((err = dlmgmt_delete_db_entry(linkp, DLMGMT_PERSIST)) != 0) in dlmgmt_upcall_destroy()
394 err = dlmgmt_destroy_common(linkp, flags); in dlmgmt_upcall_destroy()
397 (void) dlmgmt_write_db_entry(linkp->ll_link, linkp, dflags); in dlmgmt_upcall_destroy()
410 dlmgmt_link_t *linkp; in dlmgmt_getname() local
417 if ((linkp = link_by_id(getname->ld_linkid, zoneid)) == NULL) { in dlmgmt_getname()
419 } else if (strlcpy(retvalp->lr_link, linkp->ll_link, MAXLINKNAMELEN) >= in dlmgmt_getname()
423 retvalp->lr_flags = linkp->ll_flags; in dlmgmt_getname()
424 retvalp->lr_class = linkp->ll_class; in dlmgmt_getname()
425 retvalp->lr_media = linkp->ll_media; in dlmgmt_getname()
439 dlmgmt_link_t *linkp; in dlmgmt_getlinkid() local
447 if ((linkp = link_by_name(getlinkid->ld_link, zoneid)) == NULL) { in dlmgmt_getlinkid()
455 retvalp->lr_linkid = linkp->ll_linkid; in dlmgmt_getlinkid()
456 retvalp->lr_flags = linkp->ll_flags; in dlmgmt_getlinkid()
457 retvalp->lr_class = linkp->ll_class; in dlmgmt_getlinkid()
458 retvalp->lr_media = linkp->ll_media; in dlmgmt_getlinkid()
472 dlmgmt_link_t link, *linkp; in dlmgmt_getnext() local
482 if ((linkp = avl_find(&dlmgmt_id_avl, &link, &where)) == NULL) in dlmgmt_getnext()
483 linkp = avl_nearest(&dlmgmt_id_avl, where, AVL_AFTER); in dlmgmt_getnext()
485 for (; linkp != NULL; linkp = AVL_NEXT(&dlmgmt_id_avl, linkp)) { in dlmgmt_getnext()
486 if (!link_is_visible(linkp, zoneid)) in dlmgmt_getnext()
488 if ((linkp->ll_class & getnext->ld_class) && in dlmgmt_getnext()
489 (linkp->ll_flags & getnext->ld_flags) && in dlmgmt_getnext()
491 linkp->ll_media)) in dlmgmt_getnext()
495 if (linkp == NULL) { in dlmgmt_getnext()
498 retvalp->lr_linkid = linkp->ll_linkid; in dlmgmt_getnext()
499 retvalp->lr_class = linkp->ll_class; in dlmgmt_getnext()
500 retvalp->lr_media = linkp->ll_media; in dlmgmt_getnext()
501 retvalp->lr_flags = linkp->ll_flags; in dlmgmt_getnext()
515 dlmgmt_link_t *linkp; in dlmgmt_upcall_getattr() local
521 if ((linkp = link_by_id(getattr->ld_linkid, zoneid)) == NULL) { in dlmgmt_upcall_getattr()
524 retvalp->lr_err = dlmgmt_getattr_common(&linkp->ll_head, in dlmgmt_upcall_getattr()
537 dlmgmt_link_t *linkp; in dlmgmt_createid() local
557 createid->ld_media, zoneid, createid->ld_flags, &linkp); in dlmgmt_createid()
561 createid->ld_flags, &linkp); in dlmgmt_createid()
568 linkid = linkp->ll_linkid; in dlmgmt_createid()
570 (void) dlmgmt_write_db_entry(linkp->ll_link, linkp, in dlmgmt_createid()
590 dlmgmt_link_t *linkp = NULL; in dlmgmt_destroyid() local
597 if ((linkp = link_by_id(linkid, zoneid)) == NULL) { in dlmgmt_destroyid()
602 if ((err = dlmgmt_checkprivs(linkp->ll_class, cred)) != 0) in dlmgmt_destroyid()
609 err = dlmgmt_delete_db_entry(linkp, DLMGMT_ACTIVE); in dlmgmt_destroyid()
611 err = dlmgmt_destroy_common(linkp, flags); in dlmgmt_destroyid()
629 dlmgmt_link_t *linkp; in dlmgmt_remapid() local
643 if ((linkp = link_by_id(remapid->ld_linkid, zoneid)) == NULL) { in dlmgmt_remapid()
648 if ((err = dlmgmt_checkprivs(linkp->ll_class, cred)) != 0) in dlmgmt_remapid()
651 if (link_by_name(remapid->ld_link, linkp->ll_zoneid) != NULL) { in dlmgmt_remapid()
656 (void) strlcpy(oldname, linkp->ll_link, MAXLINKNAMELEN); in dlmgmt_remapid()
657 avl_remove(&dlmgmt_name_avl, linkp); in dlmgmt_remapid()
658 (void) strlcpy(linkp->ll_link, remapid->ld_link, MAXLINKNAMELEN); in dlmgmt_remapid()
659 avl_add(&dlmgmt_name_avl, linkp); in dlmgmt_remapid()
662 if (linkp->ll_flags & DLMGMT_ACTIVE) { in dlmgmt_remapid()
663 err = dlmgmt_write_db_entry(oldname, linkp, DLMGMT_ACTIVE); in dlmgmt_remapid()
667 if (linkp->ll_flags & DLMGMT_PERSIST) { in dlmgmt_remapid()
668 err = dlmgmt_write_db_entry(oldname, linkp, DLMGMT_PERSIST); in dlmgmt_remapid()
670 if (linkp->ll_flags & DLMGMT_ACTIVE) { in dlmgmt_remapid()
672 linkp, DLMGMT_ACTIVE); in dlmgmt_remapid()
678 dlmgmt_advance(linkp); in dlmgmt_remapid()
679 linkp->ll_gen++; in dlmgmt_remapid()
682 avl_remove(&dlmgmt_name_avl, linkp); in dlmgmt_remapid()
683 (void) strlcpy(linkp->ll_link, oldname, MAXLINKNAMELEN); in dlmgmt_remapid()
684 avl_add(&dlmgmt_name_avl, linkp); in dlmgmt_remapid()
697 dlmgmt_link_t *linkp; in dlmgmt_upid() local
704 if ((linkp = link_by_id(upid->ld_linkid, zoneid)) == NULL) { in dlmgmt_upid()
709 if ((err = dlmgmt_checkprivs(linkp->ll_class, cred)) != 0) in dlmgmt_upid()
712 if (linkp->ll_flags & DLMGMT_ACTIVE) { in dlmgmt_upid()
717 if ((err = link_activate(linkp)) == 0) { in dlmgmt_upid()
718 (void) dlmgmt_write_db_entry(linkp->ll_link, linkp, in dlmgmt_upid()
841 dlmgmt_link_t *linkp; in dlmgmt_writeconf() local
864 linkp = link_by_id(dlconfp->ld_linkid, zoneid); in dlmgmt_writeconf()
865 if ((linkp == NULL) || (linkp->ll_class != dlconfp->ld_class) || in dlmgmt_writeconf()
866 (linkp->ll_media != dlconfp->ld_media) || in dlmgmt_writeconf()
867 (strcmp(linkp->ll_link, dlconfp->ld_link) != 0)) { in dlmgmt_writeconf()
876 if (linkp->ll_gen != dlconfp->ld_gen) { in dlmgmt_writeconf()
888 for (attrp = linkp->ll_head; attrp != NULL; attrp = next) { in dlmgmt_writeconf()
893 linkp->ll_head = NULL; in dlmgmt_writeconf()
899 if ((err = linkattr_set(&(linkp->ll_head), attrp->lp_name, in dlmgmt_writeconf()
906 linkp->ll_gen++; in dlmgmt_writeconf()
907 err = dlmgmt_write_db_entry(linkp->ll_link, linkp, DLMGMT_PERSIST); in dlmgmt_writeconf()
921 dlmgmt_link_t *linkp; in dlmgmt_removeconf() local
925 if ((linkp = link_by_id(removeconf->ld_linkid, zoneid)) == NULL) { in dlmgmt_removeconf()
929 if (zoneid != GLOBAL_ZONEID && linkp->ll_onloan) { in dlmgmt_removeconf()
938 if ((err = dlmgmt_checkprivs(linkp->ll_class, cred)) != 0) in dlmgmt_removeconf()
941 err = dlmgmt_delete_db_entry(linkp, DLMGMT_PERSIST); in dlmgmt_removeconf()
996 dlmgmt_link_t *linkp; in dlmgmt_openconf() local
1011 linkp = link_by_id(linkid, zoneid); in dlmgmt_openconf()
1012 if ((linkp == NULL) || !(linkp->ll_flags & DLMGMT_PERSIST)) { in dlmgmt_openconf()
1017 if (linkp->ll_onloan && zoneid != GLOBAL_ZONEID) { in dlmgmt_openconf()
1026 if ((err = dlmgmt_checkprivs(linkp->ll_class, cred)) != 0) in dlmgmt_openconf()
1029 if ((err = dlconf_create(linkp->ll_link, linkp->ll_linkid, in dlmgmt_openconf()
1030 linkp->ll_class, linkp->ll_media, zoneid, &dlconfp)) != 0) in dlmgmt_openconf()
1033 for (attrp = linkp->ll_head; attrp != NULL; attrp = attrp->lp_next) { in dlmgmt_openconf()
1040 dlconfp->ld_gen = linkp->ll_gen; in dlmgmt_openconf()
1065 dlmgmt_link_t *linkp; in dlmgmt_getconfsnapshot() local
1079 linkp = link_by_id(linkid, zoneid); in dlmgmt_getconfsnapshot()
1080 if ((linkp == NULL) || !(linkp->ll_flags & DLMGMT_PERSIST)) { in dlmgmt_getconfsnapshot()
1085 if (linkp->ll_onloan && zoneid != GLOBAL_ZONEID) { in dlmgmt_getconfsnapshot()
1098 for (attrp = linkp->ll_head; attrp != NULL; attrp = attrp->lp_next) { in dlmgmt_getconfsnapshot()
1166 dlmgmt_link_t *linkp; in dlmgmt_upcall_linkprop_init() local
1170 if ((linkp = link_by_id(lip->ld_linkid, zoneid)) == NULL) in dlmgmt_upcall_linkprop_init()
1173 err = dlmgmt_checkprivs(linkp->ll_class, cred); in dlmgmt_upcall_linkprop_init()
1198 dlmgmt_link_t *linkp; in dlmgmt_setzoneid() local
1211 if ((linkp = link_by_id(linkid, zoneid)) == NULL) { in dlmgmt_setzoneid()
1216 if ((err = dlmgmt_checkprivs(linkp->ll_class, cred)) != 0) in dlmgmt_setzoneid()
1220 if (!(linkp->ll_flags & DLMGMT_ACTIVE)) { in dlmgmt_setzoneid()
1225 oldzoneid = linkp->ll_zoneid; in dlmgmt_setzoneid()
1236 link_by_name(linkp->ll_link, newzoneid) != NULL) { in dlmgmt_setzoneid()
1248 avl_remove(&dlmgmt_loan_avl, linkp); in dlmgmt_setzoneid()
1249 linkp->ll_onloan = B_FALSE; in dlmgmt_setzoneid()
1259 avl_add(&dlmgmt_loan_avl, linkp); in dlmgmt_setzoneid()
1260 linkp->ll_onloan = B_TRUE; in dlmgmt_setzoneid()
1263 avl_remove(&dlmgmt_name_avl, linkp); in dlmgmt_setzoneid()
1264 linkp->ll_zoneid = newzoneid; in dlmgmt_setzoneid()
1265 avl_add(&dlmgmt_name_avl, linkp); in dlmgmt_setzoneid()