1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 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 2009 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _LIBHOTPLUG_IMPL_H 28 #define _LIBHOTPLUG_IMPL_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #include <sys/param.h> 35 #include <libhotplug.h> 36 37 /* 38 * Definition of a node in a hotplug information snapshot. 39 */ 40 struct hp_node { 41 int hp_type; 42 char *hp_name; 43 char *hp_usage; 44 char *hp_description; 45 char *hp_basepath; 46 int hp_state; 47 time_t hp_last_change; 48 hp_node_t hp_parent; 49 hp_node_t hp_child; 50 hp_node_t hp_sibling; 51 }; 52 53 /* 54 * Definitions used for packing/unpacking snapshots. 55 */ 56 #define HP_INFO_BASE "hp_info.basepath" 57 #define HP_INFO_NODE "hp_info.node" 58 #define HP_INFO_BRANCH "hp_info.branch" 59 #define HP_INFO_TYPE "hp_info.type" 60 #define HP_INFO_NAME "hp_info.name" 61 #define HP_INFO_USAGE "hp_info.usage" 62 #define HP_INFO_STATE "hp_info.state" 63 #define HP_INFO_DESC "hp_info.description" 64 #define HP_INFO_TIME "hp_info.last_change" 65 66 /* 67 * Definitions for the door interface to hotplugd(8). 68 */ 69 #define HOTPLUGD_PID "/var/run/hotplugd.pid" 70 #define HOTPLUGD_DOOR "/var/run/hotplugd_door" 71 72 typedef enum { 73 HP_CMD_NONE = 0, 74 HP_CMD_GETINFO, 75 HP_CMD_CHANGESTATE, 76 HP_CMD_SETPRIVATE, 77 HP_CMD_GETPRIVATE 78 } hp_cmd_t; 79 80 #define HPD_CMD "hp_door.cmd" 81 #define HPD_PATH "hp_door.path" 82 #define HPD_CONNECTION "hp_door.connection" 83 #define HPD_FLAGS "hp_door.flags" 84 #define HPD_STATE "hp_door.state" 85 #define HPD_OPTIONS "hp_door.options" 86 #define HPD_INFO "hp_door.info" 87 #define HPD_STATUS "hp_door.status" 88 #define HPD_SEQNUM "hp_door.seqnum" 89 90 /* 91 * Definition of macros to validate flags. 92 */ 93 #define HP_INIT_FLAGS_VALID(f) ((f & ~(HPINFOUSAGE)) == 0) 94 #define HP_SET_STATE_FLAGS_VALID(f) ((f & ~(HPFORCE | HPQUERY)) == 0) 95 96 /* 97 * Definition of global flag to enable debug. 98 */ 99 extern int libhotplug_debug; 100 101 #ifdef __cplusplus 102 } 103 #endif 104 105 #endif /* _LIBHOTPLUG_IMPL_H */ 106