5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25
26 #ifndef _LIBTOPO_H
27 #define _LIBTOPO_H
28
29 #include <sys/nvpair.h>
30 #include <stdio.h>
31 #include <libdevinfo.h>
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 #define TOPO_VERSION 1 /* Library ABI Interface Version */
38
39 typedef struct topo_hdl topo_hdl_t;
40 typedef struct topo_node tnode_t;
41 typedef struct topo_walk topo_walk_t;
42 typedef int32_t topo_instance_t;
43 typedef uint32_t topo_version_t;
44
372 #define TOPO_PROP_VAL "property"
373 #define TOPO_PROP_VAL_NAME "property-name"
374 #define TOPO_PROP_VAL_VAL "property-value"
375 #define TOPO_PROP_VAL_TYPE "property-type"
376 #define TOPO_PROP_FLAG "property-flag"
377
378 /*
379 * ARGS list used in topo property methods
380 */
381 #define TOPO_PROP_ARGS "args"
382 #define TOPO_PROP_PARGS "private-args"
383
384 extern int topo_xml_print(topo_hdl_t *, FILE *, const char *scheme, int *);
385
386 extern void *topo_hdl_alloc(topo_hdl_t *, size_t);
387 extern void *topo_hdl_zalloc(topo_hdl_t *, size_t);
388 extern void topo_hdl_free(topo_hdl_t *, void *, size_t);
389 extern int topo_hdl_nvalloc(topo_hdl_t *, nvlist_t **, uint_t);
390 extern int topo_hdl_nvdup(topo_hdl_t *, nvlist_t *, nvlist_t **);
391 extern char *topo_hdl_strdup(topo_hdl_t *, const char *);
392
393 /*
394 * Interfaces for converting sensor/indicator types, units, states, etc to
395 * a string
396 */
397 void topo_sensor_type_name(uint32_t type, char *buf, size_t len);
398 void topo_sensor_units_name(uint8_t type, char *buf, size_t len);
399 void topo_led_type_name(uint8_t type, char *buf, size_t len);
400 void topo_led_state_name(uint8_t type, char *buf, size_t len);
401 void topo_sensor_state_name(uint32_t sensor_type, uint8_t state, char *buf,
402 size_t len);
403
404 /*
405 * Defines for standard properties for sensors and indicators
406 */
407 #define TOPO_PGROUP_FACILITY "facility"
408
409 #define TOPO_SENSOR_READING "reading"
410 #define TOPO_SENSOR_STATE "state"
411 #define TOPO_SENSOR_CLASS "sensor-class"
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
24 */
25 /*
26 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
27 */
28
29 #ifndef _LIBTOPO_H
30 #define _LIBTOPO_H
31
32 #include <sys/nvpair.h>
33 #include <stdio.h>
34 #include <libdevinfo.h>
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 #define TOPO_VERSION 1 /* Library ABI Interface Version */
41
42 typedef struct topo_hdl topo_hdl_t;
43 typedef struct topo_node tnode_t;
44 typedef struct topo_walk topo_walk_t;
45 typedef int32_t topo_instance_t;
46 typedef uint32_t topo_version_t;
47
375 #define TOPO_PROP_VAL "property"
376 #define TOPO_PROP_VAL_NAME "property-name"
377 #define TOPO_PROP_VAL_VAL "property-value"
378 #define TOPO_PROP_VAL_TYPE "property-type"
379 #define TOPO_PROP_FLAG "property-flag"
380
381 /*
382 * ARGS list used in topo property methods
383 */
384 #define TOPO_PROP_ARGS "args"
385 #define TOPO_PROP_PARGS "private-args"
386
387 extern int topo_xml_print(topo_hdl_t *, FILE *, const char *scheme, int *);
388
389 extern void *topo_hdl_alloc(topo_hdl_t *, size_t);
390 extern void *topo_hdl_zalloc(topo_hdl_t *, size_t);
391 extern void topo_hdl_free(topo_hdl_t *, void *, size_t);
392 extern int topo_hdl_nvalloc(topo_hdl_t *, nvlist_t **, uint_t);
393 extern int topo_hdl_nvdup(topo_hdl_t *, nvlist_t *, nvlist_t **);
394 extern char *topo_hdl_strdup(topo_hdl_t *, const char *);
395 extern char *topo_hdl_strsplit(topo_hdl_t *, const char *, const char *,
396 char **);
397
398 /*
399 * Interfaces for converting sensor/indicator types, units, states, etc to
400 * a string
401 */
402 void topo_sensor_type_name(uint32_t type, char *buf, size_t len);
403 void topo_sensor_units_name(uint8_t type, char *buf, size_t len);
404 void topo_led_type_name(uint8_t type, char *buf, size_t len);
405 void topo_led_state_name(uint8_t type, char *buf, size_t len);
406 void topo_sensor_state_name(uint32_t sensor_type, uint8_t state, char *buf,
407 size_t len);
408
409 /*
410 * Defines for standard properties for sensors and indicators
411 */
412 #define TOPO_PGROUP_FACILITY "facility"
413
414 #define TOPO_SENSOR_READING "reading"
415 #define TOPO_SENSOR_STATE "state"
416 #define TOPO_SENSOR_CLASS "sensor-class"
|