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