Print this page
5042 stop using deprecated atomic functions

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/ip/sadb.c
          +++ new/usr/src/uts/common/inet/ip/sadb.c
↓ open down ↓ 1723 lines elided ↑ open up ↑
1724 1724  
1725 1725          /*
1726 1726           * First, check atomically that I'm the first and only keysock
1727 1727           * instance.
1728 1728           *
1729 1729           * Use OTHERQ(q), because qreply(q, mp) == putnext(OTHERQ(q), mp),
1730 1730           * and I want this module to say putnext(*_pfkey_q, mp) for PF_KEY
1731 1731           * messages.
1732 1732           */
1733 1733  
1734      -        oldq = casptr((void **)pfkey_qp, NULL, OTHERQ(q));
     1734 +        oldq = atomic_cas_ptr((void **)pfkey_qp, NULL, OTHERQ(q));
1735 1735          if (oldq != NULL) {
1736 1736                  ASSERT(oldq != q);
1737 1737                  cmn_err(CE_WARN, "Danger!  Multiple keysocks on top of %s.\n",
1738 1738                      (satype == SADB_SATYPE_ESP)? "ESP" : "AH or other");
1739 1739                  freemsg(mp);
1740 1740                  return;
1741 1741          }
1742 1742  
1743 1743          kha = (keysock_hello_ack_t *)mp->b_rptr;
1744 1744          kha->ks_hello_len = sizeof (keysock_hello_ack_t);
1745 1745          kha->ks_hello_type = KEYSOCK_HELLO_ACK;
1746 1746          kha->ks_hello_satype = (uint8_t)satype;
1747 1747  
1748 1748          /*
1749      -         * If we made it past the casptr, then we have "exclusive" access
1750      -         * to the timeout handle.  Fire it off after the default ager
     1749 +         * If we made it past the atomic_cas_ptr, then we have "exclusive"
     1750 +         * access to the timeout handle.  Fire it off after the default ager
1751 1751           * interval.
1752 1752           */
1753 1753          *top = qtimeout(*pfkey_qp, ager, agerarg,
1754 1754              drv_usectohz(SADB_AGE_INTERVAL_DEFAULT * 1000));
1755 1755  
1756 1756          putnext(*pfkey_qp, mp);
1757 1757  }
1758 1758  
1759 1759  /*
1760 1760   * Normalize IPv4-mapped IPv6 addresses (and prefixes) as appropriate.
↓ open down ↓ 6087 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX