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


2238 }
2239 
2240 void
2241 mac_client_restart(mac_client_impl_t *mcip)
2242 {
2243         mac_rx_client_restart((mac_client_handle_t)mcip);
2244         mac_tx_client_restart((mac_client_handle_t)mcip);
2245 }
2246 
2247 /*
2248  * Allocate a minor number.
2249  */
2250 minor_t
2251 mac_minor_hold(boolean_t sleep)
2252 {
2253         minor_t minor;
2254 
2255         /*
2256          * Grab a value from the arena.
2257          */
2258         atomic_add_32(&minor_count, 1);
2259 
2260         if (sleep)
2261                 minor = (uint_t)id_alloc(minor_ids);
2262         else
2263                 minor = (uint_t)id_alloc_nosleep(minor_ids);
2264 
2265         if (minor == 0) {
2266                 atomic_add_32(&minor_count, -1);
2267                 return (0);
2268         }
2269 
2270         return (minor);
2271 }
2272 
2273 /*
2274  * Release a previously allocated minor number.
2275  */
2276 void
2277 mac_minor_rele(minor_t minor)
2278 {
2279         /*
2280          * Return the value to the arena.
2281          */
2282         id_free(minor_ids, minor);
2283         atomic_add_32(&minor_count, -1);
2284 }
2285 
2286 uint32_t
2287 mac_no_notification(mac_handle_t mh)
2288 {
2289         mac_impl_t *mip = (mac_impl_t *)mh;
2290 
2291         return (((mip->mi_state_flags & MIS_LEGACY) != 0) ?
2292             mip->mi_capab_legacy.ml_unsup_note : 0);
2293 }
2294 
2295 /*
2296  * Prevent any new opens of this mac in preparation for unregister
2297  */
2298 int
2299 i_mac_disable(mac_impl_t *mip)
2300 {
2301         mac_client_impl_t       *mcip;
2302 
2303         rw_enter(&i_mac_impl_lock, RW_WRITER);




2238 }
2239 
2240 void
2241 mac_client_restart(mac_client_impl_t *mcip)
2242 {
2243         mac_rx_client_restart((mac_client_handle_t)mcip);
2244         mac_tx_client_restart((mac_client_handle_t)mcip);
2245 }
2246 
2247 /*
2248  * Allocate a minor number.
2249  */
2250 minor_t
2251 mac_minor_hold(boolean_t sleep)
2252 {
2253         minor_t minor;
2254 
2255         /*
2256          * Grab a value from the arena.
2257          */
2258         atomic_inc_32(&minor_count);
2259 
2260         if (sleep)
2261                 minor = (uint_t)id_alloc(minor_ids);
2262         else
2263                 minor = (uint_t)id_alloc_nosleep(minor_ids);
2264 
2265         if (minor == 0) {
2266                 atomic_dec_32(&minor_count);
2267                 return (0);
2268         }
2269 
2270         return (minor);
2271 }
2272 
2273 /*
2274  * Release a previously allocated minor number.
2275  */
2276 void
2277 mac_minor_rele(minor_t minor)
2278 {
2279         /*
2280          * Return the value to the arena.
2281          */
2282         id_free(minor_ids, minor);
2283         atomic_dec_32(&minor_count);
2284 }
2285 
2286 uint32_t
2287 mac_no_notification(mac_handle_t mh)
2288 {
2289         mac_impl_t *mip = (mac_impl_t *)mh;
2290 
2291         return (((mip->mi_state_flags & MIS_LEGACY) != 0) ?
2292             mip->mi_capab_legacy.ml_unsup_note : 0);
2293 }
2294 
2295 /*
2296  * Prevent any new opens of this mac in preparation for unregister
2297  */
2298 int
2299 i_mac_disable(mac_impl_t *mip)
2300 {
2301         mac_client_impl_t       *mcip;
2302 
2303         rw_enter(&i_mac_impl_lock, RW_WRITER);