Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*
*** 22,33 ****
/*
* Copyright 2004 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/systm.h>
#include <sys/conf.h>
#include <sys/stream.h>
--- 22,31 ----
*** 282,292 ****
try_again:
rw_enter(&fmodsw_lock, RW_READER);
if (i_fmodsw_hash_find(name, &fp) == 0) {
if (flags & FMODSW_HOLD) {
! atomic_add_32(&(fp->f_ref), 1); /* lock must be held */
ASSERT(fp->f_ref > 0);
}
rw_exit(&fmodsw_lock);
return (fp);
--- 280,290 ----
try_again:
rw_enter(&fmodsw_lock, RW_READER);
if (i_fmodsw_hash_find(name, &fp) == 0) {
if (flags & FMODSW_HOLD) {
! atomic_inc_32(&(fp->f_ref)); /* lock must be held */
ASSERT(fp->f_ref > 0);
}
rw_exit(&fmodsw_lock);
return (fp);
*** 306,312 ****
void
fmodsw_rele(fmodsw_impl_t *fp)
{
ASSERT(fp->f_ref > 0);
! atomic_add_32(&(fp->f_ref), -1);
}
--- 304,310 ----
void
fmodsw_rele(fmodsw_impl_t *fp)
{
ASSERT(fp->f_ref > 0);
! atomic_dec_32(&(fp->f_ref));
}