xref: /titanic_50/usr/src/cmd/format/init_menus.c (revision c77a61a72b5ecdc507d6cf104142edd371a16c84)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1991-1996, 1999, 2001-2003 Sun Microsystems, Inc.
24  * All rights reserved.
25  * Use is subject to license terms.
26  */
27 /*
28  * Copyright 1991-1996, 1999, 2001-2002 Sun Microsystems, Inc.
29  * All rights reserved.
30  * Use is subject to license terms.
31  */
32 
33 #pragma ident	"%Z%%M%	%I%	%E% SMI"
34 
35 /*
36  * This file contains the declarations of menus for the program.  To add
37  * a new command/menu, simply add it to the appropriate table and define
38  * the function that executes it.
39  */
40 #include <sys/isa_defs.h>
41 #include "global.h"
42 #include "menu.h"
43 #include "menu_partition.h"
44 #include "menu_command.h"
45 #include "menu_analyze.h"
46 #include "menu_defect.h"
47 #include "add_definition.h"
48 #include "menu_scsi.h"
49 #include "menu_developer.h"
50 #include "menu_cache.h"
51 
52 #include "menu_fdisk.h"
53 
54 
55 /*
56  * This declaration is for the command menu.  It is the menu first
57  * encountered upon entering the program.
58  */
59 struct	menu_item menu_command[] = {
60 	{ "disk       - select a disk",
61 		c_disk, true },
62 
63 	{ "type       - select (define) a disk type",
64 		c_type, true },
65 
66 	{ "partition  - select (define) a partition table",
67 		c_partition, true },
68 
69 	{ "current    - describe the current disk",
70 		c_current, true },
71 
72 	{ "format     - format and analyze the disk",
73 		c_format, true },
74 
75 	{ "fdisk      - run the fdisk program",
76 		c_fdisk, support_fdisk_on_sparc },
77 
78 	{ "repair     - repair a defective sector",
79 		c_repair, true },
80 
81 	{ "show       - translate a disk address",
82 		c_show,	 not_scsi },
83 
84 	{ "label      - write label to the disk",
85 		c_label, true },
86 
87 	{ "analyze    - surface analysis",
88 		c_analyze, true },
89 
90 	{ "defect     - defect list management",
91 		c_defect, true },
92 
93 	{ "backup     - search for backup labels",
94 		c_backup, true },
95 
96 	{ "verify     - read and display labels",
97 		c_verify, true },
98 
99 	{ "save       - save new disk/partition definitions",
100 		add_definition, not_efi },
101 
102 	{ "inquiry    - show vendor, product and revision",
103 		c_inquiry, scsi },
104 
105 	{ "scsi       - independent SCSI mode selects",
106 		c_scsi, scsi_expert },
107 
108 	{ "cache      - enable, disable or query SCSI disk cache",
109 		c_cache, scsi_expert },
110 
111 	{ "volname    - set 8-character volume name",
112 		c_volname, true },
113 
114 	{ "developer  - dump developer things",
115 		c_developer, developer },
116 
117 	{ "!<cmd>     - execute <cmd>, then return",
118 		execute_shell, true},
119 
120 	{ NULL }
121 };
122 
123 
124 /*
125  * This declaration is for the partition menu.  It is used to create
126  * and maintain partition tables.
127  */
128 struct	menu_item menu_partition[] = {
129 	{ "0      - change `0' partition",
130 		p_apart, true },
131 	{ "1      - change `1' partition",
132 		p_bpart, true },
133 	{ "2      - change `2' partition",
134 		p_cpart, true },
135 	{ "3      - change `3' partition",
136 		p_dpart, true },
137 	{ "4      - change `4' partition",
138 		p_epart, true },
139 	{ "5      - change `5' partition",
140 		p_fpart, true },
141 	{ "6      - change `6' partition",
142 		p_gpart, true },
143 	{ "7      - change `7' partition",
144 		p_hpart, disp_expert_change_expert_efi },
145 	{ "8      - change '8' partition",
146 		p_ipart, disp_all_change_expert_efi },
147 #if defined(i386)
148 	{ "9      - change `9' partition",
149 		p_jpart, expert },
150 #endif
151 	{ "select - select a predefined table",
152 		p_select, true },
153 	{ "modify - modify a predefined partition table",
154 		p_modify, true },
155 	{ "name   - name the current table",
156 		p_name, true },
157 	{ "print  - display the current table",
158 		p_print, true },
159 	{ "label  - write partition map and label to the disk",
160 		c_label, true },
161 	{ "!<cmd> - execute <cmd>, then return",
162 		execute_shell, true},
163 
164 	{ NULL }
165 };
166 
167 
168 
169 /*
170  * This declaration is for the analysis menu.  It is used to set up
171  * and execute surface analysis of a disk.
172  */
173 struct menu_item menu_analyze[] = {
174 	{ "read     - read only test   (doesn't harm SunOS)",
175 		a_read,	 true },
176 	{ "refresh  - read then write  (doesn't harm data)",
177 		a_refresh, true },
178 	{ "test     - pattern testing  (doesn't harm data)",
179 		a_test,	 true },
180 	{ "write    - write then read      (corrupts data)",
181 		a_write, true },
182 	{ "compare  - write, read, compare (corrupts data)",
183 		a_compare, true },
184 	{ "purge    - write, read, write   (corrupts data)",
185 		a_purge, true },
186 	{ "verify   - write entire disk, then verify (corrupts data)",
187 		a_verify, true },
188 	{ "print    - display data buffer",
189 		a_print, true },
190 	{ "setup    - set analysis parameters",
191 		a_setup, true },
192 	{ "config   - show analysis parameters",
193 		a_config, true },
194 	{ "!<cmd>   - execute <cmd> , then return",
195 		execute_shell, true},
196 	{ NULL }
197 };
198 
199 
200 
201 /*
202  * This declaration is for the defect menu.  It is used to manipulate
203  * the defect list for a disk.
204  */
205 struct menu_item menu_defect[] = {
206 	{ "restore  - set working list = current list",
207 		d_restore, not_embedded_scsi },
208 	{ "original - extract manufacturer's list from disk",
209 		d_original, not_embedded_scsi },
210 	{ "extract  - extract working list from disk",
211 		d_extract, not_embedded_scsi },
212 	{ "primary  - extract manufacturer's defect list",
213 		d_primary, embedded_scsi },
214 	{ "grown    - extract the grown defects list",
215 		d_grown, embedded_scsi },
216 	{ "both     - extract both primary and grown defects lists",
217 		d_both, embedded_scsi },
218 	{ "add      - add defects to working list",
219 		d_add,	 not_embedded_scsi },
220 	{ "delete   - delete a defect from working list",
221 		d_delete, not_embedded_scsi },
222 	{ "print    - display defect list",
223 		d_print, embedded_scsi },
224 	{ "dump     - dump defect list to file",
225 		d_dump,	 embedded_scsi },
226 	{ "print    - display working list",
227 		d_print, not_embedded_scsi },
228 	{ "dump     - dump working list to file",
229 		d_dump,	 not_embedded_scsi },
230 	{ "load     - load working list from file",
231 		d_load,	 not_embedded_scsi },
232 	{ "commit   - set current list = working list",
233 		d_commit, not_embedded_scsi },
234 	{ "create   - recreates maufacturer's defect list on disk",
235 		d_create, not_embedded_scsi },
236 	{ "!<cmd>   - execute <cmd>, then return",
237 		execute_shell, true},
238 
239 	{ NULL }
240 };
241 
242 /*
243  * This declaration is for the developer menu.
244  */
245 struct menu_item menu_developer[] = {
246 	{ "dump_disk  - dump disk entries",
247 		dv_disk, true },
248 	{ "dump_cont  - dump controller entries",
249 		dv_cont, true },
250 	{ "dump_c_chain - dump controller chain entries",
251 		dv_cont_chain, true },
252 	{ "dev_params - dump device parameters",
253 		dv_params, true },
254 	{ "!<cmd>     - execute <cmd>, then return",
255 		execute_shell, true},
256 	{ NULL }
257 };
258 
259 /*
260  * This declaration is for the cache menu.
261  */
262 struct menu_item menu_cache[] = {
263 	{ "write_cache - display or modify write cache settings",
264 		ca_write_cache, scsi_expert },
265 	{ "read_cache  - display or modify read cache settings",
266 		ca_read_cache,  scsi_expert },
267 	{ "!<cmd>      - execute <cmd>, then return",
268 		execute_shell, true},
269 	{ NULL }
270 };
271 
272 /*
273  * This declaration is for the write_cache menu.
274  */
275 struct menu_item menu_write_cache[] = {
276 	{ "display     - display current setting of write cache",
277 		ca_write_display, scsi_expert },
278 	{ "enable      - enable write cache",
279 		ca_write_enable,  scsi_expert },
280 	{ "disable     - disable write cache",
281 		ca_write_disable, scsi_expert },
282 	{ "!<cmd>      - execute <cmd>, then return",
283 		execute_shell, true},
284 	{ NULL }
285 };
286 
287 /*
288  * This declaration is for the read_cache menu.
289  */
290 struct menu_item menu_read_cache[] = {
291 	{ "display     - display current setting of read cache",
292 		ca_read_display, scsi_expert },
293 	{ "enable      - enable read cache",
294 		ca_read_enable,  scsi_expert },
295 	{ "disable     - disable read cache",
296 		ca_read_disable, scsi_expert },
297 	{ "!<cmd>      - execute <cmd>, then return",
298 		execute_shell, true},
299 	{ NULL }
300 };
301