4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 * This file contains functions to prompt the user for various
28 * disk characteristics. By isolating these into functions,
29 * we can guarantee that prompts, defaults, etc are identical.
43 * Prompt for max number of LBA
50 ioparam
.io_bounds
.lower
= (1024 * 16) + 68;
51 ioparam
.io_bounds
.upper
= UINT_MAX64
;
53 return (input(FIO_INT64
, "Enter maximum number of LBAs",
54 ':', &ioparam
, NULL
, DATA_INPUT
));
58 * Prompt for number of cylinders
65 ioparam
.io_bounds
.lower
= 1;
66 ioparam
.io_bounds
.upper
= MAX_CYLS
;
67 return (input(FIO_INT
, "Enter number of data cylinders",
68 ':', &ioparam
, NULL
, DATA_INPUT
));
72 * Prompt for number of alternate cylinders
81 ioparam
.io_bounds
.lower
= 2;
82 ioparam
.io_bounds
.upper
= MAX_CYLS
- n_cyls
;
84 return (input(FIO_INT
, "Enter number of alternate cylinders", ':',
85 &ioparam
, &deflt
, DATA_INPUT
));
89 * Prompt for number of physical cylinders
92 get_pcyl(n_cyls
, a_cyls
)
99 ioparam
.io_bounds
.lower
= n_cyls
+ a_cyls
;
100 ioparam
.io_bounds
.upper
= MAX_CYLS
;
101 deflt
= n_cyls
+ a_cyls
;
102 return (input(FIO_INT
, "Enter number of physical cylinders", ':',
103 &ioparam
, &deflt
, DATA_INPUT
));
107 * Prompt for number of heads
114 ioparam
.io_bounds
.lower
= 1;
115 ioparam
.io_bounds
.upper
= MAX_HEADS
;
116 return (input(FIO_INT
, "Enter number of heads", ':',
117 &ioparam
, NULL
, DATA_INPUT
));
121 * Prompt for number of physical heads
124 get_phead(n_heads
, options
)
132 ioparam
.io_bounds
.lower
= n_heads
;
133 ioparam
.io_bounds
.upper
= INFINITY
;
134 if (input(FIO_OPINT
, "Enter physical number of heads",
135 ':', &ioparam
, &deflt
, DATA_INPUT
)) {
136 *options
|= SUP_PHEAD
;
145 * Prompt for number of sectors per track
152 ioparam
.io_bounds
.lower
= 1;
153 ioparam
.io_bounds
.upper
= MAX_SECTS
;
154 return (input(FIO_INT
,
155 "Enter number of data sectors/track", ':',
156 &ioparam
, NULL
, DATA_INPUT
));
160 * Prompt for number of physical sectors per track
170 ioparam
.io_bounds
.lower
= 0;
171 ioparam
.io_bounds
.upper
= INFINITY
;
172 if (input(FIO_OPINT
, "Enter number of physical sectors/track",
173 ':', &ioparam
, &deflt
, DATA_INPUT
)) {
174 *options
|= SUP_PSECT
;
182 * Prompt for bytes per track
185 get_bpt(n_sects
, options
)
194 ioparam
.io_bounds
.lower
= 1;
195 ioparam
.io_bounds
.upper
= INFINITY
;
196 deflt
= n_sects
* cur_blksz
;
197 return (input(FIO_INT
, "Enter number of bytes/track",
198 ':', &ioparam
, &deflt
, DATA_INPUT
));
213 ioparam
.io_bounds
.lower
= MIN_RPM
;
214 ioparam
.io_bounds
.upper
= MAX_RPM
;
216 return (input(FIO_INT
, "Enter rpm of drive", ':',
217 &ioparam
, &deflt
, DATA_INPUT
));
221 * Prompt for formatting time
224 get_fmt_time(options
)
230 ioparam
.io_bounds
.lower
= 0;
231 ioparam
.io_bounds
.upper
= INFINITY
;
232 if (input(FIO_OPINT
, "Enter format time", ':',
233 &ioparam
, &deflt
, DATA_INPUT
)) {
234 *options
|= SUP_FMTTIME
;
241 * Prompt for cylinder skew
244 get_cyl_skew(options
)
250 ioparam
.io_bounds
.lower
= 0;
251 ioparam
.io_bounds
.upper
= INFINITY
;
252 if (input(FIO_OPINT
, "Enter cylinder skew", ':',
253 &ioparam
, &deflt
, DATA_INPUT
)) {
254 *options
|= SUP_CYLSKEW
;
261 * Prompt for track skew
264 get_trk_skew(options
)
270 ioparam
.io_bounds
.lower
= 0;
271 ioparam
.io_bounds
.upper
= INFINITY
;
272 if (input(FIO_OPINT
, "Enter track skew", ':',
273 &ioparam
, &deflt
, DATA_INPUT
)) {
274 *options
|= SUP_TRKSKEW
;
281 * Prompt for tracks per zone
284 get_trks_zone(options
)
290 ioparam
.io_bounds
.lower
= 0;
291 ioparam
.io_bounds
.upper
= INFINITY
;
292 if (input(FIO_OPINT
, "Enter tracks per zone", ':',
293 &ioparam
, &deflt
, DATA_INPUT
)) {
294 *options
|= SUP_TRKS_ZONE
;
301 * Prompt for alternate tracks
310 ioparam
.io_bounds
.lower
= 0;
311 ioparam
.io_bounds
.upper
= INFINITY
;
312 if (input(FIO_OPINT
, "Enter alternate tracks", ':',
313 &ioparam
, &deflt
, DATA_INPUT
)) {
314 *options
|= SUP_ATRKS
;
321 * Prompt for alternate sectors
330 ioparam
.io_bounds
.lower
= 0;
331 ioparam
.io_bounds
.upper
= INFINITY
;
332 if (input(FIO_OPINT
, "Enter alternate sectors", ':',
333 &ioparam
, &deflt
, DATA_INPUT
)) {
334 *options
|= SUP_ASECT
;
341 * Prompt for cache setting
350 ioparam
.io_bounds
.lower
= 0;
351 ioparam
.io_bounds
.upper
= 0xff;
352 if (input(FIO_OPINT
, "Enter cache control", ':',
353 &ioparam
, &deflt
, DATA_INPUT
)) {
354 *options
|= SUP_CACHE
;
361 * Prompt for prefetch threshold
364 get_threshold(options
)
370 ioparam
.io_bounds
.lower
= 0;
371 ioparam
.io_bounds
.upper
= INFINITY
;
372 if (input(FIO_OPINT
, "Enter prefetch threshold",
373 ':', &ioparam
, &deflt
, DATA_INPUT
)) {
374 *options
|= SUP_PREFETCH
;
381 * Prompt for minimum prefetch
384 get_min_prefetch(options
)
390 ioparam
.io_bounds
.lower
= 0;
391 ioparam
.io_bounds
.upper
= INFINITY
;
392 if (input(FIO_OPINT
, "Enter minimum prefetch",
393 ':', &ioparam
, &deflt
, DATA_INPUT
)) {
394 *options
|= SUP_CACHE_MIN
;
401 * Prompt for maximum prefetch
404 get_max_prefetch(min_prefetch
, options
)
411 ioparam
.io_bounds
.lower
= min_prefetch
;
412 ioparam
.io_bounds
.upper
= INFINITY
;
413 if (input(FIO_OPINT
, "Enter maximum prefetch",
414 ':', &ioparam
, &deflt
, DATA_INPUT
)) {
415 *options
|= SUP_CACHE_MAX
;
422 * Prompt for bytes per sector
430 if (cur_ctype
->ctype_flags
& CF_SMD_DEFS
) {
431 ioparam
.io_bounds
.lower
= MIN_BPS
;
432 ioparam
.io_bounds
.upper
= MAX_BPS
;
434 return (input(FIO_INT
, "Enter bytes per sector",
435 ':', &ioparam
, &deflt
, DATA_INPUT
));
442 * Prompt for ascii label
447 return ((char *)(uintptr_t)input(FIO_OSTR
,
448 "Enter disk type name (remember quotes)", ':',
449 (u_ioparam_t
*)NULL
, NULL
, DATA_INPUT
));