Lines Matching defs:linkp

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