xref: /titanic_41/usr/src/lib/librestart/common/librestart_priv.h (revision 6a634c9dca3093f3922e4b7ab826d7bdf17bf78e)
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  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef	_LIBRESTART_PRIV_H
26 #define	_LIBRESTART_PRIV_H
27 
28 #include <libscf.h>
29 #include <librestart.h>
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #define	RESTARTER_NAME_TYPE		SCF_PROPERTY_TYPE
36 #define	RESTARTER_NAME_INSTANCE		"inst"
37 #define	RESTARTER_NAME_STATE		SCF_PROPERTY_STATE
38 #define	RESTARTER_NAME_NEXT_STATE	SCF_PROPERTY_NEXT_STATE
39 #define	RESTARTER_NAME_AUX_STATE	SCF_PROPERTY_AUX_STATE
40 #define	RESTARTER_NAME_ERROR		"error"
41 #define	RESTARTER_NAME_REASON		"reason"
42 
43 #define	RESTARTER_CHANNEL_MASTER	0
44 #define	RESTARTER_CHANNEL_DELEGATE	1
45 
46 typedef struct instance_data {
47 	const char			*i_fmri;
48 	int				i_enabled;
49 
50 	restarter_instance_state_t	i_state;
51 	restarter_instance_state_t	i_next_state;
52 	char				*i_aux_state;
53 
54 	ctid_t				i_primary_ctid;
55 	ctid_t				i_transient_ctid;
56 
57 	int				i_primary_ctid_stopped;
58 	int				i_fault_count;
59 	int				i_dirty;
60 } instance_data_t;
61 
62 char *_restarter_get_channel_name(const char *, int);
63 int _restarter_commit_states(scf_handle_t *, instance_data_t *,
64     restarter_instance_state_t, restarter_instance_state_t, const char *);
65 
66 #ifdef	__cplusplus
67 }
68 #endif
69 
70 #endif	/* _LIBRESTART_PRIV_H */
71