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

@@ -342,22 +342,22 @@
  */
 void
 crhold(cred_t *cr)
 {
         ASSERT(cr->cr_ref != 0xdeadbeef && cr->cr_ref != 0);
-        atomic_add_32(&cr->cr_ref, 1);
+        atomic_inc_32(&cr->cr_ref);
 }
 
 /*
  * Release previous hold on a cred structure.  Free it if refcnt == 0.
  * If cred uses label different from zone label, free it.
  */
 void
 crfree(cred_t *cr)
 {
         ASSERT(cr->cr_ref != 0xdeadbeef && cr->cr_ref != 0);
-        if (atomic_add_32_nv(&cr->cr_ref, -1) == 0) {
+        if (atomic_dec_32_nv(&cr->cr_ref) == 0) {
                 ASSERT(cr != kcred);
                 if (cr->cr_label)
                         label_rele(cr->cr_label);
                 if (cr->cr_klpd)
                         crklpd_rele(cr->cr_klpd);

@@ -1465,14 +1465,14 @@
 }
 
 void
 crgrprele(credgrp_t *grps)
 {
-        if (atomic_add_32_nv(&grps->crg_ref, -1) == 0)
+        if (atomic_dec_32_nv(&grps->crg_ref) == 0)
                 kmem_free(grps, CREDGRPSZ(grps->crg_ngroups));
 }
 
 static void
 crgrphold(credgrp_t *grps)
 {
-        atomic_add_32(&grps->crg_ref, 1);
+        atomic_inc_32(&grps->crg_ref);
 }