xref: /titanic_44/usr/src/cmd/power/pmconfig.h (revision 602ca9ea8f9ce0933f0944601cc5d230e91a950d)
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 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _PMCONFIG_H
27 #define	_PMCONFIG_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #include <sys/types.h>
36 #include <sys/stat.h>
37 #include <sys/cpr.h>
38 #include <sys/pm.h>
39 #include <strings.h>
40 #include <limits.h>
41 #include <libintl.h>
42 #include <stdlib.h>
43 #include <unistd.h>
44 #include <stdio.h>
45 #include <fcntl.h>
46 #include <errno.h>
47 
48 
49 #define	LINEARG(an)		*(line_args + an)
50 #define	LINELEN			80
51 #define	MOREARGS		4
52 
53 #define	ESTAR_VNONE		0
54 #define	ESTAR_V2		'2'
55 #define	ESTAR_V3		'3'
56 
57 #define	LPAREN			'('
58 #define	RPAREN			')'
59 
60 #define	MDEBUG			0
61 #define	MEXIT			1
62 #define	MERR			-1
63 
64 /*
65  * return values from handler routines;
66  * chosen to match syscall return values
67  */
68 #define	NOUP			-1
69 #define	OKUP			0
70 
71 #define	DFLT_THOLD		0.04
72 
73 
74 struct perm_update {
75 	int	perm;			/* cpr or pm permission */
76 	int	update;			/* flag updates from cpr/pm data */
77 	char	*set;			/* "cpr" or "pm" */
78 };
79 typedef struct perm_update prmup_t;
80 
81 
82 struct cinfo {
83 	char	*keyword;		/* keyword string */
84 	int	(*handler)(void);	/* keyword handler routine */
85 	prmup_t	*status;		/* permission and update status */
86 	char	*cmt;			/* config file comment */
87 	short	argc;			/* config line arg count */
88 	uint8_t	any;			/* 0: match argc, 1: at least argc */
89 	uint8_t	alt;			/* conf line OK from an alt source */
90 };
91 typedef struct cinfo cinfo_t;
92 
93 typedef void (*vact_t)(char *, size_t, cinfo_t *);
94 
95 /* Suspend/Resume flags */
96 extern int whitelist_only;
97 extern int verify;
98 
99 /*
100  * "conf.c"
101  */
102 extern prmup_t cpr_status, pm_status;
103 extern struct cprconfig new_cc;
104 extern struct stat def_info;
105 extern char estar_vers;
106 extern int pm_fd, ua_err;
107 extern uid_t ruid;
108 extern int def_src;
109 extern void mesg(int, char *, ...);
110 
111 /*
112  * "parse.c"
113  */
114 extern int lineno;
115 extern char **line_args;
116 extern void lookup_estar_vers(void);
117 extern void lookup_perms(void);
118 extern void parse_conf_file(char *, vact_t);
119 
120 /*
121  * handlers.c
122  */
123 extern int S3_helper(char *, char *, int, int, char *, char *, int *, int);
124 extern int S3sup(void);
125 extern int autoS3(void);
126 extern int autopm(void);
127 extern int autosd(void);
128 extern int cpupm(void);
129 extern int cputhr(void);
130 extern int ddprop(void);
131 extern int devdep(void);
132 extern int devthr(void);
133 extern int dreads(void);
134 extern int idlechk(void);
135 extern int loadavg(void);
136 extern int nfsreq(void);
137 extern int sfpath(void);
138 extern int systhr(void);
139 extern int tchars(void);
140 
141 #ifdef	__cplusplus
142 }
143 #endif
144 
145 #endif	/* _PMCONFIG_H */
146