Print this page
5042 stop using deprecated atomic functions

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/portfs/port_fop.c
          +++ new/usr/src/uts/common/fs/portfs/port_fop.c
↓ open down ↓ 285 lines elided ↑ open up ↑
 286  286  port_fop_femop()
 287  287  {
 288  288          fem_t *femp;
 289  289          if (fop_femop != NULL)
 290  290                  return (fop_femop);
 291  291          if (fem_create("portfop_fem",
 292  292              (const struct fs_operation_def *)port_vnodesrc_template,
 293  293              (fem_t **)&femp)) {
 294  294                  return (NULL);
 295  295          }
 296      -        if (casptr(&fop_femop, NULL, femp) != NULL) {
      296 +        if (atomic_cas_ptr(&fop_femop, NULL, femp) != NULL) {
 297  297                  /*
 298  298                   * some other thread beat us to it.
 299  299                   */
 300  300                  fem_free(femp);
 301  301          }
 302  302          return (fop_femop);
 303  303  }
 304  304  
 305  305  static fsem_t *
 306  306  port_fop_fsemop()
 307  307  {
 308  308          fsem_t *fsemp;
 309  309          if (fop_fsemop != NULL)
 310  310                  return (fop_fsemop);
 311  311          if (fsem_create("portfop_fsem", port_vfssrc_template, &fsemp)) {
 312  312                  return (NULL);
 313  313          }
 314      -        if (casptr(&fop_fsemop, NULL, fsemp) != NULL) {
      314 +        if (atomic_cas_ptr(&fop_fsemop, NULL, fsemp) != NULL) {
 315  315                  /*
 316  316                   * some other thread beat us to it.
 317  317                   */
 318  318                  fsem_free(fsemp);
 319  319          }
 320  320          return (fop_fsemop);
 321  321  }
 322  322  
 323  323  /*
 324  324   * port_fop_callback()
↓ open down ↓ 755 lines elided ↑ open up ↑
1080 1080          portfop_vp_t *npvp;
1081 1081  
1082 1082          npvp = kmem_zalloc(sizeof (*npvp), KM_SLEEP);
1083 1083          mutex_init(&npvp->pvp_mutex, NULL, MUTEX_DEFAULT, NULL);
1084 1084          list_create(&npvp->pvp_pfoplist, sizeof (portfop_t),
1085 1085              offsetof(portfop_t, pfop_node));
1086 1086          npvp->pvp_vp = vp;
1087 1087          /*
1088 1088           * If v_fopdata is not null, some other thread beat us to it.
1089 1089           */
1090      -        if (casptr(&vp->v_fopdata, NULL, npvp) != NULL) {
     1090 +        if (atomic_cas_ptr(&vp->v_fopdata, NULL, npvp) != NULL) {
1091 1091                  mutex_destroy(&npvp->pvp_mutex);
1092 1092                  list_destroy(&npvp->pvp_pfoplist);
1093 1093                  kmem_free(npvp, sizeof (*npvp));
1094 1094          }
1095 1095  }
1096 1096  
1097 1097  
1098 1098  /*
1099 1099   * Allocate and add a portfop_t to the per port cache. Also add the portfop_t
1100 1100   * to the vnode's list. The association is identified by the object pointer
↓ open down ↓ 1263 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX