2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _LIBHOTPLUG_H
2N/A#define _LIBHOTPLUG_H
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#include <sys/types.h>
2N/A
2N/A/*
2N/A * Define node types in hotplug snapshot.
2N/A */
2N/A#define HP_NODE_NONE 0
2N/A#define HP_NODE_DEVICE 1
2N/A#define HP_NODE_CONNECTOR 2
2N/A#define HP_NODE_PORT 3
2N/A#define HP_NODE_USAGE 4
2N/A
2N/A/*
2N/A * Define flags for hp_init().
2N/A */
2N/A#define HPINFOUSAGE 0x1
2N/A#define HPINFOSEARCH 0x2 /* private flag */
2N/A
2N/A/*
2N/A * Define flags for hp_set_state(), hp_install(), and hp_uninstall().
2N/A */
2N/A#define HPFORCE 0x4
2N/A#define HPQUERY 0x8
2N/A#define HPPROBEONE 0x10
2N/A
2N/A/*
2N/A * Define return values for hp_traverse() callbacks.
2N/A */
2N/A#define HP_WALK_CONTINUE 0
2N/A#define HP_WALK_PRUNECHILD 1
2N/A#define HP_WALK_PRUNESIBLING 2
2N/A#define HP_WALK_TERMINATE 3
2N/A
2N/A/*
2N/A * Define opaque handle to hotplug nodes.
2N/A */
2N/Atypedef struct hp_node *hp_node_t;
2N/A
2N/A/*
2N/A * Interface prototypes.
2N/A */
2N/Ahp_node_t hp_init(const char *path, const char *connection, uint_t flags);
2N/Avoid hp_fini(hp_node_t root);
2N/Aint hp_traverse(hp_node_t root, void *arg,
2N/A int (*hp_callback)(hp_node_t, void *arg));
2N/Aint hp_type(hp_node_t node);
2N/Achar *hp_name(hp_node_t node);
2N/Achar *hp_usage(hp_node_t node);
2N/Achar *hp_driver(hp_node_t node);
2N/Aint hp_instance(hp_node_t node);
2N/Aint hp_state(hp_node_t node);
2N/Achar *hp_state_priv(hp_node_t node);
2N/Achar *hp_description(hp_node_t node);
2N/Atime_t hp_last_change(hp_node_t node);
2N/Ahp_node_t hp_parent(hp_node_t node);
2N/Ahp_node_t hp_child(hp_node_t node);
2N/Ahp_node_t hp_sibling(hp_node_t node);
2N/Aint hp_path(hp_node_t node, char *path, char *connection);
2N/Aint hp_set_state(hp_node_t node, uint_t flags, int state,
2N/A const char *state_priv, hp_node_t *resultsp);
2N/Aint hp_set_private(hp_node_t node, const char *options,
2N/A char **resultsp);
2N/Aint hp_get_private(hp_node_t node, const char *options,
2N/A char **resultsp);
2N/Aint hp_install(hp_node_t node, uint_t flags, hp_node_t *resultsp);
2N/Aint hp_uninstall(hp_node_t node, uint_t flags, hp_node_t *resultsp);
2N/Aint hp_create_port(hp_node_t node, const char *cn_name,
2N/A hp_node_t *resultsp);
2N/Aint hp_remove_port(hp_node_t node, hp_node_t *resultsp);
2N/Aint hp_state_ceiling(hp_node_t node);
2N/Aint hp_set_state_ceiling(hp_node_t node, int state,
2N/A uint32_t *handlep, hp_node_t *resultsp);
2N/Aint hp_clear_state_ceiling(hp_node_t node, uint32_t handle,
2N/A int flags, hp_node_t *resultsp);
2N/Aint hp_pack(hp_node_t root, char **bufp, size_t *lenp);
2N/Aint hp_unpack(char *packed_buf, size_t packed_len, hp_node_t *retp);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _LIBHOTPLUG_H */