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

@@ -535,11 +535,11 @@
                 keystack = ks->keysock_keystack;
 
                 ks3dbg(keystack,
                     ("Driver close, PF_KEY socket is going away.\n"));
                 if ((ks->keysock_flags & KEYSOCK_EXTENDED) != 0)
-                        atomic_add_32(&keystack->keystack_num_extended, -1);
+                        atomic_dec_32(&keystack->keystack_num_extended);
                 size = sizeof (keysock_t);
                 mutex_enter(&keystack->keystack_list_lock);
                 *(ks->keysock_ptpn) = ks->keysock_next;
                 if (ks->keysock_next != NULL)
                         ks->keysock_next->keysock_ptpn = ks->keysock_ptpn;

@@ -1563,11 +1563,11 @@
         }
 
         /*
          * Set global to indicate we prefer an extended ACQUIRE.
          */
-        atomic_add_32(&keystack->keystack_num_extended, 1);
+        atomic_inc_32(&keystack->keystack_num_extended);
 }
 
 static void
 keysock_delpair_all(keysock_t *ks, mblk_t *mp, sadb_ext_t *extv[])
 {

@@ -2333,12 +2333,12 @@
                         /*
                          * Lower the atomic "flushing" count.  If it's
                          * the last one, send up the end-of-{FLUSH,DUMP} to
                          * the appropriate PF_KEY socket.
                          */
-                        if (atomic_add_32_nv(&keystack->keystack_flushdump,
-                            -1) != 0) {
+                        if (atomic_dec_32_nv(&keystack->keystack_flushdump) !=
+                            0) {
                                 ks1dbg(keystack,
                                     ("One flush/dump message back from %d,"
                                     " more to go.\n", samsg->sadb_msg_satype));
                                 freemsg(mp1);
                                 return;

@@ -2380,7 +2380,7 @@
 uint32_t
 keysock_next_seq(netstack_t *ns)
 {
         keysock_stack_t *keystack = ns->netstack_keysock;
 
-        return (atomic_add_32_nv(&keystack->keystack_acquire_seq, -1));
+        return (atomic_dec_32_nv(&keystack->keystack_acquire_seq));
 }