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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/sockfs/nl7curi.h
          +++ new/usr/src/uts/common/fs/sockfs/nl7curi.h
↓ open down ↓ 19 lines elided ↑ open up ↑
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27   27  #ifndef _SYS_SOCKFS_NL7CURI_H
  28   28  #define _SYS_SOCKFS_NL7CURI_H
  29   29  
  30      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  31      -
  32   30  #ifdef  __cplusplus
  33   31  extern "C" {
  34   32  #endif
  35   33  
  36   34  #include <sys/types.h>
  37   35  #include <sys/atomic.h>
  38   36  #include <sys/cmn_err.h>
  39   37  #include <sys/stropts.h>
  40   38  #include <sys/socket.h>
  41   39  #include <sys/socketvar.h>
↓ open down ↓ 34 lines elided ↑ open up ↑
  76   74          kmem_cache_t    *kmc;           /* Container allocator cache */
  77   75  } ref_t;
  78   76  
  79   77  #define REF_INIT(container, count, inactive, kmem) {                    \
  80   78          (container)->ref.cnt = (count);                                 \
  81   79          (container)->ref.last = (void (*)(void *))((inactive));         \
  82   80          (container)->ref.kmc = (kmem);                                  \
  83   81  }
  84   82  
  85   83  #define REF_HOLD(container) {                                           \
  86      -        atomic_add_32(&(container)->ref.cnt, 1);                        \
       84 +        atomic_inc_32(&(container)->ref.cnt);                   \
  87   85          ASSERT((container)->ref.cnt != 0);                              \
  88   86  }
  89   87  
  90   88  #define REF_RELE(container) {                                           \
  91      -        if (atomic_add_32_nv(&(container)->ref.cnt, -1) == 0) {         \
       89 +        if (atomic_dec_32_nv(&(container)->ref.cnt) == 0) {             \
  92   90                  (container)->ref.last((container));                     \
  93   91                  kmem_cache_free((container)->ref.kmc, (container));     \
  94   92          }                                                               \
  95   93  }
  96   94  
  97   95  #define REF_COUNT(container) (container)->ref.cnt
  98   96  
  99   97  #define REF_ASSERT(container, count)                                    \
 100   98          ASSERT((container)->ref.cnt == (count));
 101   99  
↓ open down ↓ 98 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX