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