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