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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/crypto/io/dprov.c
          +++ new/usr/src/uts/common/crypto/io/dprov.c
↓ open down ↓ 1093 lines elided ↑ open up ↑
1094 1094                                          /* to the object fail. */
1095 1095                                          /* used for token objects only */
1096 1096          uint_t do_refcnt;
1097 1097  } dprov_object_t;
1098 1098  
1099 1099  /*
1100 1100   * If a session has a reference to a dprov_object_t,
1101 1101   * it REFHOLD()s.
1102 1102   */
1103 1103  #define DPROV_OBJECT_REFHOLD(object) {          \
1104      -        atomic_add_32(&(object)->do_refcnt, 1); \
     1104 +        atomic_inc_32(&(object)->do_refcnt);    \
1105 1105          ASSERT((object)->do_refcnt != 0);               \
1106 1106  }
1107 1107  
1108 1108  /*
1109 1109   * Releases a reference to an object. When the last
1110 1110   * reference is released, the object is freed.
1111 1111   */
1112 1112  #define DPROV_OBJECT_REFRELE(object) {                          \
1113 1113          ASSERT((object)->do_refcnt != 0);                       \
1114 1114          membar_exit();                                          \
1115      -        if (atomic_add_32_nv(&(object)->do_refcnt, -1) == 0)    \
     1115 +        if (atomic_dec_32_nv(&(object)->do_refcnt) == 0)        \
1116 1116                  dprov_free_object(object);                      \
1117 1117  }
1118 1118  
1119 1119  /*
1120 1120   * Object attributes are passed to the provider using crypto_object_attribute
1121 1121   * structures, which contain the type of the attribute, a pointer to
1122 1122   * it's value, and the length of its value. The attribute types values
1123 1123   * are defined by the PKCS#11 specification. This provider only cares
1124 1124   * about a subset of these attributes. In order to avoid having to
1125 1125   * include the PKCS#11 header files, we define here the attributes values
↓ open down ↓ 8680 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX