10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*6590Syl194034 * Common Development and Distribution License (the "License"). 6*6590Syl194034 * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*6590Syl194034 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 270Sstevel@tonic-gate 280Sstevel@tonic-gate /* 290Sstevel@tonic-gate * This file contains the declarations of menus for the program. To add 300Sstevel@tonic-gate * a new command/menu, simply add it to the appropriate table and define 310Sstevel@tonic-gate * the function that executes it. 320Sstevel@tonic-gate */ 330Sstevel@tonic-gate #include <sys/isa_defs.h> 340Sstevel@tonic-gate #include "global.h" 350Sstevel@tonic-gate #include "menu.h" 360Sstevel@tonic-gate #include "menu_partition.h" 370Sstevel@tonic-gate #include "menu_command.h" 380Sstevel@tonic-gate #include "menu_analyze.h" 390Sstevel@tonic-gate #include "menu_defect.h" 400Sstevel@tonic-gate #include "add_definition.h" 410Sstevel@tonic-gate #include "menu_scsi.h" 420Sstevel@tonic-gate #include "menu_developer.h" 430Sstevel@tonic-gate #include "menu_cache.h" 440Sstevel@tonic-gate 450Sstevel@tonic-gate #include "menu_fdisk.h" 460Sstevel@tonic-gate 470Sstevel@tonic-gate 480Sstevel@tonic-gate /* 490Sstevel@tonic-gate * This declaration is for the command menu. It is the menu first 500Sstevel@tonic-gate * encountered upon entering the program. 510Sstevel@tonic-gate */ 520Sstevel@tonic-gate struct menu_item menu_command[] = { 530Sstevel@tonic-gate { "disk - select a disk", 540Sstevel@tonic-gate c_disk, true }, 550Sstevel@tonic-gate 560Sstevel@tonic-gate { "type - select (define) a disk type", 570Sstevel@tonic-gate c_type, true }, 580Sstevel@tonic-gate 590Sstevel@tonic-gate { "partition - select (define) a partition table", 600Sstevel@tonic-gate c_partition, true }, 610Sstevel@tonic-gate 620Sstevel@tonic-gate { "current - describe the current disk", 630Sstevel@tonic-gate c_current, true }, 640Sstevel@tonic-gate 650Sstevel@tonic-gate { "format - format and analyze the disk", 660Sstevel@tonic-gate c_format, true }, 670Sstevel@tonic-gate 680Sstevel@tonic-gate { "fdisk - run the fdisk program", 690Sstevel@tonic-gate c_fdisk, support_fdisk_on_sparc }, 700Sstevel@tonic-gate 710Sstevel@tonic-gate { "repair - repair a defective sector", 720Sstevel@tonic-gate c_repair, true }, 730Sstevel@tonic-gate 740Sstevel@tonic-gate { "show - translate a disk address", 750Sstevel@tonic-gate c_show, not_scsi }, 760Sstevel@tonic-gate 770Sstevel@tonic-gate { "label - write label to the disk", 780Sstevel@tonic-gate c_label, true }, 790Sstevel@tonic-gate 800Sstevel@tonic-gate { "analyze - surface analysis", 810Sstevel@tonic-gate c_analyze, true }, 820Sstevel@tonic-gate 830Sstevel@tonic-gate { "defect - defect list management", 840Sstevel@tonic-gate c_defect, true }, 850Sstevel@tonic-gate 860Sstevel@tonic-gate { "backup - search for backup labels", 870Sstevel@tonic-gate c_backup, true }, 880Sstevel@tonic-gate 890Sstevel@tonic-gate { "verify - read and display labels", 900Sstevel@tonic-gate c_verify, true }, 910Sstevel@tonic-gate 920Sstevel@tonic-gate { "save - save new disk/partition definitions", 930Sstevel@tonic-gate add_definition, not_efi }, 940Sstevel@tonic-gate 950Sstevel@tonic-gate { "inquiry - show vendor, product and revision", 960Sstevel@tonic-gate c_inquiry, scsi }, 970Sstevel@tonic-gate 980Sstevel@tonic-gate { "scsi - independent SCSI mode selects", 990Sstevel@tonic-gate c_scsi, scsi_expert }, 1000Sstevel@tonic-gate 1010Sstevel@tonic-gate { "cache - enable, disable or query SCSI disk cache", 1020Sstevel@tonic-gate c_cache, scsi_expert }, 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate { "volname - set 8-character volume name", 1050Sstevel@tonic-gate c_volname, true }, 1060Sstevel@tonic-gate 1070Sstevel@tonic-gate { "developer - dump developer things", 1080Sstevel@tonic-gate c_developer, developer }, 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate { "!<cmd> - execute <cmd>, then return", 1110Sstevel@tonic-gate execute_shell, true}, 1120Sstevel@tonic-gate 1130Sstevel@tonic-gate { NULL } 1140Sstevel@tonic-gate }; 1150Sstevel@tonic-gate 1160Sstevel@tonic-gate 1170Sstevel@tonic-gate /* 1180Sstevel@tonic-gate * This declaration is for the partition menu. It is used to create 1190Sstevel@tonic-gate * and maintain partition tables. 1200Sstevel@tonic-gate */ 1210Sstevel@tonic-gate struct menu_item menu_partition[] = { 1220Sstevel@tonic-gate { "0 - change `0' partition", 1230Sstevel@tonic-gate p_apart, true }, 1240Sstevel@tonic-gate { "1 - change `1' partition", 1250Sstevel@tonic-gate p_bpart, true }, 1260Sstevel@tonic-gate { "2 - change `2' partition", 1270Sstevel@tonic-gate p_cpart, true }, 1280Sstevel@tonic-gate { "3 - change `3' partition", 1290Sstevel@tonic-gate p_dpart, true }, 1300Sstevel@tonic-gate { "4 - change `4' partition", 1310Sstevel@tonic-gate p_epart, true }, 1320Sstevel@tonic-gate { "5 - change `5' partition", 1330Sstevel@tonic-gate p_fpart, true }, 1340Sstevel@tonic-gate { "6 - change `6' partition", 1350Sstevel@tonic-gate p_gpart, true }, 1360Sstevel@tonic-gate { "7 - change `7' partition", 1370Sstevel@tonic-gate p_hpart, disp_expert_change_expert_efi }, 1380Sstevel@tonic-gate { "8 - change '8' partition", 1390Sstevel@tonic-gate p_ipart, disp_all_change_expert_efi }, 1400Sstevel@tonic-gate #if defined(i386) 1410Sstevel@tonic-gate { "9 - change `9' partition", 1420Sstevel@tonic-gate p_jpart, expert }, 1430Sstevel@tonic-gate #endif 144*6590Syl194034 { "expand - expand label to use whole disk", 145*6590Syl194034 p_expand, disp_expand_efi }, 1460Sstevel@tonic-gate { "select - select a predefined table", 1470Sstevel@tonic-gate p_select, true }, 1480Sstevel@tonic-gate { "modify - modify a predefined partition table", 1490Sstevel@tonic-gate p_modify, true }, 1500Sstevel@tonic-gate { "name - name the current table", 1510Sstevel@tonic-gate p_name, true }, 1520Sstevel@tonic-gate { "print - display the current table", 1530Sstevel@tonic-gate p_print, true }, 1540Sstevel@tonic-gate { "label - write partition map and label to the disk", 1550Sstevel@tonic-gate c_label, true }, 1560Sstevel@tonic-gate { "!<cmd> - execute <cmd>, then return", 1570Sstevel@tonic-gate execute_shell, true}, 1580Sstevel@tonic-gate 1590Sstevel@tonic-gate { NULL } 1600Sstevel@tonic-gate }; 1610Sstevel@tonic-gate 1620Sstevel@tonic-gate 1630Sstevel@tonic-gate 1640Sstevel@tonic-gate /* 1650Sstevel@tonic-gate * This declaration is for the analysis menu. It is used to set up 1660Sstevel@tonic-gate * and execute surface analysis of a disk. 1670Sstevel@tonic-gate */ 1680Sstevel@tonic-gate struct menu_item menu_analyze[] = { 1690Sstevel@tonic-gate { "read - read only test (doesn't harm SunOS)", 1700Sstevel@tonic-gate a_read, true }, 1710Sstevel@tonic-gate { "refresh - read then write (doesn't harm data)", 1720Sstevel@tonic-gate a_refresh, true }, 1730Sstevel@tonic-gate { "test - pattern testing (doesn't harm data)", 1740Sstevel@tonic-gate a_test, true }, 1750Sstevel@tonic-gate { "write - write then read (corrupts data)", 1760Sstevel@tonic-gate a_write, true }, 1770Sstevel@tonic-gate { "compare - write, read, compare (corrupts data)", 1780Sstevel@tonic-gate a_compare, true }, 1790Sstevel@tonic-gate { "purge - write, read, write (corrupts data)", 1800Sstevel@tonic-gate a_purge, true }, 1810Sstevel@tonic-gate { "verify - write entire disk, then verify (corrupts data)", 1820Sstevel@tonic-gate a_verify, true }, 1830Sstevel@tonic-gate { "print - display data buffer", 1840Sstevel@tonic-gate a_print, true }, 1850Sstevel@tonic-gate { "setup - set analysis parameters", 1860Sstevel@tonic-gate a_setup, true }, 1870Sstevel@tonic-gate { "config - show analysis parameters", 1880Sstevel@tonic-gate a_config, true }, 1890Sstevel@tonic-gate { "!<cmd> - execute <cmd> , then return", 1900Sstevel@tonic-gate execute_shell, true}, 1910Sstevel@tonic-gate { NULL } 1920Sstevel@tonic-gate }; 1930Sstevel@tonic-gate 1940Sstevel@tonic-gate 1950Sstevel@tonic-gate 1960Sstevel@tonic-gate /* 1970Sstevel@tonic-gate * This declaration is for the defect menu. It is used to manipulate 1980Sstevel@tonic-gate * the defect list for a disk. 1990Sstevel@tonic-gate */ 2000Sstevel@tonic-gate struct menu_item menu_defect[] = { 2010Sstevel@tonic-gate { "restore - set working list = current list", 2020Sstevel@tonic-gate d_restore, not_embedded_scsi }, 2030Sstevel@tonic-gate { "original - extract manufacturer's list from disk", 2040Sstevel@tonic-gate d_original, not_embedded_scsi }, 2050Sstevel@tonic-gate { "extract - extract working list from disk", 2060Sstevel@tonic-gate d_extract, not_embedded_scsi }, 2070Sstevel@tonic-gate { "primary - extract manufacturer's defect list", 2080Sstevel@tonic-gate d_primary, embedded_scsi }, 2090Sstevel@tonic-gate { "grown - extract the grown defects list", 2100Sstevel@tonic-gate d_grown, embedded_scsi }, 2110Sstevel@tonic-gate { "both - extract both primary and grown defects lists", 2120Sstevel@tonic-gate d_both, embedded_scsi }, 2130Sstevel@tonic-gate { "add - add defects to working list", 2140Sstevel@tonic-gate d_add, not_embedded_scsi }, 2150Sstevel@tonic-gate { "delete - delete a defect from working list", 2160Sstevel@tonic-gate d_delete, not_embedded_scsi }, 2170Sstevel@tonic-gate { "print - display defect list", 2180Sstevel@tonic-gate d_print, embedded_scsi }, 2190Sstevel@tonic-gate { "dump - dump defect list to file", 2200Sstevel@tonic-gate d_dump, embedded_scsi }, 2210Sstevel@tonic-gate { "print - display working list", 2220Sstevel@tonic-gate d_print, not_embedded_scsi }, 2230Sstevel@tonic-gate { "dump - dump working list to file", 2240Sstevel@tonic-gate d_dump, not_embedded_scsi }, 2250Sstevel@tonic-gate { "load - load working list from file", 2260Sstevel@tonic-gate d_load, not_embedded_scsi }, 2270Sstevel@tonic-gate { "commit - set current list = working list", 2280Sstevel@tonic-gate d_commit, not_embedded_scsi }, 2290Sstevel@tonic-gate { "create - recreates maufacturer's defect list on disk", 2300Sstevel@tonic-gate d_create, not_embedded_scsi }, 2310Sstevel@tonic-gate { "!<cmd> - execute <cmd>, then return", 2320Sstevel@tonic-gate execute_shell, true}, 2330Sstevel@tonic-gate 2340Sstevel@tonic-gate { NULL } 2350Sstevel@tonic-gate }; 2360Sstevel@tonic-gate 2370Sstevel@tonic-gate /* 2380Sstevel@tonic-gate * This declaration is for the developer menu. 2390Sstevel@tonic-gate */ 2400Sstevel@tonic-gate struct menu_item menu_developer[] = { 2410Sstevel@tonic-gate { "dump_disk - dump disk entries", 2420Sstevel@tonic-gate dv_disk, true }, 2430Sstevel@tonic-gate { "dump_cont - dump controller entries", 2440Sstevel@tonic-gate dv_cont, true }, 2450Sstevel@tonic-gate { "dump_c_chain - dump controller chain entries", 2460Sstevel@tonic-gate dv_cont_chain, true }, 2470Sstevel@tonic-gate { "dev_params - dump device parameters", 2480Sstevel@tonic-gate dv_params, true }, 2490Sstevel@tonic-gate { "!<cmd> - execute <cmd>, then return", 2500Sstevel@tonic-gate execute_shell, true}, 2510Sstevel@tonic-gate { NULL } 2520Sstevel@tonic-gate }; 2530Sstevel@tonic-gate 2540Sstevel@tonic-gate /* 2550Sstevel@tonic-gate * This declaration is for the cache menu. 2560Sstevel@tonic-gate */ 2570Sstevel@tonic-gate struct menu_item menu_cache[] = { 2580Sstevel@tonic-gate { "write_cache - display or modify write cache settings", 2590Sstevel@tonic-gate ca_write_cache, scsi_expert }, 2600Sstevel@tonic-gate { "read_cache - display or modify read cache settings", 2610Sstevel@tonic-gate ca_read_cache, scsi_expert }, 2620Sstevel@tonic-gate { "!<cmd> - execute <cmd>, then return", 2630Sstevel@tonic-gate execute_shell, true}, 2640Sstevel@tonic-gate { NULL } 2650Sstevel@tonic-gate }; 2660Sstevel@tonic-gate 2670Sstevel@tonic-gate /* 2680Sstevel@tonic-gate * This declaration is for the write_cache menu. 2690Sstevel@tonic-gate */ 2700Sstevel@tonic-gate struct menu_item menu_write_cache[] = { 2710Sstevel@tonic-gate { "display - display current setting of write cache", 2720Sstevel@tonic-gate ca_write_display, scsi_expert }, 2730Sstevel@tonic-gate { "enable - enable write cache", 2740Sstevel@tonic-gate ca_write_enable, scsi_expert }, 2750Sstevel@tonic-gate { "disable - disable write cache", 2760Sstevel@tonic-gate ca_write_disable, scsi_expert }, 2770Sstevel@tonic-gate { "!<cmd> - execute <cmd>, then return", 2780Sstevel@tonic-gate execute_shell, true}, 2790Sstevel@tonic-gate { NULL } 2800Sstevel@tonic-gate }; 2810Sstevel@tonic-gate 2820Sstevel@tonic-gate /* 2830Sstevel@tonic-gate * This declaration is for the read_cache menu. 2840Sstevel@tonic-gate */ 2850Sstevel@tonic-gate struct menu_item menu_read_cache[] = { 2860Sstevel@tonic-gate { "display - display current setting of read cache", 2870Sstevel@tonic-gate ca_read_display, scsi_expert }, 2880Sstevel@tonic-gate { "enable - enable read cache", 2890Sstevel@tonic-gate ca_read_enable, scsi_expert }, 2900Sstevel@tonic-gate { "disable - disable read cache", 2910Sstevel@tonic-gate ca_read_disable, scsi_expert }, 2920Sstevel@tonic-gate { "!<cmd> - execute <cmd>, then return", 2930Sstevel@tonic-gate execute_shell, true}, 2940Sstevel@tonic-gate { NULL } 2950Sstevel@tonic-gate }; 296