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

*** 21,32 **** /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - #pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/param.h> #include <sys/modctl.h> #include <sys/sysmacros.h> #include <sys/kmem.h> --- 21,30 ----
*** 1376,1386 **** * out a destroy operation between the action * state being checked and the packet count * being incremented. */ ! atomic_add_32(&(ap->ippa_packets), 1); imp = ap->ippa_mod; ASSERT(imp != NULL); UNLOCK_ACTION(ap); --- 1374,1384 ---- * out a destroy operation between the action * state being checked and the packet count * being incremented. */ ! atomic_inc_32(&(ap->ippa_packets)); imp = ap->ippa_mod; ASSERT(imp != NULL); UNLOCK_ACTION(ap);
*** 1418,1428 **** /* * Decrement the packet count. */ ! atomic_add_32(&(ap->ippa_packets), -1); /* * If the class' action id is the same now as it was * before then clearly no 'next action' has been set. * This is a protocol error. --- 1416,1426 ---- /* * Decrement the packet count. */ ! atomic_dec_32(&(ap->ippa_packets)); /* * If the class' action id is the same now as it was * before then clearly no 'next action' has been set. * This is a protocol error.
*** 2377,2387 **** /* * Increment the hold count to prevent the structure from being * freed. */ ! atomic_add_32(&(imp->ippm_hold_count), 1); rw_exit(ipp_mod_byid_lock); return (imp); } #undef __FN__ --- 2375,2385 ---- /* * Increment the hold count to prevent the structure from being * freed. */ ! atomic_inc_32(&(imp->ippm_hold_count)); rw_exit(ipp_mod_byid_lock); return (imp); } #undef __FN__
*** 2395,2405 **** * This call means we're done with the pointer so we can drop the * hold count. */ ASSERT(imp->ippm_hold_count != 0); ! atomic_add_32(&(imp->ippm_hold_count), -1); /* * If the structure has 'destruct pending' set then we tried to free * it but couldn't, so do it now. */ --- 2393,2403 ---- * This call means we're done with the pointer so we can drop the * hold count. */ ASSERT(imp->ippm_hold_count != 0); ! atomic_dec_32(&(imp->ippm_hold_count)); /* * If the structure has 'destruct pending' set then we tried to free * it but couldn't, so do it now. */
*** 3069,3079 **** /* * Increment the hold count to prevent the structure from being * freed. */ ! atomic_add_32(&(ap->ippa_hold_count), 1); rw_exit(ipp_action_byid_lock); return (ap); } #undef __FN__ --- 3067,3077 ---- /* * Increment the hold count to prevent the structure from being * freed. */ ! atomic_inc_32(&(ap->ippa_hold_count)); rw_exit(ipp_action_byid_lock); return (ap); } #undef __FN__
*** 3087,3097 **** * This call means we're done with the pointer so we can drop the * hold count. */ ASSERT(ap->ippa_hold_count != 0); ! atomic_add_32(&(ap->ippa_hold_count), -1); /* * If the structure has 'destruct pending' set then we tried to free * it but couldn't, so do it now. */ --- 3085,3095 ---- * This call means we're done with the pointer so we can drop the * hold count. */ ASSERT(ap->ippa_hold_count != 0); ! atomic_dec_32(&(ap->ippa_hold_count)); /* * If the structure has 'destruct pending' set then we tried to free * it but couldn't, so do it now. */