Print this page
NEX-3705 Need to update libses with LID/USN code from sesctld
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/scsi/libses/common/ses_node.c
          +++ new/usr/src/lib/scsi/libses/common/ses_node.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  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  /*
  23   23   * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  24   25   */
  25   26  
  26   27  #include <scsi/libses.h>
  27   28  #include "ses_impl.h"
  28   29  
  29   30  #define NEXT_ED(eip)    \
  30      -        ((ses2_ed_impl_t *)((uint8_t *)(eip) +  \
       31 +        ((ses2_ed_impl_t *)((uint8_t *)(eip) +  \
  31   32              ((eip)->st_hdr.sehi_ed_len + sizeof (ses2_ed_hdr_impl_t))))
  32   33  
  33   34  static ses_node_t *
  34   35  ses_find_enclosure(ses_snap_t *sp, uint64_t number)
  35   36  {
  36   37          ses_node_t *np;
  37   38  
  38   39          for (np = sp->ss_root->sn_first_child; np != NULL;
  39   40              np = np->sn_next_sibling) {
  40   41                  ASSERT(np->sn_type == SES_NODE_ENCLOSURE);
↓ open down ↓ 120 lines elided ↑ open up ↑
 161  162          if ((root = ses_node_alloc(sp, sp->ss_root)) == NULL)
 162  163                  return (-1);
 163  164  
 164  165          root->sn_type = SES_NODE_TARGET;
 165  166          SES_NV_ADD(string, err, root->sn_props, SCSI_PROP_VENDOR,
 166  167              libscsi_vendor(sp->ss_target->st_target));
 167  168          SES_NV_ADD(string, err, root->sn_props, SCSI_PROP_PRODUCT,
 168  169              libscsi_product(sp->ss_target->st_target));
 169  170          SES_NV_ADD(string, err, root->sn_props, SCSI_PROP_REVISION,
 170  171              libscsi_revision(sp->ss_target->st_target));
      172 +        if (libscsi_usn(sp->ss_target->st_target) != NULL)
      173 +                SES_NV_ADD(string, err, root->sn_props, SCSI_PROP_USN,
      174 +                    libscsi_usn(sp->ss_target->st_target));
      175 +        if (libscsi_lid(sp->ss_target->st_target) != NULL)
      176 +                SES_NV_ADD(string, err, root->sn_props, SCSI_PROP_LID,
      177 +                    libscsi_lid(sp->ss_target->st_target));
 171  178  
 172  179          for (eip = (ses2_ed_impl_t *)pip->scpi_data, i = 0;
 173  180              i < pip->scpi_n_subenclosures + 1;
 174  181              i++, eip = NEXT_ED(eip)) {
 175  182                  if (!SES_WITHIN_PAGE_STRUCT(eip, pp->ssp_page, pp->ssp_len))
 176  183                          break;
 177  184  
 178  185                  n_etds += eip->st_hdr.sehi_n_etd_hdrs;
 179  186          }
 180  187          ftip = (ses2_td_hdr_impl_t *)eip;
↓ open down ↓ 22 lines elided ↑ open up ↑
 203  210                  np->sn_type = SES_NODE_ENCLOSURE;
 204  211                  np->sn_enc_num = eip->st_hdr.sehi_subenclosure_id;
 205  212  
 206  213                  if (!SES_WITHIN_PAGE(eip, eip->st_hdr.sehi_ed_len +
 207  214                      sizeof (ses2_ed_hdr_impl_t),
 208  215                      pp->ssp_page, pp->ssp_len))
 209  216                          break;
 210  217  
 211  218                  if (enc_parse_ed(eip, np->sn_props) != 0)
 212  219                          return (-1);
      220 +
      221 +                if (libscsi_usn(sp->ss_target->st_target) != NULL)
      222 +                        SES_NV_ADD(string, err, np->sn_props, SCSI_PROP_USN,
      223 +                            libscsi_usn(sp->ss_target->st_target));
      224 +
      225 +                if (libscsi_lid(sp->ss_target->st_target) != NULL)
      226 +                        SES_NV_ADD(string, err, np->sn_props, SCSI_PROP_LID,
      227 +                            libscsi_lid(sp->ss_target->st_target));
 213  228          }
 214  229  
 215  230          if (root->sn_first_child == NULL)
 216  231                  return (ses_error(ESES_BAD_RESPONSE, "no enclosure "
 217  232                      "descriptors found"));
 218  233  
 219  234          tp = (char *)(ftip + n_etds);
 220  235  
 221  236          for (i = 0, toff = 0, idx = eidx = 0; i < n_etds; i++) {
 222  237                  tip = ftip + i;
↓ open down ↓ 192 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX