Lines Matching refs:ap
557 ipp_action_t *ap;
570 ap = NULL;
574 ap = NULL;
578 ap = NULL;
587 if ((ap = hold_action(aid)) == NULL)
590 LOCK_ACTION(ap, RW_READER);
591 aname = ap->ippa_name;
616 if (ap != NULL) {
617 UNLOCK_ACTION(ap);
618 rele_action(ap);
631 ipp_action_t *ap;
655 if ((ap = hold_action(aid)) == NULL)
662 LOCK_ACTION(ap, RW_READER);
663 if (ap->ippa_state == IPP_ASTATE_PROTO) {
664 UNLOCK_ACTION(ap);
665 rele_action(ap);
669 imp = ap->ippa_mod;
671 UNLOCK_ACTION(ap);
675 rele_action(ap);
692 ipp_action_t *ap;
722 ap = hold_action(aid);
723 ASSERT(ap != NULL);
729 LOCK_ACTION(ap, RW_WRITER);
730 ap->ippa_state = IPP_ASTATE_CONFIG_PENDING;
737 if ((rc = ref_mod(ap, imp)) != 0) {
739 ap->ippa_state = IPP_ASTATE_PROTO;
740 UNLOCK_ACTION(ap);
742 free_action(ap);
743 rele_action(ap);
748 UNLOCK_ACTION(ap);
758 CONFIG_WRITE_START(ap);
760 ap->ippa_name, imp->ippm_name);
761 if ((rc = ippo->ippo_action_create(ap->ippa_id, nvlpp, flags)) != 0) {
762 LOCK_ACTION(ap, RW_WRITER);
764 unref_mod(ap, imp);
766 ap->ippa_state = IPP_ASTATE_PROTO;
767 UNLOCK_ACTION(ap);
769 CONFIG_WRITE_END(ap);
771 free_action(ap);
772 rele_action(ap);
776 CONFIG_WRITE_END(ap);
782 LOCK_ACTION(ap, RW_WRITER);
783 ap->ippa_state = IPP_ASTATE_AVAILABLE;
785 *aidp = ap->ippa_id;
786 UNLOCK_ACTION(ap);
788 rele_action(ap);
802 ipp_action_t *ap;
809 if ((ap = hold_action(aid)) == NULL)
816 ap->ippa_condemned = &rp;
817 if ((rc = destroy_action(ap, flags)) == 0) {
825 ap = tmp->ippr_action;
826 ap->ippa_condemned = &rp;
827 (void) destroy_action(ap, flags);
837 ap = tmp->ippr_action;
838 rele_action(ap);
863 ipp_action_t *ap;
875 if ((ap = hold_action(aid)) == NULL)
886 LOCK_ACTION(ap, RW_READER);
887 if (ap->ippa_state != IPP_ASTATE_AVAILABLE &&
888 ap->ippa_state != IPP_ASTATE_CONFIG_PENDING) {
889 UNLOCK_ACTION(ap);
890 rele_action(ap);
894 imp = ap->ippa_mod;
896 UNLOCK_ACTION(ap);
905 DBG1(DBG_ACTION, "modifying action '%s'\n", ap->ippa_name);
906 CONFIG_WRITE_START(ap);
908 CONFIG_WRITE_END(ap);
910 rele_action(ap);
923 ipp_action_t *ap;
932 if ((ap = hold_action(aid)) == NULL)
941 LOCK_ACTION(ap, RW_READER);
942 if (ap->ippa_state != IPP_ASTATE_AVAILABLE) {
943 UNLOCK_ACTION(ap);
944 rele_action(ap);
948 imp = ap->ippa_mod;
950 UNLOCK_ACTION(ap);
961 ap->ippa_name);
962 CONFIG_READ_START(ap);
964 CONFIG_READ_END(ap);
965 rele_action(ap);
968 CONFIG_READ_END(ap);
970 rele_action(ap);
981 ipp_action_t *ap;
987 ap = hold_action(aid);
988 ASSERT(ap != NULL);
994 ap->ippa_ptr = ptr;
995 rele_action(ap);
1004 ipp_action_t *ap;
1011 ap = hold_action(aid);
1012 ASSERT(ap != NULL);
1018 ptr = ap->ippa_ptr;
1019 rele_action(ap);
1033 ipp_action_t *ap;
1063 if ((ap = hold_action(aid)) == NULL)
1067 rele_action(ap);
1071 LOCK_ACTION(ap, RW_WRITER);
1076 UNLOCK_ACTION(ap);
1079 rele_action(ap);
1087 rc = ref_action(ap, ref_ap);
1089 UNLOCK_ACTION(ap);
1092 rele_action(ap);
1104 ipp_action_t *ap;
1131 if ((ap = hold_action(aid)) == NULL)
1135 rele_action(ap);
1139 LOCK_ACTION(ap, RW_WRITER);
1146 if ((rc = unref_action(ap, ref_ap)) != 0) {
1148 UNLOCK_ACTION(ap);
1150 rele_action(ap);
1157 UNLOCK_ACTION(ap);
1166 (void) condemn_action(ap->ippa_condemned, ref_ap);
1172 rele_action(ap);
1320 ipp_action_t *ap;
1351 if ((ap = hold_action(aid)) == NULL) {
1360 LOCK_ACTION(ap, RW_READER);
1361 if (ap->ippa_state != IPP_ASTATE_AVAILABLE) {
1362 UNLOCK_ACTION(ap);
1363 rele_action(ap);
1379 atomic_inc_32(&(ap->ippa_packets));
1381 imp = ap->ippa_mod;
1383 UNLOCK_ACTION(ap);
1421 atomic_dec_32(&(ap->ippa_packets));
1432 ap->ippa_name);
1433 rele_action(ap);
1445 rc, ap->ippa_name);
1446 rele_action(ap);
1450 rele_action(ap);
1502 ipp_action_t *ap;
1530 if ((ap = hold_action(aid)) == NULL) {
1534 rele_action(ap);
1609 ipp_action_t *ap;
1631 if ((ap = hold_action(aid)) == NULL)
1638 LOCK_ACTION(ap, RW_READER);
1639 class = ap->ippa_name;
1640 instance = (int)ap->ippa_id;
1642 imp = ap->ippa_mod;
1664 UNLOCK_ACTION(ap);
1669 UNLOCK_ACTION(ap);
1711 rele_action(ap);
1893 ipp_action_t *ap,
1899 ASSERT(rw_write_held(ap->ippa_lock));
1908 ASSERT(rp->ippr_action != ap);
1923 rp->ippr_action = ap;
1931 ap->ippa_mod = imp;
1940 ipp_action_t *ap,
1946 ASSERT(rw_write_held(ap->ippa_lock));
1955 if (rp->ippr_action == ap)
1972 ap->ippa_mod = NULL;
1999 ipp_action_t *ap;
2041 ap = rp->ippr_action;
2042 *buf++ = ap->ippa_id;
2466 ipp_action_t *ap)
2470 DBG1(DBG_ACTION, "condemning action '%s'\n", ap->ippa_name);
2477 if (rp->ippr_action == ap)
2490 rp->ippr_action = ap;
2501 ipp_action_t *ap,
2514 LOCK_ACTION(ap, RW_WRITER);
2515 if (ap->ippa_state != IPP_ASTATE_AVAILABLE) {
2516 UNLOCK_ACTION(ap);
2517 rele_action(ap);
2525 ap->ippa_state = IPP_ASTATE_CONFIG_PENDING;
2535 for (wait = 0; ap->ippa_packets > 0 && wait < (MAXWAIT * 1000000);
2549 if (ap->ippa_packets > 0) {
2550 ap->ippa_state = IPP_ASTATE_AVAILABLE;
2551 UNLOCK_ACTION(ap);
2552 rele_action(ap);
2560 if (is_action_refd(ap)) {
2561 ap->ippa_state = IPP_ASTATE_AVAILABLE;
2562 UNLOCK_ACTION(ap);
2563 rele_action(ap);
2567 imp = ap->ippa_mod;
2569 UNLOCK_ACTION(ap);
2578 CONFIG_WRITE_START(ap);
2579 DBG1(DBG_ACTION, "destroying action '%s'\n", ap->ippa_name);
2580 if ((rc = ippo->ippo_action_destroy(ap->ippa_id, flags)) != 0) {
2581 LOCK_ACTION(ap, RW_WRITER);
2582 ap->ippa_state = IPP_ASTATE_AVAILABLE;
2583 UNLOCK_ACTION(ap);
2585 CONFIG_WRITE_END(ap);
2587 rele_action(ap);
2590 CONFIG_WRITE_END(ap);
2592 LOCK_ACTION(ap, RW_WRITER);
2594 unref_mod(ap, imp);
2596 ap->ippa_state = IPP_ASTATE_PROTO;
2597 UNLOCK_ACTION(ap);
2603 ASSERT(ap->ippa_ref == NULL);
2604 free_action(ap);
2605 rele_action(ap);
2797 ipp_action_t *ap)
2804 return (ap->ippa_refby != NULL);
2814 ipp_action_t *ap;
2843 ap = rp->ippr_action;
2844 if (strcmp(ap->ippa_name, aname) == 0)
2854 if (ap->ippa_state == IPP_ASTATE_PROTO) {
2859 aid = ap->ippa_id;
2872 ipp_action_t *ap;
2898 ap = rp->ippr_action;
2899 if (aname != NULL && strcmp(ap->ippa_name, aname) == 0) {
2917 if ((ap = kmem_cache_alloc(ipp_action_cache, KM_NOSLEEP)) == NULL) {
2929 (void) sprintf(ap->ippa_name, "$%08X", ap->ippa_id);
2930 ap->ippa_nameless = B_TRUE;
2932 (void) strcpy(ap->ippa_name, aname);
2939 LOCK_ACTION(ap, RW_WRITER);
2940 ap->ippa_destruct_pending = B_FALSE;
2941 UNLOCK_ACTION(ap);
2947 rp->ippr_action = ap;
2956 *aidp = ap->ippa_id;
2965 ipp_action_t *ap)
2977 if (!ap->ippa_nameless) {
2978 hb = hash(ap->ippa_name);
2988 if (rp->ippr_action == ap)
3011 *ap->ippa_name = '\0';
3018 LOCK_ACTION(ap, RW_WRITER);
3019 ap->ippa_destruct_pending = B_TRUE;
3020 if (ap->ippa_hold_count == 0) {
3021 UNLOCK_ACTION(ap);
3022 kmem_cache_free(ipp_action_cache, ap);
3026 UNLOCK_ACTION(ap);
3037 ipp_action_t *ap;
3048 if ((ap = ipp_action_byid[aid]) == NULL) {
3059 LOCK_ACTION(ap, RW_READER);
3060 if (ap->ippa_destruct_pending) {
3061 UNLOCK_ACTION(ap);
3065 UNLOCK_ACTION(ap);
3072 atomic_inc_32(&(ap->ippa_hold_count));
3075 return (ap);
3082 ipp_action_t *ap)
3089 ASSERT(ap->ippa_hold_count != 0);
3090 atomic_dec_32(&(ap->ippa_hold_count));
3097 LOCK_ACTION(ap, RW_READER);
3098 if (ap->ippa_destruct_pending && ap->ippa_hold_count == 0) {
3099 UNLOCK_ACTION(ap);
3100 kmem_cache_free(ipp_action_cache, ap);
3103 UNLOCK_ACTION(ap);
3443 ipp_action_t *ap;
3448 ap = (ipp_action_t *)buf;
3465 ap->ippa_state = IPP_ASTATE_PROTO;
3466 ap->ippa_destruct_pending = B_TRUE;
3467 rw_init(ap->ippa_lock, NULL, RW_DEFAULT,
3469 CONFIG_LOCK_INIT(ap->ippa_config_lock);
3475 ap->ippa_id = aid;
3476 ipp_action_byid[aid] = ap;
3490 ipp_action_t *ap;
3493 ap = (ipp_action_t *)buf;
3495 ASSERT(ap->ippa_state == IPP_ASTATE_PROTO);
3496 ASSERT(ap->ippa_ref == NULL);
3497 ASSERT(ap->ippa_refby == NULL);
3498 ASSERT(ap->ippa_packets == 0);
3499 ASSERT(*ap->ippa_name == '\0');
3500 ASSERT(ap->ippa_destruct_pending);
3503 ASSERT(ap->ippa_hold_count == 0);
3509 ipp_action_byid[ap->ippa_id] = NULL;
3516 CONFIG_LOCK_FINI(ap->ippa_config_lock);
3517 rw_destroy(ap->ippa_lock);