xref: /illumos-gate/usr/src/cmd/format/prompts.c (revision b12aaafbf56c5a06b6cfd21655531a33e38a8ed9)
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
565908c77Syu, larry liu - Sun Microsystems - Beijing China  * Common Development and Distribution License (the "License").
665908c77Syu, 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 /*
2265908c77Syu, 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
get_mlba(void)46*b12aaafbSToomas Soome get_mlba(void)
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",
54*b12aaafbSToomas Soome 	    ':', &ioparam, 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
get_ncyl(void)61*b12aaafbSToomas Soome get_ncyl(void)
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",
68*b12aaafbSToomas Soome 	    ':', &ioparam, 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
get_acyl(int n_cyls)75*b12aaafbSToomas Soome get_acyl(int n_cyls)
767c478bd9Sstevel@tonic-gate {
777c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
787c478bd9Sstevel@tonic-gate 	int		deflt;
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 2;
817c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_CYLS - n_cyls;
827c478bd9Sstevel@tonic-gate 	deflt = 2;
837c478bd9Sstevel@tonic-gate 	return (input(FIO_INT, "Enter number of alternate cylinders", ':',
847c478bd9Sstevel@tonic-gate 	    &ioparam, &deflt, DATA_INPUT));
857c478bd9Sstevel@tonic-gate }
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate /*
887c478bd9Sstevel@tonic-gate  * Prompt for number of physical cylinders
897c478bd9Sstevel@tonic-gate  */
907c478bd9Sstevel@tonic-gate int
get_pcyl(int n_cyls,int a_cyls)91*b12aaafbSToomas Soome get_pcyl(int n_cyls, int a_cyls)
927c478bd9Sstevel@tonic-gate {
937c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
947c478bd9Sstevel@tonic-gate 	int		deflt;
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = n_cyls + a_cyls;
977c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_CYLS;
987c478bd9Sstevel@tonic-gate 	deflt = n_cyls + a_cyls;
997c478bd9Sstevel@tonic-gate 	return (input(FIO_INT, "Enter number of physical cylinders", ':',
1007c478bd9Sstevel@tonic-gate 	    &ioparam, &deflt, DATA_INPUT));
1017c478bd9Sstevel@tonic-gate }
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate /*
1047c478bd9Sstevel@tonic-gate  * Prompt for number of heads
1057c478bd9Sstevel@tonic-gate  */
1067c478bd9Sstevel@tonic-gate int
get_nhead(void)107*b12aaafbSToomas Soome get_nhead(void)
1087c478bd9Sstevel@tonic-gate {
1097c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 1;
1127c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_HEADS;
1137c478bd9Sstevel@tonic-gate 	return (input(FIO_INT, "Enter number of heads", ':',
114*b12aaafbSToomas Soome 	    &ioparam, NULL, DATA_INPUT));
1157c478bd9Sstevel@tonic-gate }
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate /*
1187c478bd9Sstevel@tonic-gate  * Prompt for number of physical heads
1197c478bd9Sstevel@tonic-gate  */
1207c478bd9Sstevel@tonic-gate int
get_phead(int n_heads,ulong_t * options)121*b12aaafbSToomas Soome get_phead(int n_heads, ulong_t *options)
1227c478bd9Sstevel@tonic-gate {
1237c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
1247c478bd9Sstevel@tonic-gate 	int		deflt;
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate 	if (SCSI) {
1277c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.lower = n_heads;
1287c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.upper = INFINITY;
1297c478bd9Sstevel@tonic-gate 		if (input(FIO_OPINT, "Enter physical number of heads",
1307c478bd9Sstevel@tonic-gate 		    ':', &ioparam, &deflt, DATA_INPUT)) {
1317c478bd9Sstevel@tonic-gate 			*options |= SUP_PHEAD;
1327c478bd9Sstevel@tonic-gate 			return (deflt);
1337c478bd9Sstevel@tonic-gate 		}
1347c478bd9Sstevel@tonic-gate 	}
1357c478bd9Sstevel@tonic-gate 	return (0);
1367c478bd9Sstevel@tonic-gate }
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate /*
1407c478bd9Sstevel@tonic-gate  * Prompt for number of sectors per track
1417c478bd9Sstevel@tonic-gate  */
1427c478bd9Sstevel@tonic-gate int
get_nsect(void)143*b12aaafbSToomas Soome get_nsect(void)
1447c478bd9Sstevel@tonic-gate {
1457c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 1;
1487c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_SECTS;
1497c478bd9Sstevel@tonic-gate 	return (input(FIO_INT,
1507c478bd9Sstevel@tonic-gate 	    "Enter number of data sectors/track", ':',
151*b12aaafbSToomas Soome 	    &ioparam, NULL, DATA_INPUT));
1527c478bd9Sstevel@tonic-gate }
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate /*
1557c478bd9Sstevel@tonic-gate  * Prompt for number of physical sectors per track
1567c478bd9Sstevel@tonic-gate  */
1577c478bd9Sstevel@tonic-gate int
get_psect(ulong_t * options)158*b12aaafbSToomas Soome get_psect(ulong_t *options)
1597c478bd9Sstevel@tonic-gate {
1607c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
1617c478bd9Sstevel@tonic-gate 	int		deflt;
1627c478bd9Sstevel@tonic-gate 
1637c478bd9Sstevel@tonic-gate 	if (SCSI) {
1647c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.lower = 0;
1657c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.upper = INFINITY;
1667c478bd9Sstevel@tonic-gate 		if (input(FIO_OPINT, "Enter number of physical sectors/track",
1677c478bd9Sstevel@tonic-gate 		    ':', &ioparam, &deflt, DATA_INPUT)) {
1687c478bd9Sstevel@tonic-gate 			*options |= SUP_PSECT;
1697c478bd9Sstevel@tonic-gate 			return (deflt);
1707c478bd9Sstevel@tonic-gate 		}
1717c478bd9Sstevel@tonic-gate 	}
1727c478bd9Sstevel@tonic-gate 	return (0);
1737c478bd9Sstevel@tonic-gate }
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate /*
1767c478bd9Sstevel@tonic-gate  * Prompt for bytes per track
1777c478bd9Sstevel@tonic-gate  */
1787c478bd9Sstevel@tonic-gate int
get_bpt(int n_sects,ulong_t * options)179*b12aaafbSToomas Soome get_bpt(int n_sects, ulong_t *options)
1807c478bd9Sstevel@tonic-gate {
1817c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
1827c478bd9Sstevel@tonic-gate 	int		deflt;
1837c478bd9Sstevel@tonic-gate 
1847c478bd9Sstevel@tonic-gate 	if (SMD) {
1857c478bd9Sstevel@tonic-gate 		*options |= SUP_BPT;
1867c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.lower = 1;
1877c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.upper = INFINITY;
18865908c77Syu, larry liu - Sun Microsystems - Beijing China 		deflt = n_sects * cur_blksz;
1897c478bd9Sstevel@tonic-gate 		return (input(FIO_INT, "Enter number of bytes/track",
1907c478bd9Sstevel@tonic-gate 		    ':', &ioparam, &deflt, DATA_INPUT));
1917c478bd9Sstevel@tonic-gate 	}
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate 	return (0);
1947c478bd9Sstevel@tonic-gate }
1957c478bd9Sstevel@tonic-gate 
1967c478bd9Sstevel@tonic-gate /*
1977c478bd9Sstevel@tonic-gate  * Prompt for rpm
1987c478bd9Sstevel@tonic-gate  */
1997c478bd9Sstevel@tonic-gate int
get_rpm(void)200*b12aaafbSToomas Soome get_rpm(void)
2017c478bd9Sstevel@tonic-gate {
2027c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
2037c478bd9Sstevel@tonic-gate 	int		deflt;
2047c478bd9Sstevel@tonic-gate 
2057c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = MIN_RPM;
2067c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_RPM;
2077c478bd9Sstevel@tonic-gate 	deflt = AVG_RPM;
2087c478bd9Sstevel@tonic-gate 	return (input(FIO_INT, "Enter rpm of drive", ':',
2097c478bd9Sstevel@tonic-gate 	    &ioparam, &deflt, DATA_INPUT));
2107c478bd9Sstevel@tonic-gate }
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate /*
2137c478bd9Sstevel@tonic-gate  * Prompt for formatting time
2147c478bd9Sstevel@tonic-gate  */
2157c478bd9Sstevel@tonic-gate int
get_fmt_time(ulong_t * options)216*b12aaafbSToomas Soome get_fmt_time(ulong_t *options)
2177c478bd9Sstevel@tonic-gate {
2187c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
2197c478bd9Sstevel@tonic-gate 	int		deflt;
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
2227c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
2237c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter format time", ':',
2247c478bd9Sstevel@tonic-gate 	    &ioparam, &deflt, DATA_INPUT)) {
2257c478bd9Sstevel@tonic-gate 		*options |= SUP_FMTTIME;
2267c478bd9Sstevel@tonic-gate 		return (deflt);
2277c478bd9Sstevel@tonic-gate 	}
2287c478bd9Sstevel@tonic-gate 	return (0);
2297c478bd9Sstevel@tonic-gate }
2307c478bd9Sstevel@tonic-gate 
2317c478bd9Sstevel@tonic-gate /*
2327c478bd9Sstevel@tonic-gate  * Prompt for cylinder skew
2337c478bd9Sstevel@tonic-gate  */
2347c478bd9Sstevel@tonic-gate int
get_cyl_skew(ulong_t * options)235*b12aaafbSToomas Soome get_cyl_skew(ulong_t *options)
2367c478bd9Sstevel@tonic-gate {
2377c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
2387c478bd9Sstevel@tonic-gate 	int		deflt;
2397c478bd9Sstevel@tonic-gate 
2407c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
2417c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
2427c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter cylinder skew", ':',
2437c478bd9Sstevel@tonic-gate 	    &ioparam, &deflt, DATA_INPUT)) {
2447c478bd9Sstevel@tonic-gate 		*options |= SUP_CYLSKEW;
2457c478bd9Sstevel@tonic-gate 		return (deflt);
2467c478bd9Sstevel@tonic-gate 	}
2477c478bd9Sstevel@tonic-gate 	return (0);
2487c478bd9Sstevel@tonic-gate }
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate /*
2517c478bd9Sstevel@tonic-gate  * Prompt for track skew
2527c478bd9Sstevel@tonic-gate  */
2537c478bd9Sstevel@tonic-gate int
get_trk_skew(ulong_t * options)254*b12aaafbSToomas Soome get_trk_skew(ulong_t *options)
2557c478bd9Sstevel@tonic-gate {
2567c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
2577c478bd9Sstevel@tonic-gate 	int		deflt;
2587c478bd9Sstevel@tonic-gate 
2597c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
2607c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
2617c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter track skew", ':',
2627c478bd9Sstevel@tonic-gate 	    &ioparam, &deflt, DATA_INPUT)) {
2637c478bd9Sstevel@tonic-gate 		*options |= SUP_TRKSKEW;
2647c478bd9Sstevel@tonic-gate 		return (deflt);
2657c478bd9Sstevel@tonic-gate 	}
2667c478bd9Sstevel@tonic-gate 	return (0);
2677c478bd9Sstevel@tonic-gate }
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate /*
2707c478bd9Sstevel@tonic-gate  * Prompt for tracks per zone
2717c478bd9Sstevel@tonic-gate  */
2727c478bd9Sstevel@tonic-gate int
get_trks_zone(ulong_t * options)273*b12aaafbSToomas Soome get_trks_zone(ulong_t *options)
2747c478bd9Sstevel@tonic-gate {
2757c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
2767c478bd9Sstevel@tonic-gate 	int		deflt;
2777c478bd9Sstevel@tonic-gate 
2787c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
2797c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
2807c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter tracks per zone", ':',
2817c478bd9Sstevel@tonic-gate 	    &ioparam, &deflt, DATA_INPUT)) {
2827c478bd9Sstevel@tonic-gate 		*options |= SUP_TRKS_ZONE;
2837c478bd9Sstevel@tonic-gate 		return (deflt);
2847c478bd9Sstevel@tonic-gate 	}
2857c478bd9Sstevel@tonic-gate 	return (0);
2867c478bd9Sstevel@tonic-gate }
2877c478bd9Sstevel@tonic-gate 
2887c478bd9Sstevel@tonic-gate /*
2897c478bd9Sstevel@tonic-gate  * Prompt for alternate tracks
2907c478bd9Sstevel@tonic-gate  */
2917c478bd9Sstevel@tonic-gate int
get_atrks(ulong_t * options)292*b12aaafbSToomas Soome get_atrks(ulong_t *options)
2937c478bd9Sstevel@tonic-gate {
2947c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
2957c478bd9Sstevel@tonic-gate 	int		deflt;
2967c478bd9Sstevel@tonic-gate 
2977c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
2987c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
2997c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter alternate tracks", ':',
3007c478bd9Sstevel@tonic-gate 	    &ioparam, &deflt, DATA_INPUT)) {
3017c478bd9Sstevel@tonic-gate 		*options |= SUP_ATRKS;
3027c478bd9Sstevel@tonic-gate 		return (deflt);
3037c478bd9Sstevel@tonic-gate 	}
3047c478bd9Sstevel@tonic-gate 	return (0);
3057c478bd9Sstevel@tonic-gate }
3067c478bd9Sstevel@tonic-gate 
3077c478bd9Sstevel@tonic-gate /*
3087c478bd9Sstevel@tonic-gate  * Prompt for alternate sectors
3097c478bd9Sstevel@tonic-gate  */
3107c478bd9Sstevel@tonic-gate int
get_asect(ulong_t * options)311*b12aaafbSToomas Soome get_asect(ulong_t *options)
3127c478bd9Sstevel@tonic-gate {
3137c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
3147c478bd9Sstevel@tonic-gate 	int		deflt;
3157c478bd9Sstevel@tonic-gate 
3167c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
3177c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
3187c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter alternate sectors", ':',
3197c478bd9Sstevel@tonic-gate 	    &ioparam, &deflt, DATA_INPUT)) {
3207c478bd9Sstevel@tonic-gate 		*options |= SUP_ASECT;
3217c478bd9Sstevel@tonic-gate 		return (deflt);
3227c478bd9Sstevel@tonic-gate 	}
3237c478bd9Sstevel@tonic-gate 	return (0);
3247c478bd9Sstevel@tonic-gate }
3257c478bd9Sstevel@tonic-gate 
3267c478bd9Sstevel@tonic-gate /*
3277c478bd9Sstevel@tonic-gate  * Prompt for cache setting
3287c478bd9Sstevel@tonic-gate  */
3297c478bd9Sstevel@tonic-gate int
get_cache(ulong_t * options)330*b12aaafbSToomas Soome get_cache(ulong_t *options)
3317c478bd9Sstevel@tonic-gate {
3327c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
3337c478bd9Sstevel@tonic-gate 	int		deflt;
3347c478bd9Sstevel@tonic-gate 
3357c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
3367c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = 0xff;
3377c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter cache control", ':',
3387c478bd9Sstevel@tonic-gate 	    &ioparam, &deflt, DATA_INPUT)) {
3397c478bd9Sstevel@tonic-gate 		*options |= SUP_CACHE;
3407c478bd9Sstevel@tonic-gate 		return (deflt);
3417c478bd9Sstevel@tonic-gate 	}
3427c478bd9Sstevel@tonic-gate 	return (0);
3437c478bd9Sstevel@tonic-gate }
3447c478bd9Sstevel@tonic-gate 
3457c478bd9Sstevel@tonic-gate /*
3467c478bd9Sstevel@tonic-gate  * Prompt for prefetch threshold
3477c478bd9Sstevel@tonic-gate  */
3487c478bd9Sstevel@tonic-gate int
get_threshold(ulong_t * options)349*b12aaafbSToomas Soome get_threshold(ulong_t *options)
3507c478bd9Sstevel@tonic-gate {
3517c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
3527c478bd9Sstevel@tonic-gate 	int		deflt;
3537c478bd9Sstevel@tonic-gate 
3547c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
3557c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
3567c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter prefetch threshold",
3577c478bd9Sstevel@tonic-gate 	    ':', &ioparam, &deflt, DATA_INPUT)) {
3587c478bd9Sstevel@tonic-gate 		*options |= SUP_PREFETCH;
3597c478bd9Sstevel@tonic-gate 		return (deflt);
3607c478bd9Sstevel@tonic-gate 	}
3617c478bd9Sstevel@tonic-gate 	return (0);
3627c478bd9Sstevel@tonic-gate }
3637c478bd9Sstevel@tonic-gate 
3647c478bd9Sstevel@tonic-gate /*
3657c478bd9Sstevel@tonic-gate  * Prompt for minimum prefetch
3667c478bd9Sstevel@tonic-gate  */
3677c478bd9Sstevel@tonic-gate int
get_min_prefetch(ulong_t * options)368*b12aaafbSToomas Soome get_min_prefetch(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 minimum prefetch",
3767c478bd9Sstevel@tonic-gate 	    ':', &ioparam, &deflt, DATA_INPUT)) {
3777c478bd9Sstevel@tonic-gate 		*options |= SUP_CACHE_MIN;
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 maximum prefetch
3857c478bd9Sstevel@tonic-gate  */
3867c478bd9Sstevel@tonic-gate int
get_max_prefetch(int min_prefetch,ulong_t * options)387*b12aaafbSToomas Soome get_max_prefetch(int min_prefetch, ulong_t *options)
3887c478bd9Sstevel@tonic-gate {
3897c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
3907c478bd9Sstevel@tonic-gate 	int		deflt;
3917c478bd9Sstevel@tonic-gate 
3927c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = min_prefetch;
3937c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
3947c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter maximum prefetch",
3957c478bd9Sstevel@tonic-gate 	    ':', &ioparam, &deflt, DATA_INPUT)) {
3967c478bd9Sstevel@tonic-gate 		*options |= SUP_CACHE_MAX;
3977c478bd9Sstevel@tonic-gate 		return (deflt);
3987c478bd9Sstevel@tonic-gate 	}
3997c478bd9Sstevel@tonic-gate 	return (0);
4007c478bd9Sstevel@tonic-gate }
4017c478bd9Sstevel@tonic-gate 
4027c478bd9Sstevel@tonic-gate /*
4037c478bd9Sstevel@tonic-gate  * Prompt for bytes per sector
4047c478bd9Sstevel@tonic-gate  */
4057c478bd9Sstevel@tonic-gate int
get_bps(void)406*b12aaafbSToomas Soome get_bps(void)
4077c478bd9Sstevel@tonic-gate {
4087c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
4097c478bd9Sstevel@tonic-gate 	int		deflt;
4107c478bd9Sstevel@tonic-gate 
4117c478bd9Sstevel@tonic-gate 	if (cur_ctype->ctype_flags & CF_SMD_DEFS) {
4127c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.lower = MIN_BPS;
4137c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.upper = MAX_BPS;
4147c478bd9Sstevel@tonic-gate 		deflt = AVG_BPS;
4157c478bd9Sstevel@tonic-gate 		return (input(FIO_INT, "Enter bytes per sector",
4167c478bd9Sstevel@tonic-gate 		    ':', &ioparam, &deflt, DATA_INPUT));
4177c478bd9Sstevel@tonic-gate 	}
4187c478bd9Sstevel@tonic-gate 
4197c478bd9Sstevel@tonic-gate 	return (0);
4207c478bd9Sstevel@tonic-gate }
4217c478bd9Sstevel@tonic-gate 
4227c478bd9Sstevel@tonic-gate /*
4237c478bd9Sstevel@tonic-gate  * Prompt for ascii label
4247c478bd9Sstevel@tonic-gate  */
4257c478bd9Sstevel@tonic-gate char *
get_asciilabel(void)426*b12aaafbSToomas Soome get_asciilabel(void)
4277c478bd9Sstevel@tonic-gate {
428052b6e8aSbg159949 	return ((char *)(uintptr_t)input(FIO_OSTR,
4297c478bd9Sstevel@tonic-gate 	    "Enter disk type name (remember quotes)", ':',
430*b12aaafbSToomas Soome 	    NULL, NULL, DATA_INPUT));
4317c478bd9Sstevel@tonic-gate }
432