xref: /titanic_44/usr/src/cmd/format/prompts.c (revision 052b6e8a13e1fb4be51ba482db6bb2e9833fa717)
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
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
23*052b6e8aSbg159949  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate /*
307c478bd9Sstevel@tonic-gate  * This file contains functions to prompt the user for various
317c478bd9Sstevel@tonic-gate  * disk characteristics.  By isolating these into functions,
327c478bd9Sstevel@tonic-gate  * we can guarantee that prompts, defaults, etc are identical.
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate #include "global.h"
357c478bd9Sstevel@tonic-gate #include "prompts.h"
367c478bd9Sstevel@tonic-gate #include "io.h"
377c478bd9Sstevel@tonic-gate #include "param.h"
387c478bd9Sstevel@tonic-gate #include "startup.h"
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #ifdef sparc
417c478bd9Sstevel@tonic-gate #include <sys/hdio.h>
427c478bd9Sstevel@tonic-gate #endif
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate /*
467c478bd9Sstevel@tonic-gate  * Prompt for max number of LBA
477c478bd9Sstevel@tonic-gate  */
487c478bd9Sstevel@tonic-gate uint64_t
497c478bd9Sstevel@tonic-gate get_mlba()
507c478bd9Sstevel@tonic-gate {
517c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = (1024 * 16) + 68;
547c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = UINT_MAX64;
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate 	return (input(FIO_INT64, "Enter maximum number of LBAs",
577c478bd9Sstevel@tonic-gate 	    ':', &ioparam, (int *)NULL, DATA_INPUT));
587c478bd9Sstevel@tonic-gate }
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate /*
617c478bd9Sstevel@tonic-gate  * Prompt for number of cylinders
627c478bd9Sstevel@tonic-gate  */
637c478bd9Sstevel@tonic-gate int
647c478bd9Sstevel@tonic-gate get_ncyl()
657c478bd9Sstevel@tonic-gate {
667c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 1;
697c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_CYLS;
707c478bd9Sstevel@tonic-gate 	return (input(FIO_INT, "Enter number of data cylinders",
717c478bd9Sstevel@tonic-gate 	    ':', &ioparam, (int *)NULL, DATA_INPUT));
727c478bd9Sstevel@tonic-gate }
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate /*
757c478bd9Sstevel@tonic-gate  * Prompt for number of alternate cylinders
767c478bd9Sstevel@tonic-gate  */
777c478bd9Sstevel@tonic-gate int
787c478bd9Sstevel@tonic-gate get_acyl(n_cyls)
797c478bd9Sstevel@tonic-gate 	int		n_cyls;
807c478bd9Sstevel@tonic-gate {
817c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
827c478bd9Sstevel@tonic-gate 	int		deflt;
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 2;
857c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_CYLS - n_cyls;
867c478bd9Sstevel@tonic-gate 	deflt = 2;
877c478bd9Sstevel@tonic-gate 	return (input(FIO_INT, "Enter number of alternate cylinders", ':',
887c478bd9Sstevel@tonic-gate 	    &ioparam, &deflt, DATA_INPUT));
897c478bd9Sstevel@tonic-gate }
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate /*
927c478bd9Sstevel@tonic-gate  * Prompt for number of physical cylinders
937c478bd9Sstevel@tonic-gate  */
947c478bd9Sstevel@tonic-gate int
957c478bd9Sstevel@tonic-gate get_pcyl(n_cyls, a_cyls)
967c478bd9Sstevel@tonic-gate 	int		n_cyls;
977c478bd9Sstevel@tonic-gate 	int		a_cyls;
987c478bd9Sstevel@tonic-gate {
997c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
1007c478bd9Sstevel@tonic-gate 	int		deflt;
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = n_cyls + a_cyls;
1037c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_CYLS;
1047c478bd9Sstevel@tonic-gate 	deflt = n_cyls + a_cyls;
1057c478bd9Sstevel@tonic-gate 	return (input(FIO_INT, "Enter number of physical cylinders", ':',
1067c478bd9Sstevel@tonic-gate 	    &ioparam, &deflt, DATA_INPUT));
1077c478bd9Sstevel@tonic-gate }
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate /*
1107c478bd9Sstevel@tonic-gate  * Prompt for number of heads
1117c478bd9Sstevel@tonic-gate  */
1127c478bd9Sstevel@tonic-gate int
1137c478bd9Sstevel@tonic-gate get_nhead()
1147c478bd9Sstevel@tonic-gate {
1157c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 1;
1187c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_HEADS;
1197c478bd9Sstevel@tonic-gate 	return (input(FIO_INT, "Enter number of heads", ':',
1207c478bd9Sstevel@tonic-gate 	    &ioparam, (int *)NULL, DATA_INPUT));
1217c478bd9Sstevel@tonic-gate }
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate /*
1247c478bd9Sstevel@tonic-gate  * Prompt for number of physical heads
1257c478bd9Sstevel@tonic-gate  */
1267c478bd9Sstevel@tonic-gate int
1277c478bd9Sstevel@tonic-gate get_phead(n_heads, options)
1287c478bd9Sstevel@tonic-gate 	int		n_heads;
1297c478bd9Sstevel@tonic-gate 	ulong_t		*options;
1307c478bd9Sstevel@tonic-gate {
1317c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
1327c478bd9Sstevel@tonic-gate 	int		deflt;
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate 	if (SCSI) {
1357c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.lower = n_heads;
1367c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.upper = INFINITY;
1377c478bd9Sstevel@tonic-gate 		if (input(FIO_OPINT, "Enter physical number of heads",
1387c478bd9Sstevel@tonic-gate 				':', &ioparam, &deflt, DATA_INPUT)) {
1397c478bd9Sstevel@tonic-gate 			*options |= SUP_PHEAD;
1407c478bd9Sstevel@tonic-gate 			return (deflt);
1417c478bd9Sstevel@tonic-gate 		}
1427c478bd9Sstevel@tonic-gate 	}
1437c478bd9Sstevel@tonic-gate 	return (0);
1447c478bd9Sstevel@tonic-gate }
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate /*
1487c478bd9Sstevel@tonic-gate  * Prompt for number of sectors per track
1497c478bd9Sstevel@tonic-gate  */
1507c478bd9Sstevel@tonic-gate int
1517c478bd9Sstevel@tonic-gate get_nsect()
1527c478bd9Sstevel@tonic-gate {
1537c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
1547c478bd9Sstevel@tonic-gate 
1557c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 1;
1567c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_SECTS;
1577c478bd9Sstevel@tonic-gate 	return (input(FIO_INT,
1587c478bd9Sstevel@tonic-gate 	    "Enter number of data sectors/track", ':',
1597c478bd9Sstevel@tonic-gate 	    &ioparam, (int *)NULL, DATA_INPUT));
1607c478bd9Sstevel@tonic-gate }
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate /*
1637c478bd9Sstevel@tonic-gate  * Prompt for number of physical sectors per track
1647c478bd9Sstevel@tonic-gate  */
1657c478bd9Sstevel@tonic-gate int
1667c478bd9Sstevel@tonic-gate get_psect(options)
1677c478bd9Sstevel@tonic-gate 	ulong_t		*options;
1687c478bd9Sstevel@tonic-gate {
1697c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
1707c478bd9Sstevel@tonic-gate 	int		deflt;
1717c478bd9Sstevel@tonic-gate 
1727c478bd9Sstevel@tonic-gate 	if (SCSI) {
1737c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.lower = 0;
1747c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.upper = INFINITY;
1757c478bd9Sstevel@tonic-gate 		if (input(FIO_OPINT, "Enter number of physical sectors/track",
1767c478bd9Sstevel@tonic-gate 				':', &ioparam, &deflt, DATA_INPUT)) {
1777c478bd9Sstevel@tonic-gate 			*options |= SUP_PSECT;
1787c478bd9Sstevel@tonic-gate 			return (deflt);
1797c478bd9Sstevel@tonic-gate 		}
1807c478bd9Sstevel@tonic-gate 	}
1817c478bd9Sstevel@tonic-gate 	return (0);
1827c478bd9Sstevel@tonic-gate }
1837c478bd9Sstevel@tonic-gate 
1847c478bd9Sstevel@tonic-gate /*
1857c478bd9Sstevel@tonic-gate  * Prompt for bytes per track
1867c478bd9Sstevel@tonic-gate  */
1877c478bd9Sstevel@tonic-gate int
1887c478bd9Sstevel@tonic-gate get_bpt(n_sects, options)
1897c478bd9Sstevel@tonic-gate 	int		n_sects;
1907c478bd9Sstevel@tonic-gate 	ulong_t		*options;
1917c478bd9Sstevel@tonic-gate {
1927c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
1937c478bd9Sstevel@tonic-gate 	int		deflt;
1947c478bd9Sstevel@tonic-gate 
1957c478bd9Sstevel@tonic-gate 	if (SMD) {
1967c478bd9Sstevel@tonic-gate 		*options |= SUP_BPT;
1977c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.lower = 1;
1987c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.upper = INFINITY;
1997c478bd9Sstevel@tonic-gate 		deflt = n_sects * SECSIZE;
2007c478bd9Sstevel@tonic-gate 		return (input(FIO_INT, "Enter number of bytes/track",
2017c478bd9Sstevel@tonic-gate 				':', &ioparam, &deflt, DATA_INPUT));
2027c478bd9Sstevel@tonic-gate 	}
2037c478bd9Sstevel@tonic-gate 
2047c478bd9Sstevel@tonic-gate 	return (0);
2057c478bd9Sstevel@tonic-gate }
2067c478bd9Sstevel@tonic-gate 
2077c478bd9Sstevel@tonic-gate /*
2087c478bd9Sstevel@tonic-gate  * Prompt for rpm
2097c478bd9Sstevel@tonic-gate  */
2107c478bd9Sstevel@tonic-gate int
2117c478bd9Sstevel@tonic-gate get_rpm()
2127c478bd9Sstevel@tonic-gate {
2137c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
2147c478bd9Sstevel@tonic-gate 	int		deflt;
2157c478bd9Sstevel@tonic-gate 
2167c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = MIN_RPM;
2177c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_RPM;
2187c478bd9Sstevel@tonic-gate 	deflt = AVG_RPM;
2197c478bd9Sstevel@tonic-gate 	return (input(FIO_INT, "Enter rpm of drive", ':',
2207c478bd9Sstevel@tonic-gate 	    &ioparam, &deflt, DATA_INPUT));
2217c478bd9Sstevel@tonic-gate }
2227c478bd9Sstevel@tonic-gate 
2237c478bd9Sstevel@tonic-gate /*
2247c478bd9Sstevel@tonic-gate  * Prompt for formatting time
2257c478bd9Sstevel@tonic-gate  */
2267c478bd9Sstevel@tonic-gate int
2277c478bd9Sstevel@tonic-gate get_fmt_time(options)
2287c478bd9Sstevel@tonic-gate 	ulong_t		*options;
2297c478bd9Sstevel@tonic-gate {
2307c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
2317c478bd9Sstevel@tonic-gate 	int		deflt;
2327c478bd9Sstevel@tonic-gate 
2337c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
2347c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
2357c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter format time", ':',
2367c478bd9Sstevel@tonic-gate 			&ioparam, &deflt, DATA_INPUT)) {
2377c478bd9Sstevel@tonic-gate 		*options |= SUP_FMTTIME;
2387c478bd9Sstevel@tonic-gate 		return (deflt);
2397c478bd9Sstevel@tonic-gate 	}
2407c478bd9Sstevel@tonic-gate 	return (0);
2417c478bd9Sstevel@tonic-gate }
2427c478bd9Sstevel@tonic-gate 
2437c478bd9Sstevel@tonic-gate /*
2447c478bd9Sstevel@tonic-gate  * Prompt for cylinder skew
2457c478bd9Sstevel@tonic-gate  */
2467c478bd9Sstevel@tonic-gate int
2477c478bd9Sstevel@tonic-gate get_cyl_skew(options)
2487c478bd9Sstevel@tonic-gate 	ulong_t		*options;
2497c478bd9Sstevel@tonic-gate {
2507c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
2517c478bd9Sstevel@tonic-gate 	int		deflt;
2527c478bd9Sstevel@tonic-gate 
2537c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
2547c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
2557c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter cylinder skew", ':',
2567c478bd9Sstevel@tonic-gate 			&ioparam, &deflt, DATA_INPUT)) {
2577c478bd9Sstevel@tonic-gate 		*options |= SUP_CYLSKEW;
2587c478bd9Sstevel@tonic-gate 		return (deflt);
2597c478bd9Sstevel@tonic-gate 	}
2607c478bd9Sstevel@tonic-gate 	return (0);
2617c478bd9Sstevel@tonic-gate }
2627c478bd9Sstevel@tonic-gate 
2637c478bd9Sstevel@tonic-gate /*
2647c478bd9Sstevel@tonic-gate  * Prompt for track skew
2657c478bd9Sstevel@tonic-gate  */
2667c478bd9Sstevel@tonic-gate int
2677c478bd9Sstevel@tonic-gate get_trk_skew(options)
2687c478bd9Sstevel@tonic-gate 	ulong_t		*options;
2697c478bd9Sstevel@tonic-gate {
2707c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
2717c478bd9Sstevel@tonic-gate 	int		deflt;
2727c478bd9Sstevel@tonic-gate 
2737c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
2747c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
2757c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter track skew", ':',
2767c478bd9Sstevel@tonic-gate 			&ioparam, &deflt, DATA_INPUT)) {
2777c478bd9Sstevel@tonic-gate 		*options |= SUP_TRKSKEW;
2787c478bd9Sstevel@tonic-gate 		return (deflt);
2797c478bd9Sstevel@tonic-gate 	}
2807c478bd9Sstevel@tonic-gate 	return (0);
2817c478bd9Sstevel@tonic-gate }
2827c478bd9Sstevel@tonic-gate 
2837c478bd9Sstevel@tonic-gate /*
2847c478bd9Sstevel@tonic-gate  * Prompt for tracks per zone
2857c478bd9Sstevel@tonic-gate  */
2867c478bd9Sstevel@tonic-gate int
2877c478bd9Sstevel@tonic-gate get_trks_zone(options)
2887c478bd9Sstevel@tonic-gate 	ulong_t		*options;
2897c478bd9Sstevel@tonic-gate {
2907c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
2917c478bd9Sstevel@tonic-gate 	int		deflt;
2927c478bd9Sstevel@tonic-gate 
2937c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
2947c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
2957c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter tracks per zone", ':',
2967c478bd9Sstevel@tonic-gate 			&ioparam, &deflt, DATA_INPUT)) {
2977c478bd9Sstevel@tonic-gate 		*options |= SUP_TRKS_ZONE;
2987c478bd9Sstevel@tonic-gate 		return (deflt);
2997c478bd9Sstevel@tonic-gate 	}
3007c478bd9Sstevel@tonic-gate 	return (0);
3017c478bd9Sstevel@tonic-gate }
3027c478bd9Sstevel@tonic-gate 
3037c478bd9Sstevel@tonic-gate /*
3047c478bd9Sstevel@tonic-gate  * Prompt for alternate tracks
3057c478bd9Sstevel@tonic-gate  */
3067c478bd9Sstevel@tonic-gate int
3077c478bd9Sstevel@tonic-gate get_atrks(options)
3087c478bd9Sstevel@tonic-gate 	ulong_t		*options;
3097c478bd9Sstevel@tonic-gate {
3107c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
3117c478bd9Sstevel@tonic-gate 	int		deflt;
3127c478bd9Sstevel@tonic-gate 
3137c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
3147c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
3157c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter alternate tracks", ':',
3167c478bd9Sstevel@tonic-gate 			&ioparam, &deflt, DATA_INPUT)) {
3177c478bd9Sstevel@tonic-gate 		*options |= SUP_ATRKS;
3187c478bd9Sstevel@tonic-gate 		return (deflt);
3197c478bd9Sstevel@tonic-gate 	}
3207c478bd9Sstevel@tonic-gate 	return (0);
3217c478bd9Sstevel@tonic-gate }
3227c478bd9Sstevel@tonic-gate 
3237c478bd9Sstevel@tonic-gate /*
3247c478bd9Sstevel@tonic-gate  * Prompt for alternate sectors
3257c478bd9Sstevel@tonic-gate  */
3267c478bd9Sstevel@tonic-gate int
3277c478bd9Sstevel@tonic-gate get_asect(options)
3287c478bd9Sstevel@tonic-gate 	ulong_t		*options;
3297c478bd9Sstevel@tonic-gate {
3307c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
3317c478bd9Sstevel@tonic-gate 	int		deflt;
3327c478bd9Sstevel@tonic-gate 
3337c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
3347c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
3357c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter alternate sectors", ':',
3367c478bd9Sstevel@tonic-gate 			&ioparam, &deflt, DATA_INPUT)) {
3377c478bd9Sstevel@tonic-gate 		*options |= SUP_ASECT;
3387c478bd9Sstevel@tonic-gate 		return (deflt);
3397c478bd9Sstevel@tonic-gate 	}
3407c478bd9Sstevel@tonic-gate 	return (0);
3417c478bd9Sstevel@tonic-gate }
3427c478bd9Sstevel@tonic-gate 
3437c478bd9Sstevel@tonic-gate /*
3447c478bd9Sstevel@tonic-gate  * Prompt for cache setting
3457c478bd9Sstevel@tonic-gate  */
3467c478bd9Sstevel@tonic-gate int
3477c478bd9Sstevel@tonic-gate get_cache(options)
3487c478bd9Sstevel@tonic-gate 	ulong_t		*options;
3497c478bd9Sstevel@tonic-gate {
3507c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
3517c478bd9Sstevel@tonic-gate 	int		deflt;
3527c478bd9Sstevel@tonic-gate 
3537c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
3547c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = 0xff;
3557c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter cache control", ':',
3567c478bd9Sstevel@tonic-gate 			&ioparam, &deflt, DATA_INPUT)) {
3577c478bd9Sstevel@tonic-gate 		*options |= SUP_CACHE;
3587c478bd9Sstevel@tonic-gate 		return (deflt);
3597c478bd9Sstevel@tonic-gate 	}
3607c478bd9Sstevel@tonic-gate 	return (0);
3617c478bd9Sstevel@tonic-gate }
3627c478bd9Sstevel@tonic-gate 
3637c478bd9Sstevel@tonic-gate /*
3647c478bd9Sstevel@tonic-gate  * Prompt for prefetch threshold
3657c478bd9Sstevel@tonic-gate  */
3667c478bd9Sstevel@tonic-gate int
3677c478bd9Sstevel@tonic-gate get_threshold(options)
3687c478bd9Sstevel@tonic-gate 	ulong_t		*options;
3697c478bd9Sstevel@tonic-gate {
3707c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
3717c478bd9Sstevel@tonic-gate 	int		deflt;
3727c478bd9Sstevel@tonic-gate 
3737c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
3747c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
3757c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter prefetch threshold",
3767c478bd9Sstevel@tonic-gate 			':', &ioparam, &deflt, DATA_INPUT)) {
3777c478bd9Sstevel@tonic-gate 		*options |= SUP_PREFETCH;
3787c478bd9Sstevel@tonic-gate 		return (deflt);
3797c478bd9Sstevel@tonic-gate 	}
3807c478bd9Sstevel@tonic-gate 	return (0);
3817c478bd9Sstevel@tonic-gate }
3827c478bd9Sstevel@tonic-gate 
3837c478bd9Sstevel@tonic-gate /*
3847c478bd9Sstevel@tonic-gate  * Prompt for minimum prefetch
3857c478bd9Sstevel@tonic-gate  */
3867c478bd9Sstevel@tonic-gate int
3877c478bd9Sstevel@tonic-gate get_min_prefetch(options)
3887c478bd9Sstevel@tonic-gate 	ulong_t		*options;
3897c478bd9Sstevel@tonic-gate {
3907c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
3917c478bd9Sstevel@tonic-gate 	int		deflt;
3927c478bd9Sstevel@tonic-gate 
3937c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
3947c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
3957c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter minimum prefetch",
3967c478bd9Sstevel@tonic-gate 			':', &ioparam, &deflt, DATA_INPUT)) {
3977c478bd9Sstevel@tonic-gate 		*options |= SUP_CACHE_MIN;
3987c478bd9Sstevel@tonic-gate 		return (deflt);
3997c478bd9Sstevel@tonic-gate 	}
4007c478bd9Sstevel@tonic-gate 	return (0);
4017c478bd9Sstevel@tonic-gate }
4027c478bd9Sstevel@tonic-gate 
4037c478bd9Sstevel@tonic-gate /*
4047c478bd9Sstevel@tonic-gate  * Prompt for maximum prefetch
4057c478bd9Sstevel@tonic-gate  */
4067c478bd9Sstevel@tonic-gate int
4077c478bd9Sstevel@tonic-gate get_max_prefetch(min_prefetch, options)
4087c478bd9Sstevel@tonic-gate 	int		min_prefetch;
4097c478bd9Sstevel@tonic-gate 	ulong_t		*options;
4107c478bd9Sstevel@tonic-gate {
4117c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
4127c478bd9Sstevel@tonic-gate 	int		deflt;
4137c478bd9Sstevel@tonic-gate 
4147c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = min_prefetch;
4157c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
4167c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter maximum prefetch",
4177c478bd9Sstevel@tonic-gate 			':', &ioparam, &deflt, DATA_INPUT)) {
4187c478bd9Sstevel@tonic-gate 		*options |= SUP_CACHE_MAX;
4197c478bd9Sstevel@tonic-gate 		return (deflt);
4207c478bd9Sstevel@tonic-gate 	}
4217c478bd9Sstevel@tonic-gate 	return (0);
4227c478bd9Sstevel@tonic-gate }
4237c478bd9Sstevel@tonic-gate 
4247c478bd9Sstevel@tonic-gate /*
4257c478bd9Sstevel@tonic-gate  * Prompt for bytes per sector
4267c478bd9Sstevel@tonic-gate  */
4277c478bd9Sstevel@tonic-gate int
4287c478bd9Sstevel@tonic-gate get_bps()
4297c478bd9Sstevel@tonic-gate {
4307c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
4317c478bd9Sstevel@tonic-gate 	int		deflt;
4327c478bd9Sstevel@tonic-gate 
4337c478bd9Sstevel@tonic-gate 	if (cur_ctype->ctype_flags & CF_SMD_DEFS) {
4347c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.lower = MIN_BPS;
4357c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.upper = MAX_BPS;
4367c478bd9Sstevel@tonic-gate 		deflt = AVG_BPS;
4377c478bd9Sstevel@tonic-gate 		return (input(FIO_INT, "Enter bytes per sector",
4387c478bd9Sstevel@tonic-gate 			':', &ioparam, &deflt, DATA_INPUT));
4397c478bd9Sstevel@tonic-gate 	}
4407c478bd9Sstevel@tonic-gate 
4417c478bd9Sstevel@tonic-gate 	return (0);
4427c478bd9Sstevel@tonic-gate }
4437c478bd9Sstevel@tonic-gate 
4447c478bd9Sstevel@tonic-gate /*
4457c478bd9Sstevel@tonic-gate  * Prompt for ascii label
4467c478bd9Sstevel@tonic-gate  */
4477c478bd9Sstevel@tonic-gate char *
4487c478bd9Sstevel@tonic-gate get_asciilabel()
4497c478bd9Sstevel@tonic-gate {
450*052b6e8aSbg159949 	return ((char *)(uintptr_t)input(FIO_OSTR,
4517c478bd9Sstevel@tonic-gate 	    "Enter disk type name (remember quotes)", ':',
4527c478bd9Sstevel@tonic-gate 	    (u_ioparam_t *)NULL, (int *)NULL, DATA_INPUT));
4537c478bd9Sstevel@tonic-gate }
454