17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*af007057Syl194034 * Common Development and Distribution License (the "License"). 6*af007057Syl194034 * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*af007057Syl194034 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate /* 277c478bd9Sstevel@tonic-gate * This file contains the declarations of menus for the program. To add 287c478bd9Sstevel@tonic-gate * a new command/menu, simply add it to the appropriate table and define 297c478bd9Sstevel@tonic-gate * the function that executes it. 307c478bd9Sstevel@tonic-gate */ 317c478bd9Sstevel@tonic-gate #include <sys/isa_defs.h> 327c478bd9Sstevel@tonic-gate #include "global.h" 337c478bd9Sstevel@tonic-gate #include "menu.h" 347c478bd9Sstevel@tonic-gate #include "menu_partition.h" 357c478bd9Sstevel@tonic-gate #include "menu_command.h" 367c478bd9Sstevel@tonic-gate #include "menu_analyze.h" 377c478bd9Sstevel@tonic-gate #include "menu_defect.h" 387c478bd9Sstevel@tonic-gate #include "add_definition.h" 397c478bd9Sstevel@tonic-gate #include "menu_scsi.h" 407c478bd9Sstevel@tonic-gate #include "menu_developer.h" 417c478bd9Sstevel@tonic-gate #include "menu_cache.h" 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gate #include "menu_fdisk.h" 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gate /* 477c478bd9Sstevel@tonic-gate * This declaration is for the command menu. It is the menu first 487c478bd9Sstevel@tonic-gate * encountered upon entering the program. 497c478bd9Sstevel@tonic-gate */ 507c478bd9Sstevel@tonic-gate struct menu_item menu_command[] = { 517c478bd9Sstevel@tonic-gate { "disk - select a disk", 527c478bd9Sstevel@tonic-gate c_disk, true }, 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate { "type - select (define) a disk type", 557c478bd9Sstevel@tonic-gate c_type, true }, 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate { "partition - select (define) a partition table", 587c478bd9Sstevel@tonic-gate c_partition, true }, 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate { "current - describe the current disk", 617c478bd9Sstevel@tonic-gate c_current, true }, 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate { "format - format and analyze the disk", 647c478bd9Sstevel@tonic-gate c_format, true }, 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate { "fdisk - run the fdisk program", 677c478bd9Sstevel@tonic-gate c_fdisk, support_fdisk_on_sparc }, 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate { "repair - repair a defective sector", 707c478bd9Sstevel@tonic-gate c_repair, true }, 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate { "show - translate a disk address", 737c478bd9Sstevel@tonic-gate c_show, not_scsi }, 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate { "label - write label to the disk", 767c478bd9Sstevel@tonic-gate c_label, true }, 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gate { "analyze - surface analysis", 797c478bd9Sstevel@tonic-gate c_analyze, true }, 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate { "defect - defect list management", 827c478bd9Sstevel@tonic-gate c_defect, true }, 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gate { "backup - search for backup labels", 857c478bd9Sstevel@tonic-gate c_backup, true }, 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate { "verify - read and display labels", 887c478bd9Sstevel@tonic-gate c_verify, true }, 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate { "save - save new disk/partition definitions", 917c478bd9Sstevel@tonic-gate add_definition, not_efi }, 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate { "inquiry - show vendor, product and revision", 947c478bd9Sstevel@tonic-gate c_inquiry, scsi }, 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate { "scsi - independent SCSI mode selects", 977c478bd9Sstevel@tonic-gate c_scsi, scsi_expert }, 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate { "cache - enable, disable or query SCSI disk cache", 1007c478bd9Sstevel@tonic-gate c_cache, scsi_expert }, 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate { "volname - set 8-character volume name", 1037c478bd9Sstevel@tonic-gate c_volname, true }, 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gate { "developer - dump developer things", 1067c478bd9Sstevel@tonic-gate c_developer, developer }, 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate { "!<cmd> - execute <cmd>, then return", 1097c478bd9Sstevel@tonic-gate execute_shell, true}, 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate { NULL } 1127c478bd9Sstevel@tonic-gate }; 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate /* 1167c478bd9Sstevel@tonic-gate * This declaration is for the partition menu. It is used to create 1177c478bd9Sstevel@tonic-gate * and maintain partition tables. 1187c478bd9Sstevel@tonic-gate */ 1197c478bd9Sstevel@tonic-gate struct menu_item menu_partition[] = { 1207c478bd9Sstevel@tonic-gate { "0 - change `0' partition", 1217c478bd9Sstevel@tonic-gate p_apart, true }, 1227c478bd9Sstevel@tonic-gate { "1 - change `1' partition", 1237c478bd9Sstevel@tonic-gate p_bpart, true }, 1247c478bd9Sstevel@tonic-gate { "2 - change `2' partition", 1257c478bd9Sstevel@tonic-gate p_cpart, true }, 1267c478bd9Sstevel@tonic-gate { "3 - change `3' partition", 1277c478bd9Sstevel@tonic-gate p_dpart, true }, 1287c478bd9Sstevel@tonic-gate { "4 - change `4' partition", 1297c478bd9Sstevel@tonic-gate p_epart, true }, 1307c478bd9Sstevel@tonic-gate { "5 - change `5' partition", 1317c478bd9Sstevel@tonic-gate p_fpart, true }, 1327c478bd9Sstevel@tonic-gate { "6 - change `6' partition", 1337c478bd9Sstevel@tonic-gate p_gpart, true }, 1347c478bd9Sstevel@tonic-gate { "7 - change `7' partition", 1357c478bd9Sstevel@tonic-gate p_hpart, disp_expert_change_expert_efi }, 1367c478bd9Sstevel@tonic-gate { "8 - change '8' partition", 1377c478bd9Sstevel@tonic-gate p_ipart, disp_all_change_expert_efi }, 1387c478bd9Sstevel@tonic-gate #if defined(i386) 1397c478bd9Sstevel@tonic-gate { "9 - change `9' partition", 1407c478bd9Sstevel@tonic-gate p_jpart, expert }, 1417c478bd9Sstevel@tonic-gate #endif 142*af007057Syl194034 { "expand - expand label to use whole disk", 143*af007057Syl194034 p_expand, disp_expand_efi }, 1447c478bd9Sstevel@tonic-gate { "select - select a predefined table", 1457c478bd9Sstevel@tonic-gate p_select, true }, 1467c478bd9Sstevel@tonic-gate { "modify - modify a predefined partition table", 1477c478bd9Sstevel@tonic-gate p_modify, true }, 1487c478bd9Sstevel@tonic-gate { "name - name the current table", 1497c478bd9Sstevel@tonic-gate p_name, true }, 1507c478bd9Sstevel@tonic-gate { "print - display the current table", 1517c478bd9Sstevel@tonic-gate p_print, true }, 1527c478bd9Sstevel@tonic-gate { "label - write partition map and label to the disk", 1537c478bd9Sstevel@tonic-gate c_label, true }, 1547c478bd9Sstevel@tonic-gate { "!<cmd> - execute <cmd>, then return", 1557c478bd9Sstevel@tonic-gate execute_shell, true}, 1567c478bd9Sstevel@tonic-gate 1577c478bd9Sstevel@tonic-gate { NULL } 1587c478bd9Sstevel@tonic-gate }; 1597c478bd9Sstevel@tonic-gate 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate 1627c478bd9Sstevel@tonic-gate /* 1637c478bd9Sstevel@tonic-gate * This declaration is for the analysis menu. It is used to set up 1647c478bd9Sstevel@tonic-gate * and execute surface analysis of a disk. 1657c478bd9Sstevel@tonic-gate */ 1667c478bd9Sstevel@tonic-gate struct menu_item menu_analyze[] = { 1677c478bd9Sstevel@tonic-gate { "read - read only test (doesn't harm SunOS)", 1687c478bd9Sstevel@tonic-gate a_read, true }, 1697c478bd9Sstevel@tonic-gate { "refresh - read then write (doesn't harm data)", 1707c478bd9Sstevel@tonic-gate a_refresh, true }, 1717c478bd9Sstevel@tonic-gate { "test - pattern testing (doesn't harm data)", 1727c478bd9Sstevel@tonic-gate a_test, true }, 1737c478bd9Sstevel@tonic-gate { "write - write then read (corrupts data)", 1747c478bd9Sstevel@tonic-gate a_write, true }, 1757c478bd9Sstevel@tonic-gate { "compare - write, read, compare (corrupts data)", 1767c478bd9Sstevel@tonic-gate a_compare, true }, 1777c478bd9Sstevel@tonic-gate { "purge - write, read, write (corrupts data)", 1787c478bd9Sstevel@tonic-gate a_purge, true }, 1797c478bd9Sstevel@tonic-gate { "verify - write entire disk, then verify (corrupts data)", 1807c478bd9Sstevel@tonic-gate a_verify, true }, 1817c478bd9Sstevel@tonic-gate { "print - display data buffer", 1827c478bd9Sstevel@tonic-gate a_print, true }, 1837c478bd9Sstevel@tonic-gate { "setup - set analysis parameters", 1847c478bd9Sstevel@tonic-gate a_setup, true }, 1857c478bd9Sstevel@tonic-gate { "config - show analysis parameters", 1867c478bd9Sstevel@tonic-gate a_config, true }, 1877c478bd9Sstevel@tonic-gate { "!<cmd> - execute <cmd> , then return", 1887c478bd9Sstevel@tonic-gate execute_shell, true}, 1897c478bd9Sstevel@tonic-gate { NULL } 1907c478bd9Sstevel@tonic-gate }; 1917c478bd9Sstevel@tonic-gate 1927c478bd9Sstevel@tonic-gate 1937c478bd9Sstevel@tonic-gate 1947c478bd9Sstevel@tonic-gate /* 1957c478bd9Sstevel@tonic-gate * This declaration is for the defect menu. It is used to manipulate 1967c478bd9Sstevel@tonic-gate * the defect list for a disk. 1977c478bd9Sstevel@tonic-gate */ 1987c478bd9Sstevel@tonic-gate struct menu_item menu_defect[] = { 1997c478bd9Sstevel@tonic-gate { "restore - set working list = current list", 2007c478bd9Sstevel@tonic-gate d_restore, not_embedded_scsi }, 2017c478bd9Sstevel@tonic-gate { "original - extract manufacturer's list from disk", 2027c478bd9Sstevel@tonic-gate d_original, not_embedded_scsi }, 2037c478bd9Sstevel@tonic-gate { "extract - extract working list from disk", 2047c478bd9Sstevel@tonic-gate d_extract, not_embedded_scsi }, 2057c478bd9Sstevel@tonic-gate { "primary - extract manufacturer's defect list", 2067c478bd9Sstevel@tonic-gate d_primary, embedded_scsi }, 2077c478bd9Sstevel@tonic-gate { "grown - extract the grown defects list", 2087c478bd9Sstevel@tonic-gate d_grown, embedded_scsi }, 2097c478bd9Sstevel@tonic-gate { "both - extract both primary and grown defects lists", 2107c478bd9Sstevel@tonic-gate d_both, embedded_scsi }, 2117c478bd9Sstevel@tonic-gate { "add - add defects to working list", 2127c478bd9Sstevel@tonic-gate d_add, not_embedded_scsi }, 2137c478bd9Sstevel@tonic-gate { "delete - delete a defect from working list", 2147c478bd9Sstevel@tonic-gate d_delete, not_embedded_scsi }, 2157c478bd9Sstevel@tonic-gate { "print - display defect list", 2167c478bd9Sstevel@tonic-gate d_print, embedded_scsi }, 2177c478bd9Sstevel@tonic-gate { "dump - dump defect list to file", 2187c478bd9Sstevel@tonic-gate d_dump, embedded_scsi }, 2197c478bd9Sstevel@tonic-gate { "print - display working list", 2207c478bd9Sstevel@tonic-gate d_print, not_embedded_scsi }, 2217c478bd9Sstevel@tonic-gate { "dump - dump working list to file", 2227c478bd9Sstevel@tonic-gate d_dump, not_embedded_scsi }, 2237c478bd9Sstevel@tonic-gate { "load - load working list from file", 2247c478bd9Sstevel@tonic-gate d_load, not_embedded_scsi }, 2257c478bd9Sstevel@tonic-gate { "commit - set current list = working list", 2267c478bd9Sstevel@tonic-gate d_commit, not_embedded_scsi }, 2277c478bd9Sstevel@tonic-gate { "create - recreates maufacturer's defect list on disk", 2287c478bd9Sstevel@tonic-gate d_create, not_embedded_scsi }, 2297c478bd9Sstevel@tonic-gate { "!<cmd> - execute <cmd>, then return", 2307c478bd9Sstevel@tonic-gate execute_shell, true}, 2317c478bd9Sstevel@tonic-gate 2327c478bd9Sstevel@tonic-gate { NULL } 2337c478bd9Sstevel@tonic-gate }; 2347c478bd9Sstevel@tonic-gate 2357c478bd9Sstevel@tonic-gate /* 2367c478bd9Sstevel@tonic-gate * This declaration is for the developer menu. 2377c478bd9Sstevel@tonic-gate */ 2387c478bd9Sstevel@tonic-gate struct menu_item menu_developer[] = { 2397c478bd9Sstevel@tonic-gate { "dump_disk - dump disk entries", 2407c478bd9Sstevel@tonic-gate dv_disk, true }, 2417c478bd9Sstevel@tonic-gate { "dump_cont - dump controller entries", 2427c478bd9Sstevel@tonic-gate dv_cont, true }, 2437c478bd9Sstevel@tonic-gate { "dump_c_chain - dump controller chain entries", 2447c478bd9Sstevel@tonic-gate dv_cont_chain, true }, 2457c478bd9Sstevel@tonic-gate { "dev_params - dump device parameters", 2467c478bd9Sstevel@tonic-gate dv_params, true }, 2477c478bd9Sstevel@tonic-gate { "!<cmd> - execute <cmd>, then return", 2487c478bd9Sstevel@tonic-gate execute_shell, true}, 2497c478bd9Sstevel@tonic-gate { NULL } 2507c478bd9Sstevel@tonic-gate }; 2517c478bd9Sstevel@tonic-gate 2527c478bd9Sstevel@tonic-gate /* 2537c478bd9Sstevel@tonic-gate * This declaration is for the cache menu. 2547c478bd9Sstevel@tonic-gate */ 2557c478bd9Sstevel@tonic-gate struct menu_item menu_cache[] = { 2567c478bd9Sstevel@tonic-gate { "write_cache - display or modify write cache settings", 2577c478bd9Sstevel@tonic-gate ca_write_cache, scsi_expert }, 2587c478bd9Sstevel@tonic-gate { "read_cache - display or modify read cache settings", 2597c478bd9Sstevel@tonic-gate ca_read_cache, scsi_expert }, 2607c478bd9Sstevel@tonic-gate { "!<cmd> - execute <cmd>, then return", 2617c478bd9Sstevel@tonic-gate execute_shell, true}, 2627c478bd9Sstevel@tonic-gate { NULL } 2637c478bd9Sstevel@tonic-gate }; 2647c478bd9Sstevel@tonic-gate 2657c478bd9Sstevel@tonic-gate /* 2667c478bd9Sstevel@tonic-gate * This declaration is for the write_cache menu. 2677c478bd9Sstevel@tonic-gate */ 2687c478bd9Sstevel@tonic-gate struct menu_item menu_write_cache[] = { 2697c478bd9Sstevel@tonic-gate { "display - display current setting of write cache", 2707c478bd9Sstevel@tonic-gate ca_write_display, scsi_expert }, 2717c478bd9Sstevel@tonic-gate { "enable - enable write cache", 2727c478bd9Sstevel@tonic-gate ca_write_enable, scsi_expert }, 2737c478bd9Sstevel@tonic-gate { "disable - disable write cache", 2747c478bd9Sstevel@tonic-gate ca_write_disable, scsi_expert }, 2757c478bd9Sstevel@tonic-gate { "!<cmd> - execute <cmd>, then return", 2767c478bd9Sstevel@tonic-gate execute_shell, true}, 2777c478bd9Sstevel@tonic-gate { NULL } 2787c478bd9Sstevel@tonic-gate }; 2797c478bd9Sstevel@tonic-gate 2807c478bd9Sstevel@tonic-gate /* 2817c478bd9Sstevel@tonic-gate * This declaration is for the read_cache menu. 2827c478bd9Sstevel@tonic-gate */ 2837c478bd9Sstevel@tonic-gate struct menu_item menu_read_cache[] = { 2847c478bd9Sstevel@tonic-gate { "display - display current setting of read cache", 2857c478bd9Sstevel@tonic-gate ca_read_display, scsi_expert }, 2867c478bd9Sstevel@tonic-gate { "enable - enable read cache", 2877c478bd9Sstevel@tonic-gate ca_read_enable, scsi_expert }, 2887c478bd9Sstevel@tonic-gate { "disable - disable read cache", 2897c478bd9Sstevel@tonic-gate ca_read_disable, scsi_expert }, 2907c478bd9Sstevel@tonic-gate { "!<cmd> - execute <cmd>, then return", 2917c478bd9Sstevel@tonic-gate execute_shell, true}, 2927c478bd9Sstevel@tonic-gate { NULL } 2937c478bd9Sstevel@tonic-gate }; 294