Lines Matching refs:ap

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