Print this page
OS-478 -- lint
OS-249

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libdladm/common/libdlmgmt.c
          +++ new/usr/src/lib/libdladm/common/libdlmgmt.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
       23 + * Copyright (c) 2011, Joyent Inc. All rights reserved.
  23   24   */
  24   25  
  25   26  #include <door.h>
  26   27  #include <errno.h>
  27   28  #include <assert.h>
  28   29  #include <stdio.h>
  29   30  #include <stdlib.h>
  30   31  #include <unistd.h>
  31   32  #include <string.h>
  32   33  #include <strings.h>
↓ open down ↓ 488 lines elided ↑ open up ↑
 521  522          *attrszp = oattrsz;
 522  523          if (oattrsz > attrsz)
 523  524                  return (DLADM_STATUS_TOOSMALL);
 524  525  
 525  526          (void) strlcpy(attr, nvpair_name(nvp), MAXLINKATTRLEN);
 526  527          bcopy(oattrval, attrval, oattrsz);
 527  528          return (DLADM_STATUS_OK);
 528  529  }
 529  530  
 530  531  /*
 531      - * Get the link ID that is associated with the given name.
      532 + * Get the link ID that is associated with the given name in the current zone.
 532  533   */
 533  534  dladm_status_t
 534  535  dladm_name2info(dladm_handle_t handle, const char *link, datalink_id_t *linkidp,
 535  536      uint32_t *flagp, datalink_class_t *classp, uint32_t *mediap)
 536  537  {
      538 +        return (dladm_zname2info(handle, NULL, link, linkidp, flagp, classp,
      539 +           mediap));
      540 +}
      541 +
      542 +/*
      543 + * Get the link ID that is associated with the given zone/name pair.
      544 + */
      545 +dladm_status_t
      546 +dladm_zname2info(dladm_handle_t handle, const char *zonename, const char *link,
      547 +    datalink_id_t *linkidp, uint32_t *flagp, datalink_class_t *classp,
      548 +    uint32_t *mediap)
      549 +{
 537  550          dlmgmt_door_getlinkid_t         getlinkid;
 538  551          dlmgmt_getlinkid_retval_t       retval;
 539  552          datalink_id_t                   linkid;
 540  553          dladm_status_t                  status;
 541  554          size_t                          sz = sizeof (retval);
 542  555  
 543  556          getlinkid.ld_cmd = DLMGMT_CMD_GETLINKID;
 544  557          (void) strlcpy(getlinkid.ld_link, link, MAXLINKNAMELEN);
      558 +        if (zonename != NULL)
      559 +                getlinkid.ld_zoneid = getzoneidbyname(zonename);
      560 +        else
      561 +                getlinkid.ld_zoneid = -1;
 545  562  
 546  563          if ((status = dladm_door_call(handle, &getlinkid, sizeof (getlinkid),
 547  564              &retval, &sz)) != DLADM_STATUS_OK) {
 548  565                  return (status);
 549  566          }
 550  567  
 551  568          linkid = retval.lr_linkid;
 552  569          if (retval.lr_class == DATALINK_CLASS_PHYS &&
 553  570              retval.lr_flags & DLMGMT_ACTIVE) {
 554  571                  /*
↓ open down ↓ 206 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX