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 routines relating to running the menus.
307c478bd9Sstevel@tonic-gate */
317c478bd9Sstevel@tonic-gate #include <string.h>
327c478bd9Sstevel@tonic-gate #include "global.h"
337c478bd9Sstevel@tonic-gate #include "menu.h"
347c478bd9Sstevel@tonic-gate #include "misc.h"
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gate #ifdef __STDC__
377c478bd9Sstevel@tonic-gate
387c478bd9Sstevel@tonic-gate /* Function prototypes for ANSI C Compilers */
397c478bd9Sstevel@tonic-gate static int (*find_enabled_menu_item())(struct menu_item *menu, int item);
407c478bd9Sstevel@tonic-gate
417c478bd9Sstevel@tonic-gate #else /* __STDC__ */
427c478bd9Sstevel@tonic-gate
437c478bd9Sstevel@tonic-gate /* Function prototypes for non-ANSI C Compilers */
447c478bd9Sstevel@tonic-gate static int (*find_enabled_menu_item())();
457c478bd9Sstevel@tonic-gate
467c478bd9Sstevel@tonic-gate #endif /* __STDC__ */
477c478bd9Sstevel@tonic-gate
487c478bd9Sstevel@tonic-gate static char cur_title[MAXPATHLEN];
497c478bd9Sstevel@tonic-gate
507c478bd9Sstevel@tonic-gate /*
517c478bd9Sstevel@tonic-gate * This routine takes a menu struct and concatenates the
527c478bd9Sstevel@tonic-gate * command names into an array of strings describing the menu.
537c478bd9Sstevel@tonic-gate * All menus have a 'quit' command at the bottom to exit the menu.
547c478bd9Sstevel@tonic-gate */
557c478bd9Sstevel@tonic-gate char **
create_menu_list(menu)567c478bd9Sstevel@tonic-gate create_menu_list(menu)
577c478bd9Sstevel@tonic-gate struct menu_item *menu;
587c478bd9Sstevel@tonic-gate {
597c478bd9Sstevel@tonic-gate register struct menu_item *mptr;
607c478bd9Sstevel@tonic-gate register char **cpptr;
617c478bd9Sstevel@tonic-gate register char **list;
627c478bd9Sstevel@tonic-gate int nitems;
637c478bd9Sstevel@tonic-gate
647c478bd9Sstevel@tonic-gate /*
657c478bd9Sstevel@tonic-gate * A minimum list consists of the quit command, followed
667c478bd9Sstevel@tonic-gate * by a terminating null.
677c478bd9Sstevel@tonic-gate */
687c478bd9Sstevel@tonic-gate nitems = 2;
697c478bd9Sstevel@tonic-gate /*
707c478bd9Sstevel@tonic-gate * Count the number of active commands in the menu and allocate
717c478bd9Sstevel@tonic-gate * space for the array of pointers.
727c478bd9Sstevel@tonic-gate */
737c478bd9Sstevel@tonic-gate for (mptr = menu; mptr->menu_cmd != NULL; mptr++) {
747c478bd9Sstevel@tonic-gate if ((*mptr->menu_state)())
757c478bd9Sstevel@tonic-gate nitems++;
767c478bd9Sstevel@tonic-gate }
777c478bd9Sstevel@tonic-gate list = (char **)zalloc(nitems * sizeof (char *));
787c478bd9Sstevel@tonic-gate cpptr = list;
797c478bd9Sstevel@tonic-gate /*
807c478bd9Sstevel@tonic-gate * Fill in the array with the names of the menu commands.
817c478bd9Sstevel@tonic-gate */
827c478bd9Sstevel@tonic-gate for (mptr = menu; mptr->menu_cmd != NULL; mptr++) {
837c478bd9Sstevel@tonic-gate if ((*mptr->menu_state)()) {
847c478bd9Sstevel@tonic-gate *cpptr++ = mptr->menu_cmd;
857c478bd9Sstevel@tonic-gate }
867c478bd9Sstevel@tonic-gate }
877c478bd9Sstevel@tonic-gate /*
887c478bd9Sstevel@tonic-gate * Add the 'quit' command to the end.
897c478bd9Sstevel@tonic-gate */
907c478bd9Sstevel@tonic-gate *cpptr = "quit";
917c478bd9Sstevel@tonic-gate return (list);
927c478bd9Sstevel@tonic-gate }
937c478bd9Sstevel@tonic-gate
947c478bd9Sstevel@tonic-gate /*
957c478bd9Sstevel@tonic-gate * This routine takes a menu list created by the above routine and
967c478bd9Sstevel@tonic-gate * prints it nicely on the screen.
977c478bd9Sstevel@tonic-gate */
987c478bd9Sstevel@tonic-gate void
display_menu_list(list)997c478bd9Sstevel@tonic-gate display_menu_list(list)
1007c478bd9Sstevel@tonic-gate char **list;
1017c478bd9Sstevel@tonic-gate {
1027c478bd9Sstevel@tonic-gate register char **str;
1037c478bd9Sstevel@tonic-gate
1047c478bd9Sstevel@tonic-gate for (str = list; *str != NULL; str++)
1057c478bd9Sstevel@tonic-gate fmt_print(" %s\n", *str);
1067c478bd9Sstevel@tonic-gate }
1077c478bd9Sstevel@tonic-gate
1087c478bd9Sstevel@tonic-gate /*
1097c478bd9Sstevel@tonic-gate * Find the "i"th enabled menu in a menu list. This depends
1107c478bd9Sstevel@tonic-gate * on menu_state() returning the same status as when the
1117c478bd9Sstevel@tonic-gate * original list of enabled commands was constructed.
1127c478bd9Sstevel@tonic-gate */
1137c478bd9Sstevel@tonic-gate static int (*
1147c478bd9Sstevel@tonic-gate find_enabled_menu_item(menu, item))()
1157c478bd9Sstevel@tonic-gate struct menu_item *menu;
1167c478bd9Sstevel@tonic-gate int item;
1177c478bd9Sstevel@tonic-gate {
1187c478bd9Sstevel@tonic-gate struct menu_item *mp;
1197c478bd9Sstevel@tonic-gate
1207c478bd9Sstevel@tonic-gate for (mp = menu; mp->menu_cmd != NULL; mp++) {
1217c478bd9Sstevel@tonic-gate if ((*mp->menu_state)()) {
1227c478bd9Sstevel@tonic-gate if (item-- == 0) {
1237c478bd9Sstevel@tonic-gate return (mp->menu_func);
1247c478bd9Sstevel@tonic-gate }
1257c478bd9Sstevel@tonic-gate }
1267c478bd9Sstevel@tonic-gate }
1277c478bd9Sstevel@tonic-gate
1287c478bd9Sstevel@tonic-gate return (NULL);
1297c478bd9Sstevel@tonic-gate }
1307c478bd9Sstevel@tonic-gate
1317c478bd9Sstevel@tonic-gate /*
1327c478bd9Sstevel@tonic-gate * This routine 'runs' a menu. It repeatedly requests a command and
1337c478bd9Sstevel@tonic-gate * executes the command chosen. It exits when the 'quit' command is
1347c478bd9Sstevel@tonic-gate * executed.
1357c478bd9Sstevel@tonic-gate */
1367c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1377c478bd9Sstevel@tonic-gate void
run_menu(menu,title,prompt,display_flag)1387c478bd9Sstevel@tonic-gate run_menu(menu, title, prompt, display_flag)
1397c478bd9Sstevel@tonic-gate struct menu_item *menu;
1407c478bd9Sstevel@tonic-gate char *title;
1417c478bd9Sstevel@tonic-gate char *prompt;
1427c478bd9Sstevel@tonic-gate int display_flag;
1437c478bd9Sstevel@tonic-gate {
1447c478bd9Sstevel@tonic-gate char **list;
1457c478bd9Sstevel@tonic-gate int i;
1467c478bd9Sstevel@tonic-gate struct env env;
1477c478bd9Sstevel@tonic-gate u_ioparam_t ioparam;
1487c478bd9Sstevel@tonic-gate int (*f)();
1497c478bd9Sstevel@tonic-gate
1507c478bd9Sstevel@tonic-gate
1517c478bd9Sstevel@tonic-gate /*
1527c478bd9Sstevel@tonic-gate * Create the menu list and display it.
1537c478bd9Sstevel@tonic-gate */
1547c478bd9Sstevel@tonic-gate list = create_menu_list(menu);
1557c478bd9Sstevel@tonic-gate (void) strcpy(cur_title, title);
1567c478bd9Sstevel@tonic-gate fmt_print("\n\n%s MENU:\n", title);
1577c478bd9Sstevel@tonic-gate display_menu_list(list);
1587c478bd9Sstevel@tonic-gate /*
1597c478bd9Sstevel@tonic-gate * Save the environment so a ctrl-C out of a command lands here.
1607c478bd9Sstevel@tonic-gate */
1617c478bd9Sstevel@tonic-gate saveenv(env);
1627c478bd9Sstevel@tonic-gate for (;;) {
1637c478bd9Sstevel@tonic-gate /*
1647c478bd9Sstevel@tonic-gate * Ask the user which command they want to run.
1657c478bd9Sstevel@tonic-gate */
1667c478bd9Sstevel@tonic-gate ioparam.io_charlist = list;
1677c478bd9Sstevel@tonic-gate i = input(FIO_MSTR, prompt, '>', &ioparam,
1687c478bd9Sstevel@tonic-gate (int *)NULL, CMD_INPUT);
1697c478bd9Sstevel@tonic-gate /*
1707c478bd9Sstevel@tonic-gate * If they choose 'quit', the party's over.
1717c478bd9Sstevel@tonic-gate */
1727c478bd9Sstevel@tonic-gate if ((f = find_enabled_menu_item(menu, i)) == NULL)
1737c478bd9Sstevel@tonic-gate break;
1747c478bd9Sstevel@tonic-gate
1757c478bd9Sstevel@tonic-gate /*
1767c478bd9Sstevel@tonic-gate * Mark the saved environment active so the user can now
1777c478bd9Sstevel@tonic-gate * do a ctrl-C to get out of the command.
1787c478bd9Sstevel@tonic-gate */
1797c478bd9Sstevel@tonic-gate useenv();
1807c478bd9Sstevel@tonic-gate /*
1817c478bd9Sstevel@tonic-gate * Run the command. If it returns an error and we are
1827c478bd9Sstevel@tonic-gate * running out of a command file, the party's really over.
1837c478bd9Sstevel@tonic-gate */
1847c478bd9Sstevel@tonic-gate if ((*f)() && option_f)
1857c478bd9Sstevel@tonic-gate fullabort();
1867c478bd9Sstevel@tonic-gate /*
1877c478bd9Sstevel@tonic-gate * Mark the saved environment inactive so ctrl-C doesn't
1887c478bd9Sstevel@tonic-gate * work at the menu itself.
1897c478bd9Sstevel@tonic-gate */
1907c478bd9Sstevel@tonic-gate unuseenv();
1917c478bd9Sstevel@tonic-gate /*
1927c478bd9Sstevel@tonic-gate * Since menu items are dynamic, some commands
1937c478bd9Sstevel@tonic-gate * cause changes to occur. Destroy the old menu,
1947c478bd9Sstevel@tonic-gate * and rebuild it, so we're always up-to-date.
1957c478bd9Sstevel@tonic-gate */
1967c478bd9Sstevel@tonic-gate destroy_data((char *)list);
1977c478bd9Sstevel@tonic-gate list = create_menu_list(menu);
1987c478bd9Sstevel@tonic-gate /*
1997c478bd9Sstevel@tonic-gate * Redisplay menu, if we're returning to this one.
2007c478bd9Sstevel@tonic-gate */
2017c478bd9Sstevel@tonic-gate if (cur_menu != last_menu) {
2027c478bd9Sstevel@tonic-gate last_menu = cur_menu;
2037c478bd9Sstevel@tonic-gate (void) strcpy(cur_title, title);
2047c478bd9Sstevel@tonic-gate fmt_print("\n\n%s MENU:\n", title);
2057c478bd9Sstevel@tonic-gate display_menu_list(list);
2067c478bd9Sstevel@tonic-gate }
2077c478bd9Sstevel@tonic-gate }
2087c478bd9Sstevel@tonic-gate /*
2097c478bd9Sstevel@tonic-gate * Clean up the environment stack and throw away the menu list.
2107c478bd9Sstevel@tonic-gate */
2117c478bd9Sstevel@tonic-gate clearenv();
2127c478bd9Sstevel@tonic-gate destroy_data((char *)list);
2137c478bd9Sstevel@tonic-gate }
2147c478bd9Sstevel@tonic-gate
2157c478bd9Sstevel@tonic-gate /*
2167c478bd9Sstevel@tonic-gate * re-display the screen after exiting from shell escape
2177c478bd9Sstevel@tonic-gate *
2187c478bd9Sstevel@tonic-gate */
2197c478bd9Sstevel@tonic-gate void
redisplay_menu_list(list)2207c478bd9Sstevel@tonic-gate redisplay_menu_list(list)
2217c478bd9Sstevel@tonic-gate char **list;
2227c478bd9Sstevel@tonic-gate {
2237c478bd9Sstevel@tonic-gate fmt_print("\n\n%s MENU:\n", cur_title);
2247c478bd9Sstevel@tonic-gate display_menu_list(list);
2257c478bd9Sstevel@tonic-gate }
2267c478bd9Sstevel@tonic-gate
2277c478bd9Sstevel@tonic-gate
2287c478bd9Sstevel@tonic-gate /*
2297c478bd9Sstevel@tonic-gate * Glue to always return true. Used for menu items which
2307c478bd9Sstevel@tonic-gate * are always enabled.
2317c478bd9Sstevel@tonic-gate */
2327c478bd9Sstevel@tonic-gate int
2337c478bd9Sstevel@tonic-gate true()
2347c478bd9Sstevel@tonic-gate {
2357c478bd9Sstevel@tonic-gate return (1);
2367c478bd9Sstevel@tonic-gate }
2377c478bd9Sstevel@tonic-gate
2387c478bd9Sstevel@tonic-gate /*
2397c478bd9Sstevel@tonic-gate * Note: The following functions are used to enable the inclusion
2407c478bd9Sstevel@tonic-gate * of device specific options (see init_menus.c). But when we are
2417c478bd9Sstevel@tonic-gate * running non interactively with commands taken from a script file,
2427c478bd9Sstevel@tonic-gate * current disk (cur_disk, cur_type, cur_ctype) may not be defined.
2437c478bd9Sstevel@tonic-gate * They get defined when the script selects a disk using "disk" option
2447c478bd9Sstevel@tonic-gate * in the main menu. However, in the normal interactive mode, the disk
2457c478bd9Sstevel@tonic-gate * selection happens before entering the main menu.
2467c478bd9Sstevel@tonic-gate */
2477c478bd9Sstevel@tonic-gate /*
2487c478bd9Sstevel@tonic-gate * Return true for menu items enabled only for embedded SCSI controllers
2497c478bd9Sstevel@tonic-gate */
2507c478bd9Sstevel@tonic-gate int
embedded_scsi()2517c478bd9Sstevel@tonic-gate embedded_scsi()
2527c478bd9Sstevel@tonic-gate {
2537c478bd9Sstevel@tonic-gate if (cur_ctype == NULL && option_f)
2547c478bd9Sstevel@tonic-gate return (0);
2557c478bd9Sstevel@tonic-gate return (EMBEDDED_SCSI);
2567c478bd9Sstevel@tonic-gate }
2577c478bd9Sstevel@tonic-gate
2587c478bd9Sstevel@tonic-gate /*
2597c478bd9Sstevel@tonic-gate * Return false for menu items disabled only for embedded SCSI controllers
2607c478bd9Sstevel@tonic-gate */
2617c478bd9Sstevel@tonic-gate int
not_embedded_scsi()2627c478bd9Sstevel@tonic-gate not_embedded_scsi()
2637c478bd9Sstevel@tonic-gate {
2647c478bd9Sstevel@tonic-gate if (cur_ctype == NULL && option_f)
2657c478bd9Sstevel@tonic-gate return (0);
2667c478bd9Sstevel@tonic-gate return (!EMBEDDED_SCSI);
2677c478bd9Sstevel@tonic-gate }
2687c478bd9Sstevel@tonic-gate
2697c478bd9Sstevel@tonic-gate /*
2707c478bd9Sstevel@tonic-gate * Return false for menu items disabled for scsi controllers
2717c478bd9Sstevel@tonic-gate */
2727c478bd9Sstevel@tonic-gate int
not_scsi()2737c478bd9Sstevel@tonic-gate not_scsi()
2747c478bd9Sstevel@tonic-gate {
2757c478bd9Sstevel@tonic-gate if (cur_ctype == NULL && option_f)
2767c478bd9Sstevel@tonic-gate return (0);
2777c478bd9Sstevel@tonic-gate return (!SCSI);
2787c478bd9Sstevel@tonic-gate }
2797c478bd9Sstevel@tonic-gate
2807c478bd9Sstevel@tonic-gate /*
2817c478bd9Sstevel@tonic-gate * Return false for menu items disabled for efi labels
2827c478bd9Sstevel@tonic-gate */
2837c478bd9Sstevel@tonic-gate int
not_efi()2847c478bd9Sstevel@tonic-gate not_efi()
2857c478bd9Sstevel@tonic-gate {
2867c478bd9Sstevel@tonic-gate if ((cur_disk == NULL) && option_f)
2877c478bd9Sstevel@tonic-gate return (0);
2887c478bd9Sstevel@tonic-gate if (cur_disk->label_type == L_TYPE_EFI)
2897c478bd9Sstevel@tonic-gate return (0);
2907c478bd9Sstevel@tonic-gate return (1);
2917c478bd9Sstevel@tonic-gate }
2927c478bd9Sstevel@tonic-gate
2937c478bd9Sstevel@tonic-gate int
disp_expert_change_expert_efi()2947c478bd9Sstevel@tonic-gate disp_expert_change_expert_efi()
2957c478bd9Sstevel@tonic-gate {
2967c478bd9Sstevel@tonic-gate if ((cur_disk == NULL) && option_f)
2977c478bd9Sstevel@tonic-gate return (0);
2987c478bd9Sstevel@tonic-gate if ((cur_disk->label_type == L_TYPE_EFI) && expert_mode)
2997c478bd9Sstevel@tonic-gate return (1);
3007c478bd9Sstevel@tonic-gate if (cur_disk->label_type != L_TYPE_EFI)
3017c478bd9Sstevel@tonic-gate return (1);
3027c478bd9Sstevel@tonic-gate return (0);
3037c478bd9Sstevel@tonic-gate }
3047c478bd9Sstevel@tonic-gate
3057c478bd9Sstevel@tonic-gate int
disp_expand_efi()306*af007057Syl194034 disp_expand_efi()
307*af007057Syl194034 {
308*af007057Syl194034 if ((cur_disk == NULL) && option_f)
309*af007057Syl194034 return (0);
310*af007057Syl194034 if (cur_disk->label_type != L_TYPE_EFI)
311*af007057Syl194034 return (0);
312*af007057Syl194034 if (cur_parts == NULL)
313*af007057Syl194034 return (0);
314*af007057Syl194034 return (1);
315*af007057Syl194034 }
316*af007057Syl194034
317*af007057Syl194034 int
disp_all_change_expert_efi()3187c478bd9Sstevel@tonic-gate disp_all_change_expert_efi()
3197c478bd9Sstevel@tonic-gate {
3207c478bd9Sstevel@tonic-gate if ((cur_disk == NULL) && option_f)
3217c478bd9Sstevel@tonic-gate return (0);
3227c478bd9Sstevel@tonic-gate if ((cur_disk->label_type != L_TYPE_EFI) || (!expert_mode))
3237c478bd9Sstevel@tonic-gate return (0);
3247c478bd9Sstevel@tonic-gate return (1);
3257c478bd9Sstevel@tonic-gate }
3267c478bd9Sstevel@tonic-gate
3277c478bd9Sstevel@tonic-gate /*
3287c478bd9Sstevel@tonic-gate * Return true for menu items enabled scsi controllers
3297c478bd9Sstevel@tonic-gate */
3307c478bd9Sstevel@tonic-gate int
scsi()3317c478bd9Sstevel@tonic-gate scsi()
3327c478bd9Sstevel@tonic-gate {
3337c478bd9Sstevel@tonic-gate if (cur_ctype == NULL && option_f)
3347c478bd9Sstevel@tonic-gate return (0);
3357c478bd9Sstevel@tonic-gate return (SCSI);
3367c478bd9Sstevel@tonic-gate }
3377c478bd9Sstevel@tonic-gate
3387c478bd9Sstevel@tonic-gate
3397c478bd9Sstevel@tonic-gate /*
3407c478bd9Sstevel@tonic-gate * Return true for menu items enabled if expert mode is enabled
3417c478bd9Sstevel@tonic-gate */
3427c478bd9Sstevel@tonic-gate int
scsi_expert()3437c478bd9Sstevel@tonic-gate scsi_expert()
3447c478bd9Sstevel@tonic-gate {
3457c478bd9Sstevel@tonic-gate if (cur_ctype == NULL && option_f)
3467c478bd9Sstevel@tonic-gate return (0);
3477c478bd9Sstevel@tonic-gate return (SCSI && expert_mode);
3487c478bd9Sstevel@tonic-gate }
3497c478bd9Sstevel@tonic-gate
3507c478bd9Sstevel@tonic-gate #if defined(i386)
3517c478bd9Sstevel@tonic-gate /*
3527c478bd9Sstevel@tonic-gate * Return true for menu items enabled if expert mode is enabled
3537c478bd9Sstevel@tonic-gate */
3547c478bd9Sstevel@tonic-gate int
expert()3557c478bd9Sstevel@tonic-gate expert()
3567c478bd9Sstevel@tonic-gate {
3577c478bd9Sstevel@tonic-gate return (expert_mode);
3587c478bd9Sstevel@tonic-gate }
3597c478bd9Sstevel@tonic-gate #endif /* defined(i386) */
3607c478bd9Sstevel@tonic-gate
3617c478bd9Sstevel@tonic-gate /*
3627c478bd9Sstevel@tonic-gate * Return true for menu items enabled if developer mode is enabled
3637c478bd9Sstevel@tonic-gate */
3647c478bd9Sstevel@tonic-gate int
developer()3657c478bd9Sstevel@tonic-gate developer()
3667c478bd9Sstevel@tonic-gate {
3677c478bd9Sstevel@tonic-gate return (dev_expert);
3687c478bd9Sstevel@tonic-gate }
3697c478bd9Sstevel@tonic-gate
3707c478bd9Sstevel@tonic-gate /*
3717c478bd9Sstevel@tonic-gate * For x86, always return true for menu items enabled
3727c478bd9Sstevel@tonic-gate * since fdisk is already supported on these two platforms.
3737c478bd9Sstevel@tonic-gate * For Sparc, only return true for menu items enabled
3747c478bd9Sstevel@tonic-gate * if a PCATA disk is selected.
3757c478bd9Sstevel@tonic-gate */
3767c478bd9Sstevel@tonic-gate int
support_fdisk_on_sparc()3777c478bd9Sstevel@tonic-gate support_fdisk_on_sparc()
3787c478bd9Sstevel@tonic-gate {
3797c478bd9Sstevel@tonic-gate #if defined(sparc)
3807c478bd9Sstevel@tonic-gate /*
3817c478bd9Sstevel@tonic-gate * If it's a SCSI disk then we don't support fdisk and we
3827c478bd9Sstevel@tonic-gate * don't need to know the type cause we can ask the disk,
3837c478bd9Sstevel@tonic-gate * therefore we return true only if we *KNOW* it's an ATA
3847c478bd9Sstevel@tonic-gate * disk.
3857c478bd9Sstevel@tonic-gate */
3867c478bd9Sstevel@tonic-gate if (cur_ctype && cur_ctype->ctype_ctype == DKC_PCMCIA_ATA) {
3877c478bd9Sstevel@tonic-gate return (1);
3887c478bd9Sstevel@tonic-gate } else {
3897c478bd9Sstevel@tonic-gate return (0);
3907c478bd9Sstevel@tonic-gate }
3917c478bd9Sstevel@tonic-gate #elif defined(i386)
3927c478bd9Sstevel@tonic-gate return (1);
3937c478bd9Sstevel@tonic-gate #else
3947c478bd9Sstevel@tonic-gate #error No Platform defined
3957c478bd9Sstevel@tonic-gate #endif /* defined(sparc) */
3967c478bd9Sstevel@tonic-gate
3977c478bd9Sstevel@tonic-gate }
398