Print this page
5218 posix definition of NULL
correct unistd.h and iso/stddef_iso.h
update gate source affected

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mdb/common/modules/usba/usb.c
          +++ new/usr/src/cmd/mdb/common/modules/usba/usb.c
↓ open down ↓ 90 lines elided ↑ open up ↑
  91   91   * to the desired usba_device_t* is found.
  92   92   */
  93   93  /*ARGSUSED*/
  94   94  static int
  95   95  find_dip(uintptr_t dip_addr, const void *local_dip, void *cb_arg)
  96   96  {
  97   97          uintptr_t                       cur_usb_dev;
  98   98          usba_device2devinfo_cbdata_t    *cb_data =
  99   99                              (usba_device2devinfo_cbdata_t *)cb_arg;
 100  100  
 101      -        if ((cur_usb_dev = mdb_usba_get_usba_device(dip_addr)) == NULL) {
      101 +        if ((cur_usb_dev = mdb_usba_get_usba_device(dip_addr)) == (uintptr_t)NULL) {
 102  102                  /*
 103  103                   * If there's no corresponding usba_device_t, this dip isn't
 104  104                   * a usb node.  Might be an sd node.  Ignore it.
 105  105                   */
 106  106  
 107  107                  return (WALK_NEXT);
 108  108          }
 109  109  
 110  110          if (cur_usb_dev == cb_data->u2d_target_usb_dev_p) {
 111  111                  *cb_data->u2d_dip_addr = dip_addr;
↓ open down ↓ 63 lines elided ↑ open up ↑
 175  175  
 176  176  
 177  177  /*
 178  178   * Generic walker usba_list_entry_t walker.
 179  179   * Works for any usba_list_entry_t list.
 180  180   */
 181  181  int
 182  182  usba_list_walk_init(mdb_walk_state_t *wsp)
 183  183  {
 184  184          /* Must have a start addr.  */
 185      -        if (wsp->walk_addr == NULL) {
      185 +        if (wsp->walk_addr == (uintptr_t)NULL) {
 186  186                  mdb_warn("not a global walk.  Starting address required\n");
 187  187  
 188  188                  return (WALK_ERR);
 189  189          }
 190  190  
 191  191          return (WALK_NEXT);
 192  192  }
 193  193  
 194  194  
 195  195  /*
↓ open down ↓ 12 lines elided ↑ open up ↑
 208  208                      wsp->walk_addr);
 209  209  
 210  210                  return (WALK_ERR);
 211  211          }
 212  212  
 213  213          status = wsp->walk_callback(wsp->walk_addr, &list_entry,
 214  214              wsp->walk_cbdata);
 215  215          wsp->walk_addr = (uintptr_t)list_entry.next;
 216  216  
 217  217          /* Check if we're at the last element */
 218      -        if (wsp->walk_addr == NULL) {
      218 +        if (wsp->walk_addr == (uintptr_t)NULL) {
 219  219  
 220  220                  return (WALK_DONE);
 221  221          }
 222  222  
 223  223          return (status);
 224  224  }
 225  225  
 226  226  
 227  227  /*
 228  228   * usb_pipe_handle walker
↓ open down ↓ 1 lines elided ↑ open up ↑
 230  230   * pipe_handle lists.
 231  231   * For each list, traverse the list, invoking the callback on each element.
 232  232   *
 233  233   * Note this function takes the address of a usba_device struct (which is
 234  234   * easily obtainable), but actually traverses a sub-portion of the struct
 235  235   * (which address is not so easily obtainable).
 236  236   */
 237  237  int
 238  238  usb_pipe_handle_walk_init(mdb_walk_state_t *wsp)
 239  239  {
 240      -        if (wsp->walk_addr == NULL) {
      240 +        if (wsp->walk_addr == (uintptr_t)NULL) {
 241  241                  mdb_warn("not a global walk; usba_device_t required\n");
 242  242  
 243  243                  return (WALK_ERR);
 244  244          }
 245  245  
 246  246          wsp->walk_data = mdb_alloc((sizeof (usba_ph_impl_t)) * USBA_N_ENDPOINTS,
 247  247                                          UM_SLEEP | UM_GC);
 248  248  
 249  249          /*
 250  250           * Read the usb_ph_list array into local memory.
↓ open down ↓ 145 lines elided ↑ open up ↑
 396  396   *
 397  397   * walks the chain of usba_device structs headed by usba_device_list in usba.c
 398  398   * NOTE: It uses the generic list walk step routine usba_list_walk_step.
 399  399   * No walk_fini routine is needed.
 400  400   */
 401  401  int
 402  402  usba_device_walk_init(mdb_walk_state_t *wsp)
 403  403  {
 404  404          usba_list_entry_t       list_entry;
 405  405  
 406      -        if (wsp->walk_addr != NULL) {
      406 +        if (wsp->walk_addr != (uintptr_t)NULL) {
 407  407                  mdb_warn(
 408  408                      "global walk only.  Must be invoked without an address\n");
 409  409  
 410  410                  return (WALK_ERR);
 411  411          }
 412  412  
 413  413          if (mdb_readvar(&list_entry, "usba_device_list") == -1) {
 414  414                  mdb_warn("failed to read usba_device_list");
 415  415  
 416  416                  return (WALK_ERR);
↓ open down ↓ 13 lines elided ↑ open up ↑
 430  430   *      -p:     Walk/dump all open pipes for this usba_device
 431  431   */
 432  432  /*ARGSUSED*/
 433  433  int
 434  434  usba_device(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
 435  435  {
 436  436          int             status;
 437  437          char            pathname[MAXNAMELEN];
 438  438          char            dname[MODMAXNAMELEN + 1] = "<unatt>"; /* Driver name */
 439  439          char            drv_statep[MODMAXNAMELEN+ 10];
 440      -        uint_t          usb_flag  = NULL;
      440 +        uint_t          usb_flag  = 0;
 441  441          boolean_t       no_driver_attached = FALSE;
 442  442          uintptr_t       dip_addr;
 443  443          struct dev_info devinfo;
 444  444  
 445  445          if (!(flags & DCMD_ADDRSPEC)) {
 446  446                  /* Global walk */
 447  447                  if (mdb_walk_dcmd("usba_device", "usba_device", argc,
 448  448                      argv) == -1) {
 449  449                          mdb_warn("failed to walk usba_device");
 450  450  
↓ open down ↓ 51 lines elided ↑ open up ↑
 502  502          if (!(DDI_CF2(&devinfo))) {
 503  503                  no_driver_attached = TRUE;
 504  504          }
 505  505  
 506  506          (void) mdb_ddi_pathname(dip_addr, pathname, sizeof (pathname));
 507  507          mdb_printf("%-15s %2d   %-?p %s\n", dname, devinfo.devi_instance,
 508  508              dip_addr, pathname);
 509  509  
 510  510          if (usb_flag & USB_DUMP_VERBOSE) {
 511  511                  int             i;
 512      -                uintptr_t       statep = NULL;
      512 +                uintptr_t       statep = (uintptr_t)NULL;
 513  513                  char            *string_descr;
 514  514                  char            **config_cloud, **conf_str_descr;
 515  515                  usb_dev_descr_t usb_dev_descr;
 516  516                  usba_device_t   usba_device_struct;
 517  517  
 518  518                  if (mdb_vread(&usba_device_struct,
 519  519                      sizeof (usba_device_t), addr) == -1) {
 520  520                          mdb_warn("failed to read usba_device struct");
 521  521  
 522  522                          return (DCMD_ERR);
↓ open down ↓ 187 lines elided ↑ open up ↑
 710  710  
 711  711          if ((mdb_vread(local_debug_buf, debug_buf_size,
 712  712              (uintptr_t)debug_buf_addr)) == -1) {
 713  713                  mdb_warn("failed to read usba_debug_buf at %p",
 714  714                      local_debug_buf);
 715  715  
 716  716                  return (DCMD_ERR);
 717  717          }
 718  718          local_debug_buf[debug_buf_size - 1] = '\0';
 719  719  
 720      -        if (strlen(local_debug_buf) == NULL) {
      720 +        if (strlen(local_debug_buf) == 0) {
 721  721  
 722  722                  return (DCMD_OK);
 723  723          }
 724  724  
 725  725          if ((term_p = strstr(local_debug_buf, ">>>>")) == NULL) {
 726  726                  mdb_warn("failed to find terminator \">>>>\"\n");
 727  727  
 728  728                  return (DCMD_ERR);
 729  729          }
 730  730  
↓ open down ↓ 73 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX