Print this page
3006 VERIFY[S,U,P] and ASSERT[S,U,P] frequently check if first argument is zero

Split Close
Expand all
Collapse all
          --- old/usr/src/common/nvpair/fnvpair.c
          +++ new/usr/src/common/nvpair/fnvpair.c
↓ open down ↓ 42 lines elided ↑ open up ↑
  43   43   * with KM_SLEEP.
  44   44   *
  45   45   * More wrappers should be added as needed -- for example
  46   46   * nvlist_lookup_*_array and nvpair_value_*_array.
  47   47   */
  48   48  
  49   49  nvlist_t *
  50   50  fnvlist_alloc(void)
  51   51  {
  52   52          nvlist_t *nvl;
  53      -        VERIFY3U(nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_SLEEP), ==, 0);
       53 +        VERIFY0(nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_SLEEP));
  54   54          return (nvl);
  55   55  }
  56   56  
  57   57  void
  58   58  fnvlist_free(nvlist_t *nvl)
  59   59  {
  60   60          nvlist_free(nvl);
  61   61  }
  62   62  
  63   63  size_t
  64   64  fnvlist_size(nvlist_t *nvl)
  65   65  {
  66   66          size_t size;
  67      -        VERIFY3U(nvlist_size(nvl, &size, NV_ENCODE_NATIVE), ==, 0);
       67 +        VERIFY0(nvlist_size(nvl, &size, NV_ENCODE_NATIVE));
  68   68          return (size);
  69   69  }
  70   70  
  71   71  /*
  72   72   * Returns allocated buffer of size *sizep.  Caller must free the buffer with
  73   73   * fnvlist_pack_free().
  74   74   */
  75   75  char *
  76   76  fnvlist_pack(nvlist_t *nvl, size_t *sizep)
  77   77  {
↓ open down ↓ 11 lines elided ↑ open up ↑
  89   89          kmem_free(pack, size);
  90   90  #else
  91   91          free(pack);
  92   92  #endif
  93   93  }
  94   94  
  95   95  nvlist_t *
  96   96  fnvlist_unpack(char *buf, size_t buflen)
  97   97  {
  98   98          nvlist_t *rv;
  99      -        VERIFY3U(nvlist_unpack(buf, buflen, &rv, KM_SLEEP), ==, 0);
       99 +        VERIFY0(nvlist_unpack(buf, buflen, &rv, KM_SLEEP));
 100  100          return (rv);
 101  101  }
 102  102  
 103  103  nvlist_t *
 104  104  fnvlist_dup(nvlist_t *nvl)
 105  105  {
 106  106          nvlist_t *rv;
 107      -        VERIFY3U(nvlist_dup(nvl, &rv, KM_SLEEP), ==, 0);
      107 +        VERIFY0(nvlist_dup(nvl, &rv, KM_SLEEP));
 108  108          return (rv);
 109  109  }
 110  110  
 111  111  void
 112  112  fnvlist_merge(nvlist_t *dst, nvlist_t *src)
 113  113  {
 114      -        VERIFY3U(nvlist_merge(dst, src, KM_SLEEP), ==, 0);
      114 +        VERIFY0(nvlist_merge(dst, src, KM_SLEEP));
 115  115  }
 116  116  
 117  117  void
 118  118  fnvlist_add_boolean(nvlist_t *nvl, const char *name)
 119  119  {
 120      -        VERIFY3U(nvlist_add_boolean(nvl, name), ==, 0);
      120 +        VERIFY0(nvlist_add_boolean(nvl, name));
 121  121  }
 122  122  
 123  123  void
 124  124  fnvlist_add_boolean_value(nvlist_t *nvl, const char *name, boolean_t val)
 125  125  {
 126      -        VERIFY3U(nvlist_add_boolean_value(nvl, name, val), ==, 0);
      126 +        VERIFY0(nvlist_add_boolean_value(nvl, name, val));
 127  127  }
 128  128  
 129  129  void
 130  130  fnvlist_add_byte(nvlist_t *nvl, const char *name, uchar_t val)
 131  131  {
 132      -        VERIFY3U(nvlist_add_byte(nvl, name, val), ==, 0);
      132 +        VERIFY0(nvlist_add_byte(nvl, name, val));
 133  133  }
 134  134  
 135  135  void
 136  136  fnvlist_add_int8(nvlist_t *nvl, const char *name, int8_t val)
 137  137  {
 138      -        VERIFY3U(nvlist_add_int8(nvl, name, val), ==, 0);
      138 +        VERIFY0(nvlist_add_int8(nvl, name, val));
 139  139  }
 140  140  
 141  141  void
 142  142  fnvlist_add_uint8(nvlist_t *nvl, const char *name, uint8_t val)
 143  143  {
 144      -        VERIFY3U(nvlist_add_uint8(nvl, name, val), ==, 0);
      144 +        VERIFY0(nvlist_add_uint8(nvl, name, val));
 145  145  }
 146  146  
 147  147  void
 148  148  fnvlist_add_int16(nvlist_t *nvl, const char *name, int16_t val)
 149  149  {
 150      -        VERIFY3U(nvlist_add_int16(nvl, name, val), ==, 0);
      150 +        VERIFY0(nvlist_add_int16(nvl, name, val));
 151  151  }
 152  152  
 153  153  void
 154  154  fnvlist_add_uint16(nvlist_t *nvl, const char *name, uint16_t val)
 155  155  {
 156      -        VERIFY3U(nvlist_add_uint16(nvl, name, val), ==, 0);
      156 +        VERIFY0(nvlist_add_uint16(nvl, name, val));
 157  157  }
 158  158  
 159  159  void
 160  160  fnvlist_add_int32(nvlist_t *nvl, const char *name, int32_t val)
 161  161  {
 162      -        VERIFY3U(nvlist_add_int32(nvl, name, val), ==, 0);
      162 +        VERIFY0(nvlist_add_int32(nvl, name, val));
 163  163  }
 164  164  
 165  165  void
 166  166  fnvlist_add_uint32(nvlist_t *nvl, const char *name, uint32_t val)
 167  167  {
 168      -        VERIFY3U(nvlist_add_uint32(nvl, name, val), ==, 0);
      168 +        VERIFY0(nvlist_add_uint32(nvl, name, val));
 169  169  }
 170  170  
 171  171  void
 172  172  fnvlist_add_int64(nvlist_t *nvl, const char *name, int64_t val)
 173  173  {
 174      -        VERIFY3U(nvlist_add_int64(nvl, name, val), ==, 0);
      174 +        VERIFY0(nvlist_add_int64(nvl, name, val));
 175  175  }
 176  176  
 177  177  void
 178  178  fnvlist_add_uint64(nvlist_t *nvl, const char *name, uint64_t val)
 179  179  {
 180      -        VERIFY3U(nvlist_add_uint64(nvl, name, val), ==, 0);
      180 +        VERIFY0(nvlist_add_uint64(nvl, name, val));
 181  181  }
 182  182  
 183  183  void
 184  184  fnvlist_add_string(nvlist_t *nvl, const char *name, const char *val)
 185  185  {
 186      -        VERIFY3U(nvlist_add_string(nvl, name, val), ==, 0);
      186 +        VERIFY0(nvlist_add_string(nvl, name, val));
 187  187  }
 188  188  
 189  189  void
 190  190  fnvlist_add_nvlist(nvlist_t *nvl, const char *name, nvlist_t *val)
 191  191  {
 192      -        VERIFY3U(nvlist_add_nvlist(nvl, name, val), ==, 0);
      192 +        VERIFY0(nvlist_add_nvlist(nvl, name, val));
 193  193  }
 194  194  
 195  195  void
 196  196  fnvlist_add_nvpair(nvlist_t *nvl, nvpair_t *pair)
 197  197  {
 198      -        VERIFY3U(nvlist_add_nvpair(nvl, pair), ==, 0);
      198 +        VERIFY0(nvlist_add_nvpair(nvl, pair));
 199  199  }
 200  200  
 201  201  void
 202  202  fnvlist_add_boolean_array(nvlist_t *nvl, const char *name,
 203  203      boolean_t *val, uint_t n)
 204  204  {
 205      -        VERIFY3U(nvlist_add_boolean_array(nvl, name, val, n), ==, 0);
      205 +        VERIFY0(nvlist_add_boolean_array(nvl, name, val, n));
 206  206  }
 207  207  
 208  208  void
 209  209  fnvlist_add_byte_array(nvlist_t *nvl, const char *name, uchar_t *val, uint_t n)
 210  210  {
 211      -        VERIFY3U(nvlist_add_byte_array(nvl, name, val, n), ==, 0);
      211 +        VERIFY0(nvlist_add_byte_array(nvl, name, val, n));
 212  212  }
 213  213  
 214  214  void
 215  215  fnvlist_add_int8_array(nvlist_t *nvl, const char *name, int8_t *val, uint_t n)
 216  216  {
 217      -        VERIFY3U(nvlist_add_int8_array(nvl, name, val, n), ==, 0);
      217 +        VERIFY0(nvlist_add_int8_array(nvl, name, val, n));
 218  218  }
 219  219  
 220  220  void
 221  221  fnvlist_add_uint8_array(nvlist_t *nvl, const char *name, uint8_t *val, uint_t n)
 222  222  {
 223      -        VERIFY3U(nvlist_add_uint8_array(nvl, name, val, n), ==, 0);
      223 +        VERIFY0(nvlist_add_uint8_array(nvl, name, val, n));
 224  224  }
 225  225  
 226  226  void
 227  227  fnvlist_add_int16_array(nvlist_t *nvl, const char *name, int16_t *val, uint_t n)
 228  228  {
 229      -        VERIFY3U(nvlist_add_int16_array(nvl, name, val, n), ==, 0);
      229 +        VERIFY0(nvlist_add_int16_array(nvl, name, val, n));
 230  230  }
 231  231  
 232  232  void
 233  233  fnvlist_add_uint16_array(nvlist_t *nvl, const char *name,
 234  234      uint16_t *val, uint_t n)
 235  235  {
 236      -        VERIFY3U(nvlist_add_uint16_array(nvl, name, val, n), ==, 0);
      236 +        VERIFY0(nvlist_add_uint16_array(nvl, name, val, n));
 237  237  }
 238  238  
 239  239  void
 240  240  fnvlist_add_int32_array(nvlist_t *nvl, const char *name, int32_t *val, uint_t n)
 241  241  {
 242      -        VERIFY3U(nvlist_add_int32_array(nvl, name, val, n), ==, 0);
      242 +        VERIFY0(nvlist_add_int32_array(nvl, name, val, n));
 243  243  }
 244  244  
 245  245  void
 246  246  fnvlist_add_uint32_array(nvlist_t *nvl, const char *name,
 247  247      uint32_t *val, uint_t n)
 248  248  {
 249      -        VERIFY3U(nvlist_add_uint32_array(nvl, name, val, n), ==, 0);
      249 +        VERIFY0(nvlist_add_uint32_array(nvl, name, val, n));
 250  250  }
 251  251  
 252  252  void
 253  253  fnvlist_add_int64_array(nvlist_t *nvl, const char *name, int64_t *val, uint_t n)
 254  254  {
 255      -        VERIFY3U(nvlist_add_int64_array(nvl, name, val, n), ==, 0);
      255 +        VERIFY0(nvlist_add_int64_array(nvl, name, val, n));
 256  256  }
 257  257  
 258  258  void
 259  259  fnvlist_add_uint64_array(nvlist_t *nvl, const char *name,
 260  260      uint64_t *val, uint_t n)
 261  261  {
 262      -        VERIFY3U(nvlist_add_uint64_array(nvl, name, val, n), ==, 0);
      262 +        VERIFY0(nvlist_add_uint64_array(nvl, name, val, n));
 263  263  }
 264  264  
 265  265  void
 266  266  fnvlist_add_string_array(nvlist_t *nvl, const char *name,
 267  267      char * const *val, uint_t n)
 268  268  {
 269      -        VERIFY3U(nvlist_add_string_array(nvl, name, val, n), ==, 0);
      269 +        VERIFY0(nvlist_add_string_array(nvl, name, val, n));
 270  270  }
 271  271  
 272  272  void
 273  273  fnvlist_add_nvlist_array(nvlist_t *nvl, const char *name,
 274  274      nvlist_t **val, uint_t n)
 275  275  {
 276      -        VERIFY3U(nvlist_add_nvlist_array(nvl, name, val, n), ==, 0);
      276 +        VERIFY0(nvlist_add_nvlist_array(nvl, name, val, n));
 277  277  }
 278  278  
 279  279  void
 280  280  fnvlist_remove(nvlist_t *nvl, const char *name)
 281  281  {
 282      -        VERIFY3U(nvlist_remove_all(nvl, name), ==, 0);
      282 +        VERIFY0(nvlist_remove_all(nvl, name));
 283  283  }
 284  284  
 285  285  void
 286  286  fnvlist_remove_nvpair(nvlist_t *nvl, nvpair_t *pair)
 287  287  {
 288      -        VERIFY3U(nvlist_remove_nvpair(nvl, pair), ==, 0);
      288 +        VERIFY0(nvlist_remove_nvpair(nvl, pair));
 289  289  }
 290  290  
 291  291  nvpair_t *
 292  292  fnvlist_lookup_nvpair(nvlist_t *nvl, const char *name)
 293  293  {
 294  294          nvpair_t *rv;
 295      -        VERIFY3U(nvlist_lookup_nvpair(nvl, name, &rv), ==, 0);
      295 +        VERIFY0(nvlist_lookup_nvpair(nvl, name, &rv));
 296  296          return (rv);
 297  297  }
 298  298  
 299  299  /* returns B_TRUE if the entry exists */
 300  300  boolean_t
 301  301  fnvlist_lookup_boolean(nvlist_t *nvl, const char *name)
 302  302  {
 303  303          return (nvlist_lookup_boolean(nvl, name) == 0);
 304  304  }
 305  305  
 306  306  boolean_t
 307  307  fnvlist_lookup_boolean_value(nvlist_t *nvl, const char *name)
 308  308  {
 309  309          boolean_t rv;
 310      -        VERIFY3U(nvlist_lookup_boolean_value(nvl, name, &rv), ==, 0);
      310 +        VERIFY0(nvlist_lookup_boolean_value(nvl, name, &rv));
 311  311          return (rv);
 312  312  }
 313  313  
 314  314  uchar_t
 315  315  fnvlist_lookup_byte(nvlist_t *nvl, const char *name)
 316  316  {
 317  317          uchar_t rv;
 318      -        VERIFY3U(nvlist_lookup_byte(nvl, name, &rv), ==, 0);
      318 +        VERIFY0(nvlist_lookup_byte(nvl, name, &rv));
 319  319          return (rv);
 320  320  }
 321  321  
 322  322  int8_t
 323  323  fnvlist_lookup_int8(nvlist_t *nvl, const char *name)
 324  324  {
 325  325          int8_t rv;
 326      -        VERIFY3U(nvlist_lookup_int8(nvl, name, &rv), ==, 0);
      326 +        VERIFY0(nvlist_lookup_int8(nvl, name, &rv));
 327  327          return (rv);
 328  328  }
 329  329  
 330  330  int16_t
 331  331  fnvlist_lookup_int16(nvlist_t *nvl, const char *name)
 332  332  {
 333  333          int16_t rv;
 334      -        VERIFY3U(nvlist_lookup_int16(nvl, name, &rv), ==, 0);
      334 +        VERIFY0(nvlist_lookup_int16(nvl, name, &rv));
 335  335          return (rv);
 336  336  }
 337  337  
 338  338  int32_t
 339  339  fnvlist_lookup_int32(nvlist_t *nvl, const char *name)
 340  340  {
 341  341          int32_t rv;
 342      -        VERIFY3U(nvlist_lookup_int32(nvl, name, &rv), ==, 0);
      342 +        VERIFY0(nvlist_lookup_int32(nvl, name, &rv));
 343  343          return (rv);
 344  344  }
 345  345  
 346  346  int64_t
 347  347  fnvlist_lookup_int64(nvlist_t *nvl, const char *name)
 348  348  {
 349  349          int64_t rv;
 350      -        VERIFY3U(nvlist_lookup_int64(nvl, name, &rv), ==, 0);
      350 +        VERIFY0(nvlist_lookup_int64(nvl, name, &rv));
 351  351          return (rv);
 352  352  }
 353  353  
 354  354  uint8_t
 355  355  fnvlist_lookup_uint8_t(nvlist_t *nvl, const char *name)
 356  356  {
 357  357          uint8_t rv;
 358      -        VERIFY3U(nvlist_lookup_uint8(nvl, name, &rv), ==, 0);
      358 +        VERIFY0(nvlist_lookup_uint8(nvl, name, &rv));
 359  359          return (rv);
 360  360  }
 361  361  
 362  362  uint16_t
 363  363  fnvlist_lookup_uint16(nvlist_t *nvl, const char *name)
 364  364  {
 365  365          uint16_t rv;
 366      -        VERIFY3U(nvlist_lookup_uint16(nvl, name, &rv), ==, 0);
      366 +        VERIFY0(nvlist_lookup_uint16(nvl, name, &rv));
 367  367          return (rv);
 368  368  }
 369  369  
 370  370  uint32_t
 371  371  fnvlist_lookup_uint32(nvlist_t *nvl, const char *name)
 372  372  {
 373  373          uint32_t rv;
 374      -        VERIFY3U(nvlist_lookup_uint32(nvl, name, &rv), ==, 0);
      374 +        VERIFY0(nvlist_lookup_uint32(nvl, name, &rv));
 375  375          return (rv);
 376  376  }
 377  377  
 378  378  uint64_t
 379  379  fnvlist_lookup_uint64(nvlist_t *nvl, const char *name)
 380  380  {
 381  381          uint64_t rv;
 382      -        VERIFY3U(nvlist_lookup_uint64(nvl, name, &rv), ==, 0);
      382 +        VERIFY0(nvlist_lookup_uint64(nvl, name, &rv));
 383  383          return (rv);
 384  384  }
 385  385  
 386  386  char *
 387  387  fnvlist_lookup_string(nvlist_t *nvl, const char *name)
 388  388  {
 389  389          char *rv;
 390      -        VERIFY3U(nvlist_lookup_string(nvl, name, &rv), ==, 0);
      390 +        VERIFY0(nvlist_lookup_string(nvl, name, &rv));
 391  391          return (rv);
 392  392  }
 393  393  
 394  394  nvlist_t *
 395  395  fnvlist_lookup_nvlist(nvlist_t *nvl, const char *name)
 396  396  {
 397  397          nvlist_t *rv;
 398      -        VERIFY3U(nvlist_lookup_nvlist(nvl, name, &rv), ==, 0);
      398 +        VERIFY0(nvlist_lookup_nvlist(nvl, name, &rv));
 399  399          return (rv);
 400  400  }
 401  401  
 402  402  boolean_t
 403  403  fnvpair_value_boolean_value(nvpair_t *nvp)
 404  404  {
 405  405          boolean_t rv;
 406      -        VERIFY3U(nvpair_value_boolean_value(nvp, &rv), ==, 0);
      406 +        VERIFY0(nvpair_value_boolean_value(nvp, &rv));
 407  407          return (rv);
 408  408  }
 409  409  
 410  410  uchar_t
 411  411  fnvpair_value_byte(nvpair_t *nvp)
 412  412  {
 413  413          uchar_t rv;
 414      -        VERIFY3U(nvpair_value_byte(nvp, &rv), ==, 0);
      414 +        VERIFY0(nvpair_value_byte(nvp, &rv));
 415  415          return (rv);
 416  416  }
 417  417  
 418  418  int8_t
 419  419  fnvpair_value_int8(nvpair_t *nvp)
 420  420  {
 421  421          int8_t rv;
 422      -        VERIFY3U(nvpair_value_int8(nvp, &rv), ==, 0);
      422 +        VERIFY0(nvpair_value_int8(nvp, &rv));
 423  423          return (rv);
 424  424  }
 425  425  
 426  426  int16_t
 427  427  fnvpair_value_int16(nvpair_t *nvp)
 428  428  {
 429  429          int16_t rv;
 430      -        VERIFY3U(nvpair_value_int16(nvp, &rv), ==, 0);
      430 +        VERIFY0(nvpair_value_int16(nvp, &rv));
 431  431          return (rv);
 432  432  }
 433  433  
 434  434  int32_t
 435  435  fnvpair_value_int32(nvpair_t *nvp)
 436  436  {
 437  437          int32_t rv;
 438      -        VERIFY3U(nvpair_value_int32(nvp, &rv), ==, 0);
      438 +        VERIFY0(nvpair_value_int32(nvp, &rv));
 439  439          return (rv);
 440  440  }
 441  441  
 442  442  int64_t
 443  443  fnvpair_value_int64(nvpair_t *nvp)
 444  444  {
 445  445          int64_t rv;
 446      -        VERIFY3U(nvpair_value_int64(nvp, &rv), ==, 0);
      446 +        VERIFY0(nvpair_value_int64(nvp, &rv));
 447  447          return (rv);
 448  448  }
 449  449  
 450  450  uint8_t
 451  451  fnvpair_value_uint8_t(nvpair_t *nvp)
 452  452  {
 453  453          uint8_t rv;
 454      -        VERIFY3U(nvpair_value_uint8(nvp, &rv), ==, 0);
      454 +        VERIFY0(nvpair_value_uint8(nvp, &rv));
 455  455          return (rv);
 456  456  }
 457  457  
 458  458  uint16_t
 459  459  fnvpair_value_uint16(nvpair_t *nvp)
 460  460  {
 461  461          uint16_t rv;
 462      -        VERIFY3U(nvpair_value_uint16(nvp, &rv), ==, 0);
      462 +        VERIFY0(nvpair_value_uint16(nvp, &rv));
 463  463          return (rv);
 464  464  }
 465  465  
 466  466  uint32_t
 467  467  fnvpair_value_uint32(nvpair_t *nvp)
 468  468  {
 469  469          uint32_t rv;
 470      -        VERIFY3U(nvpair_value_uint32(nvp, &rv), ==, 0);
      470 +        VERIFY0(nvpair_value_uint32(nvp, &rv));
 471  471          return (rv);
 472  472  }
 473  473  
 474  474  uint64_t
 475  475  fnvpair_value_uint64(nvpair_t *nvp)
 476  476  {
 477  477          uint64_t rv;
 478      -        VERIFY3U(nvpair_value_uint64(nvp, &rv), ==, 0);
      478 +        VERIFY0(nvpair_value_uint64(nvp, &rv));
 479  479          return (rv);
 480  480  }
 481  481  
 482  482  char *
 483  483  fnvpair_value_string(nvpair_t *nvp)
 484  484  {
 485  485          char *rv;
 486      -        VERIFY3U(nvpair_value_string(nvp, &rv), ==, 0);
      486 +        VERIFY0(nvpair_value_string(nvp, &rv));
 487  487          return (rv);
 488  488  }
 489  489  
 490  490  nvlist_t *
 491  491  fnvpair_value_nvlist(nvpair_t *nvp)
 492  492  {
 493  493          nvlist_t *rv;
 494      -        VERIFY3U(nvpair_value_nvlist(nvp, &rv), ==, 0);
      494 +        VERIFY0(nvpair_value_nvlist(nvp, &rv));
 495  495          return (rv);
 496  496  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX