xref: /titanic_44/usr/src/cmd/format/prompts.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 1991, 2001-2002 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*7c478bd9Sstevel@tonic-gate 
29*7c478bd9Sstevel@tonic-gate /*
30*7c478bd9Sstevel@tonic-gate  * This file contains functions to prompt the user for various
31*7c478bd9Sstevel@tonic-gate  * disk characteristics.  By isolating these into functions,
32*7c478bd9Sstevel@tonic-gate  * we can guarantee that prompts, defaults, etc are identical.
33*7c478bd9Sstevel@tonic-gate  */
34*7c478bd9Sstevel@tonic-gate #include "global.h"
35*7c478bd9Sstevel@tonic-gate #include "prompts.h"
36*7c478bd9Sstevel@tonic-gate #include "io.h"
37*7c478bd9Sstevel@tonic-gate #include "param.h"
38*7c478bd9Sstevel@tonic-gate #include "startup.h"
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate #ifdef sparc
41*7c478bd9Sstevel@tonic-gate #include <sys/hdio.h>
42*7c478bd9Sstevel@tonic-gate #endif
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate /*
46*7c478bd9Sstevel@tonic-gate  * Prompt for max number of LBA
47*7c478bd9Sstevel@tonic-gate  */
48*7c478bd9Sstevel@tonic-gate uint64_t
49*7c478bd9Sstevel@tonic-gate get_mlba()
50*7c478bd9Sstevel@tonic-gate {
51*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
52*7c478bd9Sstevel@tonic-gate 
53*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = (1024 * 16) + 68;
54*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = UINT_MAX64;
55*7c478bd9Sstevel@tonic-gate 
56*7c478bd9Sstevel@tonic-gate 	return (input(FIO_INT64, "Enter maximum number of LBAs",
57*7c478bd9Sstevel@tonic-gate 	    ':', &ioparam, (int *)NULL, DATA_INPUT));
58*7c478bd9Sstevel@tonic-gate }
59*7c478bd9Sstevel@tonic-gate 
60*7c478bd9Sstevel@tonic-gate /*
61*7c478bd9Sstevel@tonic-gate  * Prompt for number of cylinders
62*7c478bd9Sstevel@tonic-gate  */
63*7c478bd9Sstevel@tonic-gate int
64*7c478bd9Sstevel@tonic-gate get_ncyl()
65*7c478bd9Sstevel@tonic-gate {
66*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 1;
69*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_CYLS;
70*7c478bd9Sstevel@tonic-gate 	return (input(FIO_INT, "Enter number of data cylinders",
71*7c478bd9Sstevel@tonic-gate 	    ':', &ioparam, (int *)NULL, DATA_INPUT));
72*7c478bd9Sstevel@tonic-gate }
73*7c478bd9Sstevel@tonic-gate 
74*7c478bd9Sstevel@tonic-gate /*
75*7c478bd9Sstevel@tonic-gate  * Prompt for number of alternate cylinders
76*7c478bd9Sstevel@tonic-gate  */
77*7c478bd9Sstevel@tonic-gate int
78*7c478bd9Sstevel@tonic-gate get_acyl(n_cyls)
79*7c478bd9Sstevel@tonic-gate 	int		n_cyls;
80*7c478bd9Sstevel@tonic-gate {
81*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
82*7c478bd9Sstevel@tonic-gate 	int		deflt;
83*7c478bd9Sstevel@tonic-gate 
84*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 2;
85*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_CYLS - n_cyls;
86*7c478bd9Sstevel@tonic-gate 	deflt = 2;
87*7c478bd9Sstevel@tonic-gate 	return (input(FIO_INT, "Enter number of alternate cylinders", ':',
88*7c478bd9Sstevel@tonic-gate 	    &ioparam, &deflt, DATA_INPUT));
89*7c478bd9Sstevel@tonic-gate }
90*7c478bd9Sstevel@tonic-gate 
91*7c478bd9Sstevel@tonic-gate /*
92*7c478bd9Sstevel@tonic-gate  * Prompt for number of physical cylinders
93*7c478bd9Sstevel@tonic-gate  */
94*7c478bd9Sstevel@tonic-gate int
95*7c478bd9Sstevel@tonic-gate get_pcyl(n_cyls, a_cyls)
96*7c478bd9Sstevel@tonic-gate 	int		n_cyls;
97*7c478bd9Sstevel@tonic-gate 	int		a_cyls;
98*7c478bd9Sstevel@tonic-gate {
99*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
100*7c478bd9Sstevel@tonic-gate 	int		deflt;
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = n_cyls + a_cyls;
103*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_CYLS;
104*7c478bd9Sstevel@tonic-gate 	deflt = n_cyls + a_cyls;
105*7c478bd9Sstevel@tonic-gate 	return (input(FIO_INT, "Enter number of physical cylinders", ':',
106*7c478bd9Sstevel@tonic-gate 	    &ioparam, &deflt, DATA_INPUT));
107*7c478bd9Sstevel@tonic-gate }
108*7c478bd9Sstevel@tonic-gate 
109*7c478bd9Sstevel@tonic-gate /*
110*7c478bd9Sstevel@tonic-gate  * Prompt for number of heads
111*7c478bd9Sstevel@tonic-gate  */
112*7c478bd9Sstevel@tonic-gate int
113*7c478bd9Sstevel@tonic-gate get_nhead()
114*7c478bd9Sstevel@tonic-gate {
115*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
116*7c478bd9Sstevel@tonic-gate 
117*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 1;
118*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_HEADS;
119*7c478bd9Sstevel@tonic-gate 	return (input(FIO_INT, "Enter number of heads", ':',
120*7c478bd9Sstevel@tonic-gate 	    &ioparam, (int *)NULL, DATA_INPUT));
121*7c478bd9Sstevel@tonic-gate }
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate /*
124*7c478bd9Sstevel@tonic-gate  * Prompt for number of physical heads
125*7c478bd9Sstevel@tonic-gate  */
126*7c478bd9Sstevel@tonic-gate int
127*7c478bd9Sstevel@tonic-gate get_phead(n_heads, options)
128*7c478bd9Sstevel@tonic-gate 	int		n_heads;
129*7c478bd9Sstevel@tonic-gate 	ulong_t		*options;
130*7c478bd9Sstevel@tonic-gate {
131*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
132*7c478bd9Sstevel@tonic-gate 	int		deflt;
133*7c478bd9Sstevel@tonic-gate 
134*7c478bd9Sstevel@tonic-gate 	if (SCSI) {
135*7c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.lower = n_heads;
136*7c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.upper = INFINITY;
137*7c478bd9Sstevel@tonic-gate 		if (input(FIO_OPINT, "Enter physical number of heads",
138*7c478bd9Sstevel@tonic-gate 				':', &ioparam, &deflt, DATA_INPUT)) {
139*7c478bd9Sstevel@tonic-gate 			*options |= SUP_PHEAD;
140*7c478bd9Sstevel@tonic-gate 			return (deflt);
141*7c478bd9Sstevel@tonic-gate 		}
142*7c478bd9Sstevel@tonic-gate 	}
143*7c478bd9Sstevel@tonic-gate 	return (0);
144*7c478bd9Sstevel@tonic-gate }
145*7c478bd9Sstevel@tonic-gate 
146*7c478bd9Sstevel@tonic-gate 
147*7c478bd9Sstevel@tonic-gate /*
148*7c478bd9Sstevel@tonic-gate  * Prompt for number of sectors per track
149*7c478bd9Sstevel@tonic-gate  */
150*7c478bd9Sstevel@tonic-gate int
151*7c478bd9Sstevel@tonic-gate get_nsect()
152*7c478bd9Sstevel@tonic-gate {
153*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 1;
156*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_SECTS;
157*7c478bd9Sstevel@tonic-gate 	return (input(FIO_INT,
158*7c478bd9Sstevel@tonic-gate 	    "Enter number of data sectors/track", ':',
159*7c478bd9Sstevel@tonic-gate 	    &ioparam, (int *)NULL, DATA_INPUT));
160*7c478bd9Sstevel@tonic-gate }
161*7c478bd9Sstevel@tonic-gate 
162*7c478bd9Sstevel@tonic-gate /*
163*7c478bd9Sstevel@tonic-gate  * Prompt for number of physical sectors per track
164*7c478bd9Sstevel@tonic-gate  */
165*7c478bd9Sstevel@tonic-gate int
166*7c478bd9Sstevel@tonic-gate get_psect(options)
167*7c478bd9Sstevel@tonic-gate 	ulong_t		*options;
168*7c478bd9Sstevel@tonic-gate {
169*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
170*7c478bd9Sstevel@tonic-gate 	int		deflt;
171*7c478bd9Sstevel@tonic-gate 
172*7c478bd9Sstevel@tonic-gate 	if (SCSI) {
173*7c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.lower = 0;
174*7c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.upper = INFINITY;
175*7c478bd9Sstevel@tonic-gate 		if (input(FIO_OPINT, "Enter number of physical sectors/track",
176*7c478bd9Sstevel@tonic-gate 				':', &ioparam, &deflt, DATA_INPUT)) {
177*7c478bd9Sstevel@tonic-gate 			*options |= SUP_PSECT;
178*7c478bd9Sstevel@tonic-gate 			return (deflt);
179*7c478bd9Sstevel@tonic-gate 		}
180*7c478bd9Sstevel@tonic-gate 	}
181*7c478bd9Sstevel@tonic-gate 	return (0);
182*7c478bd9Sstevel@tonic-gate }
183*7c478bd9Sstevel@tonic-gate 
184*7c478bd9Sstevel@tonic-gate /*
185*7c478bd9Sstevel@tonic-gate  * Prompt for bytes per track
186*7c478bd9Sstevel@tonic-gate  */
187*7c478bd9Sstevel@tonic-gate int
188*7c478bd9Sstevel@tonic-gate get_bpt(n_sects, options)
189*7c478bd9Sstevel@tonic-gate 	int		n_sects;
190*7c478bd9Sstevel@tonic-gate 	ulong_t		*options;
191*7c478bd9Sstevel@tonic-gate {
192*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
193*7c478bd9Sstevel@tonic-gate 	int		deflt;
194*7c478bd9Sstevel@tonic-gate 
195*7c478bd9Sstevel@tonic-gate 	if (SMD) {
196*7c478bd9Sstevel@tonic-gate 		*options |= SUP_BPT;
197*7c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.lower = 1;
198*7c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.upper = INFINITY;
199*7c478bd9Sstevel@tonic-gate 		deflt = n_sects * SECSIZE;
200*7c478bd9Sstevel@tonic-gate 		return (input(FIO_INT, "Enter number of bytes/track",
201*7c478bd9Sstevel@tonic-gate 				':', &ioparam, &deflt, DATA_INPUT));
202*7c478bd9Sstevel@tonic-gate 	}
203*7c478bd9Sstevel@tonic-gate 
204*7c478bd9Sstevel@tonic-gate 	return (0);
205*7c478bd9Sstevel@tonic-gate }
206*7c478bd9Sstevel@tonic-gate 
207*7c478bd9Sstevel@tonic-gate /*
208*7c478bd9Sstevel@tonic-gate  * Prompt for rpm
209*7c478bd9Sstevel@tonic-gate  */
210*7c478bd9Sstevel@tonic-gate int
211*7c478bd9Sstevel@tonic-gate get_rpm()
212*7c478bd9Sstevel@tonic-gate {
213*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
214*7c478bd9Sstevel@tonic-gate 	int		deflt;
215*7c478bd9Sstevel@tonic-gate 
216*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = MIN_RPM;
217*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = MAX_RPM;
218*7c478bd9Sstevel@tonic-gate 	deflt = AVG_RPM;
219*7c478bd9Sstevel@tonic-gate 	return (input(FIO_INT, "Enter rpm of drive", ':',
220*7c478bd9Sstevel@tonic-gate 	    &ioparam, &deflt, DATA_INPUT));
221*7c478bd9Sstevel@tonic-gate }
222*7c478bd9Sstevel@tonic-gate 
223*7c478bd9Sstevel@tonic-gate /*
224*7c478bd9Sstevel@tonic-gate  * Prompt for formatting time
225*7c478bd9Sstevel@tonic-gate  */
226*7c478bd9Sstevel@tonic-gate int
227*7c478bd9Sstevel@tonic-gate get_fmt_time(options)
228*7c478bd9Sstevel@tonic-gate 	ulong_t		*options;
229*7c478bd9Sstevel@tonic-gate {
230*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
231*7c478bd9Sstevel@tonic-gate 	int		deflt;
232*7c478bd9Sstevel@tonic-gate 
233*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
234*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
235*7c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter format time", ':',
236*7c478bd9Sstevel@tonic-gate 			&ioparam, &deflt, DATA_INPUT)) {
237*7c478bd9Sstevel@tonic-gate 		*options |= SUP_FMTTIME;
238*7c478bd9Sstevel@tonic-gate 		return (deflt);
239*7c478bd9Sstevel@tonic-gate 	}
240*7c478bd9Sstevel@tonic-gate 	return (0);
241*7c478bd9Sstevel@tonic-gate }
242*7c478bd9Sstevel@tonic-gate 
243*7c478bd9Sstevel@tonic-gate /*
244*7c478bd9Sstevel@tonic-gate  * Prompt for cylinder skew
245*7c478bd9Sstevel@tonic-gate  */
246*7c478bd9Sstevel@tonic-gate int
247*7c478bd9Sstevel@tonic-gate get_cyl_skew(options)
248*7c478bd9Sstevel@tonic-gate 	ulong_t		*options;
249*7c478bd9Sstevel@tonic-gate {
250*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
251*7c478bd9Sstevel@tonic-gate 	int		deflt;
252*7c478bd9Sstevel@tonic-gate 
253*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
254*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
255*7c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter cylinder skew", ':',
256*7c478bd9Sstevel@tonic-gate 			&ioparam, &deflt, DATA_INPUT)) {
257*7c478bd9Sstevel@tonic-gate 		*options |= SUP_CYLSKEW;
258*7c478bd9Sstevel@tonic-gate 		return (deflt);
259*7c478bd9Sstevel@tonic-gate 	}
260*7c478bd9Sstevel@tonic-gate 	return (0);
261*7c478bd9Sstevel@tonic-gate }
262*7c478bd9Sstevel@tonic-gate 
263*7c478bd9Sstevel@tonic-gate /*
264*7c478bd9Sstevel@tonic-gate  * Prompt for track skew
265*7c478bd9Sstevel@tonic-gate  */
266*7c478bd9Sstevel@tonic-gate int
267*7c478bd9Sstevel@tonic-gate get_trk_skew(options)
268*7c478bd9Sstevel@tonic-gate 	ulong_t		*options;
269*7c478bd9Sstevel@tonic-gate {
270*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
271*7c478bd9Sstevel@tonic-gate 	int		deflt;
272*7c478bd9Sstevel@tonic-gate 
273*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
274*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
275*7c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter track skew", ':',
276*7c478bd9Sstevel@tonic-gate 			&ioparam, &deflt, DATA_INPUT)) {
277*7c478bd9Sstevel@tonic-gate 		*options |= SUP_TRKSKEW;
278*7c478bd9Sstevel@tonic-gate 		return (deflt);
279*7c478bd9Sstevel@tonic-gate 	}
280*7c478bd9Sstevel@tonic-gate 	return (0);
281*7c478bd9Sstevel@tonic-gate }
282*7c478bd9Sstevel@tonic-gate 
283*7c478bd9Sstevel@tonic-gate /*
284*7c478bd9Sstevel@tonic-gate  * Prompt for tracks per zone
285*7c478bd9Sstevel@tonic-gate  */
286*7c478bd9Sstevel@tonic-gate int
287*7c478bd9Sstevel@tonic-gate get_trks_zone(options)
288*7c478bd9Sstevel@tonic-gate 	ulong_t		*options;
289*7c478bd9Sstevel@tonic-gate {
290*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
291*7c478bd9Sstevel@tonic-gate 	int		deflt;
292*7c478bd9Sstevel@tonic-gate 
293*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
294*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
295*7c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter tracks per zone", ':',
296*7c478bd9Sstevel@tonic-gate 			&ioparam, &deflt, DATA_INPUT)) {
297*7c478bd9Sstevel@tonic-gate 		*options |= SUP_TRKS_ZONE;
298*7c478bd9Sstevel@tonic-gate 		return (deflt);
299*7c478bd9Sstevel@tonic-gate 	}
300*7c478bd9Sstevel@tonic-gate 	return (0);
301*7c478bd9Sstevel@tonic-gate }
302*7c478bd9Sstevel@tonic-gate 
303*7c478bd9Sstevel@tonic-gate /*
304*7c478bd9Sstevel@tonic-gate  * Prompt for alternate tracks
305*7c478bd9Sstevel@tonic-gate  */
306*7c478bd9Sstevel@tonic-gate int
307*7c478bd9Sstevel@tonic-gate get_atrks(options)
308*7c478bd9Sstevel@tonic-gate 	ulong_t		*options;
309*7c478bd9Sstevel@tonic-gate {
310*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
311*7c478bd9Sstevel@tonic-gate 	int		deflt;
312*7c478bd9Sstevel@tonic-gate 
313*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
314*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
315*7c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter alternate tracks", ':',
316*7c478bd9Sstevel@tonic-gate 			&ioparam, &deflt, DATA_INPUT)) {
317*7c478bd9Sstevel@tonic-gate 		*options |= SUP_ATRKS;
318*7c478bd9Sstevel@tonic-gate 		return (deflt);
319*7c478bd9Sstevel@tonic-gate 	}
320*7c478bd9Sstevel@tonic-gate 	return (0);
321*7c478bd9Sstevel@tonic-gate }
322*7c478bd9Sstevel@tonic-gate 
323*7c478bd9Sstevel@tonic-gate /*
324*7c478bd9Sstevel@tonic-gate  * Prompt for alternate sectors
325*7c478bd9Sstevel@tonic-gate  */
326*7c478bd9Sstevel@tonic-gate int
327*7c478bd9Sstevel@tonic-gate get_asect(options)
328*7c478bd9Sstevel@tonic-gate 	ulong_t		*options;
329*7c478bd9Sstevel@tonic-gate {
330*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
331*7c478bd9Sstevel@tonic-gate 	int		deflt;
332*7c478bd9Sstevel@tonic-gate 
333*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
334*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
335*7c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter alternate sectors", ':',
336*7c478bd9Sstevel@tonic-gate 			&ioparam, &deflt, DATA_INPUT)) {
337*7c478bd9Sstevel@tonic-gate 		*options |= SUP_ASECT;
338*7c478bd9Sstevel@tonic-gate 		return (deflt);
339*7c478bd9Sstevel@tonic-gate 	}
340*7c478bd9Sstevel@tonic-gate 	return (0);
341*7c478bd9Sstevel@tonic-gate }
342*7c478bd9Sstevel@tonic-gate 
343*7c478bd9Sstevel@tonic-gate /*
344*7c478bd9Sstevel@tonic-gate  * Prompt for cache setting
345*7c478bd9Sstevel@tonic-gate  */
346*7c478bd9Sstevel@tonic-gate int
347*7c478bd9Sstevel@tonic-gate get_cache(options)
348*7c478bd9Sstevel@tonic-gate 	ulong_t		*options;
349*7c478bd9Sstevel@tonic-gate {
350*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
351*7c478bd9Sstevel@tonic-gate 	int		deflt;
352*7c478bd9Sstevel@tonic-gate 
353*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
354*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = 0xff;
355*7c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter cache control", ':',
356*7c478bd9Sstevel@tonic-gate 			&ioparam, &deflt, DATA_INPUT)) {
357*7c478bd9Sstevel@tonic-gate 		*options |= SUP_CACHE;
358*7c478bd9Sstevel@tonic-gate 		return (deflt);
359*7c478bd9Sstevel@tonic-gate 	}
360*7c478bd9Sstevel@tonic-gate 	return (0);
361*7c478bd9Sstevel@tonic-gate }
362*7c478bd9Sstevel@tonic-gate 
363*7c478bd9Sstevel@tonic-gate /*
364*7c478bd9Sstevel@tonic-gate  * Prompt for prefetch threshold
365*7c478bd9Sstevel@tonic-gate  */
366*7c478bd9Sstevel@tonic-gate int
367*7c478bd9Sstevel@tonic-gate get_threshold(options)
368*7c478bd9Sstevel@tonic-gate 	ulong_t		*options;
369*7c478bd9Sstevel@tonic-gate {
370*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
371*7c478bd9Sstevel@tonic-gate 	int		deflt;
372*7c478bd9Sstevel@tonic-gate 
373*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
374*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
375*7c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter prefetch threshold",
376*7c478bd9Sstevel@tonic-gate 			':', &ioparam, &deflt, DATA_INPUT)) {
377*7c478bd9Sstevel@tonic-gate 		*options |= SUP_PREFETCH;
378*7c478bd9Sstevel@tonic-gate 		return (deflt);
379*7c478bd9Sstevel@tonic-gate 	}
380*7c478bd9Sstevel@tonic-gate 	return (0);
381*7c478bd9Sstevel@tonic-gate }
382*7c478bd9Sstevel@tonic-gate 
383*7c478bd9Sstevel@tonic-gate /*
384*7c478bd9Sstevel@tonic-gate  * Prompt for minimum prefetch
385*7c478bd9Sstevel@tonic-gate  */
386*7c478bd9Sstevel@tonic-gate int
387*7c478bd9Sstevel@tonic-gate get_min_prefetch(options)
388*7c478bd9Sstevel@tonic-gate 	ulong_t		*options;
389*7c478bd9Sstevel@tonic-gate {
390*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
391*7c478bd9Sstevel@tonic-gate 	int		deflt;
392*7c478bd9Sstevel@tonic-gate 
393*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = 0;
394*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
395*7c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter minimum prefetch",
396*7c478bd9Sstevel@tonic-gate 			':', &ioparam, &deflt, DATA_INPUT)) {
397*7c478bd9Sstevel@tonic-gate 		*options |= SUP_CACHE_MIN;
398*7c478bd9Sstevel@tonic-gate 		return (deflt);
399*7c478bd9Sstevel@tonic-gate 	}
400*7c478bd9Sstevel@tonic-gate 	return (0);
401*7c478bd9Sstevel@tonic-gate }
402*7c478bd9Sstevel@tonic-gate 
403*7c478bd9Sstevel@tonic-gate /*
404*7c478bd9Sstevel@tonic-gate  * Prompt for maximum prefetch
405*7c478bd9Sstevel@tonic-gate  */
406*7c478bd9Sstevel@tonic-gate int
407*7c478bd9Sstevel@tonic-gate get_max_prefetch(min_prefetch, options)
408*7c478bd9Sstevel@tonic-gate 	int		min_prefetch;
409*7c478bd9Sstevel@tonic-gate 	ulong_t		*options;
410*7c478bd9Sstevel@tonic-gate {
411*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
412*7c478bd9Sstevel@tonic-gate 	int		deflt;
413*7c478bd9Sstevel@tonic-gate 
414*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.lower = min_prefetch;
415*7c478bd9Sstevel@tonic-gate 	ioparam.io_bounds.upper = INFINITY;
416*7c478bd9Sstevel@tonic-gate 	if (input(FIO_OPINT, "Enter maximum prefetch",
417*7c478bd9Sstevel@tonic-gate 			':', &ioparam, &deflt, DATA_INPUT)) {
418*7c478bd9Sstevel@tonic-gate 		*options |= SUP_CACHE_MAX;
419*7c478bd9Sstevel@tonic-gate 		return (deflt);
420*7c478bd9Sstevel@tonic-gate 	}
421*7c478bd9Sstevel@tonic-gate 	return (0);
422*7c478bd9Sstevel@tonic-gate }
423*7c478bd9Sstevel@tonic-gate 
424*7c478bd9Sstevel@tonic-gate /*
425*7c478bd9Sstevel@tonic-gate  * Prompt for bytes per sector
426*7c478bd9Sstevel@tonic-gate  */
427*7c478bd9Sstevel@tonic-gate int
428*7c478bd9Sstevel@tonic-gate get_bps()
429*7c478bd9Sstevel@tonic-gate {
430*7c478bd9Sstevel@tonic-gate 	u_ioparam_t	ioparam;
431*7c478bd9Sstevel@tonic-gate 	int		deflt;
432*7c478bd9Sstevel@tonic-gate 
433*7c478bd9Sstevel@tonic-gate 	if (cur_ctype->ctype_flags & CF_SMD_DEFS) {
434*7c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.lower = MIN_BPS;
435*7c478bd9Sstevel@tonic-gate 		ioparam.io_bounds.upper = MAX_BPS;
436*7c478bd9Sstevel@tonic-gate 		deflt = AVG_BPS;
437*7c478bd9Sstevel@tonic-gate 		return (input(FIO_INT, "Enter bytes per sector",
438*7c478bd9Sstevel@tonic-gate 			':', &ioparam, &deflt, DATA_INPUT));
439*7c478bd9Sstevel@tonic-gate 	}
440*7c478bd9Sstevel@tonic-gate 
441*7c478bd9Sstevel@tonic-gate 	return (0);
442*7c478bd9Sstevel@tonic-gate }
443*7c478bd9Sstevel@tonic-gate 
444*7c478bd9Sstevel@tonic-gate /*
445*7c478bd9Sstevel@tonic-gate  * Prompt for ascii label
446*7c478bd9Sstevel@tonic-gate  */
447*7c478bd9Sstevel@tonic-gate char *
448*7c478bd9Sstevel@tonic-gate get_asciilabel()
449*7c478bd9Sstevel@tonic-gate {
450*7c478bd9Sstevel@tonic-gate 	return ((char *)input(FIO_OSTR,
451*7c478bd9Sstevel@tonic-gate 	    "Enter disk type name (remember quotes)", ':',
452*7c478bd9Sstevel@tonic-gate 	    (u_ioparam_t *)NULL, (int *)NULL, DATA_INPUT));
453*7c478bd9Sstevel@tonic-gate }
454