1 /**	$MirOS: src/usr.sbin/config/ukc.h,v 1.5 2008/07/26 19:21:54 tg Exp $ */
2 /*	$OpenBSD: ukc.h,v 1.11 2003/06/25 21:10:12 deraadt Exp $ */
3 
4 /*
5  * Copyright (c) 1999-2001 Mats O Jansson.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef _UKC_H
29 #define _UKC_H
30 
31 #define P_LOCNAMES	0
32 #define S_LOCNAMP	1
33 #define SA_CFROOTS	2
34 #define I_CFROOTS_SIZE	3
35 #define I_PV_SIZE	4
36 #define SA_PV		5
37 #define P_CFDATA	6
38 #define P_KERNEL_TEXT	7
39 #define P_VERSION	8
40 #define IA_EXTRALOC	9
41 #define I_NEXTRALOC	10
42 #define I_UEXTRALOC	11
43 #define	I_HISTLEN	12
44 #define	CA_HISTORY	13
45 #define TZ_TZ		14
46 #define P_PDEVNAMES	15
47 #define I_PDEVSIZE	16
48 #define S_PDEVINIT	17
49 #define I_NMBCLUSTERS	18
50 #define I_BUFCACHEPCT	19
51 #define I_NKMEMPG	20
52 #define I_SHMSEG	21
53 #define I_SHMMAXPGS	22
54 #define I_ROOTDEV	23
55 #define I_ROOTDEV_OV	24
56 #define P_ENTROPY	25
57 #define NLENTRIES	26
58 
59 #ifdef UKC_MAIN
60 struct nlist nl[] = {
61 	{ "_locnames" },
62 	{ "_locnamp" },
63 	{ "_cfroots" },
64 	{ "_cfroots_size" },
65 	{ "_pv_size" },
66 	{ "_pv" },
67 	{ "_cfdata" },
68 	{ "_kernel_text" },
69 	{ "_version" },
70 	{ "_extraloc" },
71 	{ "_nextraloc" },
72 	{ "_uextraloc" },
73 	{ "_userconf_histlen" },
74 	{ "_userconf_history" },
75 	{ "_tz" },
76 	{ "_pdevnames" },
77 	{ "_pdevnames_size" },
78 	{ "_pdevinit" },
79 	{ "_nmbclust" },
80 	{ "_bufcachepercent" },
81 	{ "_nkmempages" },
82 	{ "_shmseg" },
83 	{ "_shmmaxpgs" },
84 	{ "_rootdev" },
85 	{ "_rootdev_override" },
86 	{ "_initial_entropy" },
87 	{ NULL },
88 };
89 struct nlist knl[] = {
90 	{ "_locnames" },
91 	{ "_locnamp" },
92 	{ "_cfroots" },
93 	{ "_cfroots_size" },
94 	{ "_pv_size" },
95 	{ "_pv" },
96 	{ "_cfdata" },
97 	{ "_kernel_text" },
98 	{ "_version" },
99 	{ "_extraloc" },
100 	{ "_nextraloc" },
101 	{ "_uextraloc" },
102 	{ "_userconf_histlen" },
103 	{ "_userconf_history" },
104 	{ "_tz" },
105 	{ "_pdevnames" },
106 	{ "_pdevnames_size" },
107 	{ "_pdevinit" },
108 	{ "_nmbclust" },
109 	{ "_bufcachepercent" },
110 	{ "_nkmempages" },
111 	{ "_shmseg" },
112 	{ "_shmmaxpgs" },
113 	{ "_rootdev" },
114 	{ "_rootdev_override" },
115 	{ "_initial_entropy" },
116 	{ NULL },
117 };
118 int	maxdev = 0;
119 int	totdev = 0;
120 int	maxpseudo = 0;
121 int	maxlocnames = 0;
122 int	base = 16;
123 int	cnt = -1;
124 int	lines = 18;
125 int	oldkernel = 0;
126 int	nopdev = 0;
127 #else
128 extern struct nlist nl[];
129 extern int maxdev;
130 extern int totdev;
131 extern int maxpseudo;
132 extern int maxlocnames;
133 extern int base;
134 extern int cnt;
135 extern int lines;
136 extern int oldkernel;
137 extern int nopdev;
138 #endif
139 
140 struct cfdata   *get_cfdata(int);
141 short	        *get_locnamp(int);
142 caddr_t	        *get_locnames(int);
143 int	        *get_extraloc(int);
144 char	        *get_pdevnames(int);
145 struct pdevinit *get_pdevinit(int);
146 
147 int	more(void);
148 void	pnum(int);
149 void	pdevnam(short);
150 void	pdev(short);
151 int	number(const char *, int *);
152 int	device(char *, int *, short *, short *);
153 int	attr(char *, int *);
154 void	modify(const char *, int *);
155 void	change(int);
156 void	disable(int);
157 void	enable(int);
158 void	show(void);
159 void	common_attr_val(short, int *, char);
160 void	show_attr(char *);
161 void	common_dev(char *, int, short, short, char);
162 void	common_attr(char *, int, char);
163 void	add_read(const char *, char, char *, int, int *);
164 void	add(char *, int, short, short);
165 
166 int	config(void);
167 void	process_history(int, char *);
168 
169 #define UC_CHANGE 'c'
170 #define UC_DISABLE 'd'
171 #define UC_ENABLE 'e'
172 #define UC_FIND 'f'
173 #define UC_SHOW 's'
174 
175 #endif /* _UTIL_H */
176