Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*

*** 394,415 **** * If a component has a reference to a kcf_policy_desc_t, * it REFHOLD()s. A new policy descriptor which is referenced only * by the policy table has a reference count of one. */ #define KCF_POLICY_REFHOLD(desc) { \ ! atomic_add_32(&(desc)->pd_refcnt, 1); \ ASSERT((desc)->pd_refcnt != 0); \ } /* * Releases a reference to a policy descriptor. When the last * reference is released, the descriptor is freed. */ #define KCF_POLICY_REFRELE(desc) { \ ASSERT((desc)->pd_refcnt != 0); \ membar_exit(); \ ! if (atomic_add_32_nv(&(desc)->pd_refcnt, -1) == 0) \ kcf_policy_free_desc(desc); \ } /* * This entry stores the name of a software module and its --- 394,415 ---- * If a component has a reference to a kcf_policy_desc_t, * it REFHOLD()s. A new policy descriptor which is referenced only * by the policy table has a reference count of one. */ #define KCF_POLICY_REFHOLD(desc) { \ ! atomic_inc_32(&(desc)->pd_refcnt); \ ASSERT((desc)->pd_refcnt != 0); \ } /* * Releases a reference to a policy descriptor. When the last * reference is released, the descriptor is freed. */ #define KCF_POLICY_REFRELE(desc) { \ ASSERT((desc)->pd_refcnt != 0); \ membar_exit(); \ ! if (atomic_dec_32_nv(&(desc)->pd_refcnt) == 0) \ kcf_policy_free_desc(desc); \ } /* * This entry stores the name of a software module and its