Print this page
7558 libscf.h should provide constants for scf_type_to_string return values

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libscf/common/lowlevel.c
          +++ new/usr/src/lib/libscf/common/lowlevel.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  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) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   * Copyright 2013, Joyent, Inc. All rights reserved.
       25 + * Copyright 2016 RackTop Systems.
  25   26   */
  26   27  
  27   28  /*
  28   29   * This is the main implementation file for the low-level repository
  29   30   * interface.
  30   31   */
  31   32  
  32   33  #include "lowlevel_impl.h"
  33   34  
  34   35  #include "repcache_protocol.h"
↓ open down ↓ 250 lines elided ↑ open up ↑
 285  286          if (lowlevel_inited > 0)
 286  287                  return (1);
 287  288          return (0);
 288  289  }
 289  290  
 290  291  static const struct {
 291  292          scf_type_t ti_type;
 292  293          rep_protocol_value_type_t ti_proto_type;
 293  294          const char *ti_name;
 294  295  } scf_type_info[] = {
 295      -        {SCF_TYPE_BOOLEAN,      REP_PROTOCOL_TYPE_BOOLEAN,      "boolean"},
 296      -        {SCF_TYPE_COUNT,        REP_PROTOCOL_TYPE_COUNT,        "count"},
 297      -        {SCF_TYPE_INTEGER,      REP_PROTOCOL_TYPE_INTEGER,      "integer"},
 298      -        {SCF_TYPE_TIME,         REP_PROTOCOL_TYPE_TIME,         "time"},
 299      -        {SCF_TYPE_ASTRING,      REP_PROTOCOL_TYPE_STRING,       "astring"},
 300      -        {SCF_TYPE_OPAQUE,       REP_PROTOCOL_TYPE_OPAQUE,       "opaque"},
 301      -        {SCF_TYPE_USTRING,      REP_PROTOCOL_SUBTYPE_USTRING,   "ustring"},
 302      -        {SCF_TYPE_URI,          REP_PROTOCOL_SUBTYPE_URI,       "uri"},
 303      -        {SCF_TYPE_FMRI,         REP_PROTOCOL_SUBTYPE_FMRI,      "fmri"},
 304      -        {SCF_TYPE_HOST,         REP_PROTOCOL_SUBTYPE_HOST,      "host"},
 305      -        {SCF_TYPE_HOSTNAME,     REP_PROTOCOL_SUBTYPE_HOSTNAME,  "hostname"},
 306      -        {SCF_TYPE_NET_ADDR,     REP_PROTOCOL_SUBTYPE_NETADDR,   "net_address"},
      296 +        {SCF_TYPE_BOOLEAN,      REP_PROTOCOL_TYPE_BOOLEAN,
      297 +            SCF_TYPE_STRING_BOOLEAN},
      298 +        {SCF_TYPE_COUNT,        REP_PROTOCOL_TYPE_COUNT,
      299 +            SCF_TYPE_STRING_COUNT},
      300 +        {SCF_TYPE_INTEGER,      REP_PROTOCOL_TYPE_INTEGER,
      301 +            SCF_TYPE_STRING_INTEGER},
      302 +        {SCF_TYPE_TIME,         REP_PROTOCOL_TYPE_TIME,
      303 +            SCF_TYPE_STRING_TIME},
      304 +        {SCF_TYPE_ASTRING,      REP_PROTOCOL_TYPE_STRING,
      305 +            SCF_TYPE_STRING_ASTRING},
      306 +        {SCF_TYPE_OPAQUE,       REP_PROTOCOL_TYPE_OPAQUE,
      307 +            SCF_TYPE_STRING_OPAQUE},
      308 +        {SCF_TYPE_USTRING,      REP_PROTOCOL_SUBTYPE_USTRING,
      309 +            SCF_TYPE_STRING_USTRING},
      310 +        {SCF_TYPE_URI,          REP_PROTOCOL_SUBTYPE_URI,
      311 +            SCF_TYPE_STRING_URI},
      312 +        {SCF_TYPE_FMRI,         REP_PROTOCOL_SUBTYPE_FMRI,
      313 +            SCF_TYPE_STRING_FMRI},
      314 +        {SCF_TYPE_HOST,         REP_PROTOCOL_SUBTYPE_HOST,
      315 +            SCF_TYPE_STRING_HOST},
      316 +        {SCF_TYPE_HOSTNAME,     REP_PROTOCOL_SUBTYPE_HOSTNAME,
      317 +            SCF_TYPE_STRING_HOSTNAME},
      318 +        {SCF_TYPE_NET_ADDR,     REP_PROTOCOL_SUBTYPE_NETADDR,
      319 +            SCF_TYPE_STRING_NET_ADDR},
 307  320          {SCF_TYPE_NET_ADDR_V4,  REP_PROTOCOL_SUBTYPE_NETADDR_V4,
 308      -            "net_address_v4"},
      321 +            SCF_TYPE_STRING_NET_ADDR_V4},
 309  322          {SCF_TYPE_NET_ADDR_V6,  REP_PROTOCOL_SUBTYPE_NETADDR_V6,
 310      -            "net_address_v6"}
      323 +            SCF_TYPE_STRING_NET_ADDR_V6}
 311  324  };
 312  325  
 313  326  #define SCF_TYPE_INFO_COUNT (sizeof (scf_type_info) / sizeof (*scf_type_info))
 314  327  static rep_protocol_value_type_t
 315  328  scf_type_to_protocol_type(scf_type_t t)
 316  329  {
 317  330          int i;
 318  331  
 319  332          for (i = 0; i < SCF_TYPE_INFO_COUNT; i++)
 320  333                  if (scf_type_info[i].ti_type == t)
↓ open down ↓ 7139 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX