summaryrefslogtreecommitdiff
path: root/usr/src/cmd/format/init_menus.c
blob: 0831e19205dd57f27f01d83ce382094f307a3d67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#pragma ident	"%Z%%M%	%I%	%E% SMI"

/*
 * This file contains the declarations of menus for the program.  To add
 * a new command/menu, simply add it to the appropriate table and define
 * the function that executes it.
 */
#include <sys/isa_defs.h>
#include "global.h"
#include "menu.h"
#include "menu_partition.h"
#include "menu_command.h"
#include "menu_analyze.h"
#include "menu_defect.h"
#include "add_definition.h"
#include "menu_scsi.h"
#include "menu_developer.h"
#include "menu_cache.h"

#include "menu_fdisk.h"


/*
 * This declaration is for the command menu.  It is the menu first
 * encountered upon entering the program.
 */
struct	menu_item menu_command[] = {
	{ "disk       - select a disk",
		c_disk, true },

	{ "type       - select (define) a disk type",
		c_type, true },

	{ "partition  - select (define) a partition table",
		c_partition, true },

	{ "current    - describe the current disk",
		c_current, true },

	{ "format     - format and analyze the disk",
		c_format, true },

	{ "fdisk      - run the fdisk program",
		c_fdisk, support_fdisk_on_sparc },

	{ "repair     - repair a defective sector",
		c_repair, true },

	{ "show       - translate a disk address",
		c_show,	 not_scsi },

	{ "label      - write label to the disk",
		c_label, true },

	{ "analyze    - surface analysis",
		c_analyze, true },

	{ "defect     - defect list management",
		c_defect, true },

	{ "backup     - search for backup labels",
		c_backup, true },

	{ "verify     - read and display labels",
		c_verify, true },

	{ "save       - save new disk/partition definitions",
		add_definition, not_efi },

	{ "inquiry    - show vendor, product and revision",
		c_inquiry, scsi },

	{ "scsi       - independent SCSI mode selects",
		c_scsi, scsi_expert },

	{ "cache      - enable, disable or query SCSI disk cache",
		c_cache, scsi_expert },

	{ "volname    - set 8-character volume name",
		c_volname, true },

	{ "developer  - dump developer things",
		c_developer, developer },

	{ "!<cmd>     - execute <cmd>, then return",
		execute_shell, true},

	{ NULL }
};


/*
 * This declaration is for the partition menu.  It is used to create
 * and maintain partition tables.
 */
struct	menu_item menu_partition[] = {
	{ "0      - change `0' partition",
		p_apart, true },
	{ "1      - change `1' partition",
		p_bpart, true },
	{ "2      - change `2' partition",
		p_cpart, true },
	{ "3      - change `3' partition",
		p_dpart, true },
	{ "4      - change `4' partition",
		p_epart, true },
	{ "5      - change `5' partition",
		p_fpart, true },
	{ "6      - change `6' partition",
		p_gpart, true },
	{ "7      - change `7' partition",
		p_hpart, disp_expert_change_expert_efi },
	{ "8      - change '8' partition",
		p_ipart, disp_all_change_expert_efi },
#if defined(i386)
	{ "9      - change `9' partition",
		p_jpart, expert },
#endif
	{ "expand - expand label to use whole disk",
		p_expand, disp_expand_efi },
	{ "select - select a predefined table",
		p_select, true },
	{ "modify - modify a predefined partition table",
		p_modify, true },
	{ "name   - name the current table",
		p_name, true },
	{ "print  - display the current table",
		p_print, true },
	{ "label  - write partition map and label to the disk",
		c_label, true },
	{ "!<cmd> - execute <cmd>, then return",
		execute_shell, true},

	{ NULL }
};



/*
 * This declaration is for the analysis menu.  It is used to set up
 * and execute surface analysis of a disk.
 */
struct menu_item menu_analyze[] = {
	{ "read     - read only test   (doesn't harm SunOS)",
		a_read,	 true },
	{ "refresh  - read then write  (doesn't harm data)",
		a_refresh, true },
	{ "test     - pattern testing  (doesn't harm data)",
		a_test,	 true },
	{ "write    - write then read      (corrupts data)",
		a_write, true },
	{ "compare  - write, read, compare (corrupts data)",
		a_compare, true },
	{ "purge    - write, read, write   (corrupts data)",
		a_purge, true },
	{ "verify   - write entire disk, then verify (corrupts data)",
		a_verify, true },
	{ "print    - display data buffer",
		a_print, true },
	{ "setup    - set analysis parameters",
		a_setup, true },
	{ "config   - show analysis parameters",
		a_config, true },
	{ "!<cmd>   - execute <cmd> , then return",
		execute_shell, true},
	{ NULL }
};



/*
 * This declaration is for the defect menu.  It is used to manipulate
 * the defect list for a disk.
 */
struct menu_item menu_defect[] = {
	{ "restore  - set working list = current list",
		d_restore, not_embedded_scsi },
	{ "original - extract manufacturer's list from disk",
		d_original, not_embedded_scsi },
	{ "extract  - extract working list from disk",
		d_extract, not_embedded_scsi },
	{ "primary  - extract manufacturer's defect list",
		d_primary, embedded_scsi },
	{ "grown    - extract the grown defects list",
		d_grown, embedded_scsi },
	{ "both     - extract both primary and grown defects lists",
		d_both, embedded_scsi },
	{ "add      - add defects to working list",
		d_add,	 not_embedded_scsi },
	{ "delete   - delete a defect from working list",
		d_delete, not_embedded_scsi },
	{ "print    - display defect list",
		d_print, embedded_scsi },
	{ "dump     - dump defect list to file",
		d_dump,	 embedded_scsi },
	{ "print    - display working list",
		d_print, not_embedded_scsi },
	{ "dump     - dump working list to file",
		d_dump,	 not_embedded_scsi },
	{ "load     - load working list from file",
		d_load,	 not_embedded_scsi },
	{ "commit   - set current list = working list",
		d_commit, not_embedded_scsi },
	{ "create   - recreates maufacturer's defect list on disk",
		d_create, not_embedded_scsi },
	{ "!<cmd>   - execute <cmd>, then return",
		execute_shell, true},

	{ NULL }
};

/*
 * This declaration is for the developer menu.
 */
struct menu_item menu_developer[] = {
	{ "dump_disk  - dump disk entries",
		dv_disk, true },
	{ "dump_cont  - dump controller entries",
		dv_cont, true },
	{ "dump_c_chain - dump controller chain entries",
		dv_cont_chain, true },
	{ "dev_params - dump device parameters",
		dv_params, true },
	{ "!<cmd>     - execute <cmd>, then return",
		execute_shell, true},
	{ NULL }
};

/*
 * This declaration is for the cache menu.
 */
struct menu_item menu_cache[] = {
	{ "write_cache - display or modify write cache settings",
		ca_write_cache, scsi_expert },
	{ "read_cache  - display or modify read cache settings",
		ca_read_cache,  scsi_expert },
	{ "!<cmd>      - execute <cmd>, then return",
		execute_shell, true},
	{ NULL }
};

/*
 * This declaration is for the write_cache menu.
 */
struct menu_item menu_write_cache[] = {
	{ "display     - display current setting of write cache",
		ca_write_display, scsi_expert },
	{ "enable      - enable write cache",
		ca_write_enable,  scsi_expert },
	{ "disable     - disable write cache",
		ca_write_disable, scsi_expert },
	{ "!<cmd>      - execute <cmd>, then return",
		execute_shell, true},
	{ NULL }
};

/*
 * This declaration is for the read_cache menu.
 */
struct menu_item menu_read_cache[] = {
	{ "display     - display current setting of read cache",
		ca_read_display, scsi_expert },
	{ "enable      - enable read cache",
		ca_read_enable,  scsi_expert },
	{ "disable     - disable read cache",
		ca_read_disable, scsi_expert },
	{ "!<cmd>      - execute <cmd>, then return",
		execute_shell, true},
	{ NULL }
};