Print this page
5042 stop using deprecated atomic functions

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/stream.c
          +++ new/usr/src/uts/common/io/stream.c
↓ open down ↓ 790 lines elided ↑ open up ↑
 791  791                  oldrtfu = DBLK_RTFU_WORD(dbp);
 792  792                  newrtfu = oldrtfu + (1 << DBLK_RTFU_SHIFT(db_ref));
 793  793                  /*
 794  794                   * If db_ref is maxed out we can't dup this message anymore.
 795  795                   */
 796  796                  if ((oldrtfu & DBLK_RTFU_REF_MASK) == DBLK_RTFU_REF_MASK) {
 797  797                          kmem_cache_free(mblk_cache, new_mp);
 798  798                          new_mp = NULL;
 799  799                          goto out;
 800  800                  }
 801      -        } while (cas32(&DBLK_RTFU_WORD(dbp), oldrtfu, newrtfu) != oldrtfu);
      801 +        } while (atomic_cas_32(&DBLK_RTFU_WORD(dbp), oldrtfu, newrtfu) !=
      802 +            oldrtfu);
 802  803  
 803  804  out:
 804  805          FTRACE_1("dupb(): new_mp=0x%lx", (uintptr_t)new_mp);
 805  806          return (new_mp);
 806  807  }
 807  808  
 808  809  static void
 809  810  dblk_lastfree_desb(mblk_t *mp, dblk_t *dbp)
 810  811  {
 811  812          frtn_t *frp = dbp->db_frtnp;
↓ open down ↓ 3431 lines elided ↑ open up ↑
4243 4244                                  return;
4244 4245                          }
4245 4246                          nbp->nxt = NULL;
4246 4247                          nbp->ix = 1;
4247 4248                          /*
4248 4249                           * Just in case there is another thread about
4249 4250                           * to get the next index, we need to make sure
4250 4251                           * the value is there for it.
4251 4252                           */
4252 4253                          membar_producer();
4253      -                        if (casptr(&hp->tail, bp, nbp) == bp) {
     4254 +                        if (atomic_cas_ptr(&hp->tail, bp, nbp) == bp) {
4254 4255                                  /* CAS was successful */
4255 4256                                  bp->nxt = nbp;
4256 4257                                  membar_producer();
4257 4258                                  bp = nbp;
4258 4259                                  ix = 0;
4259 4260                                  goto cas_good;
4260 4261                          } else {
4261 4262                                  kmem_cache_free(ftblk_cache, nbp);
4262 4263                                  bp = hp->tail;
4263 4264                                  continue;
4264 4265                          }
4265 4266                  }
4266 4267                  nix = ix + 1;
4267      -                if (cas32((uint32_t *)&bp->ix, ix, nix) == ix) {
     4268 +                if (atomic_cas_32((uint32_t *)&bp->ix, ix, nix) == ix) {
4268 4269                  cas_good:
4269 4270                          if (curthread != hp->thread) {
4270 4271                                  hp->thread = curthread;
4271 4272                                  evnt |= FTEV_CS;
4272 4273                          }
4273 4274                          if (CPU->cpu_seqid != hp->cpu_seqid) {
4274 4275                                  hp->cpu_seqid = CPU->cpu_seqid;
4275 4276                                  evnt |= FTEV_PS;
4276 4277                          }
4277 4278                          ep = &bp->ev[ix];
↓ open down ↓ 67 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX