xref: /illumos-gate/usr/src/cmd/format/analyze.h (revision 03100a6332bd4edc7a53091fcf7c9a7131bcdaa7)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1998-2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_ANALYZE_H
28 #define	_ANALYZE_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * This file contains definitions related to surface analysis.
38  */
39 
40 /*
41  * These are variables referenced by the analysis routines.  They
42  * are declared in analyze.c.
43  */
44 extern	int scan_entire;
45 extern	diskaddr_t scan_lower, scan_upper;
46 extern	int scan_correct, scan_stop, scan_loop, scan_passes;
47 extern	int scan_random, scan_size, scan_auto;
48 extern	int scan_restore_defects, scan_restore_label;
49 
50 /*
51  * These variables hold summary info for the end of analysis.
52  * They are declared in analyze.c.
53  */
54 extern	offset_t scan_cur_block;
55 extern	int64_t scan_blocks_fixed;
56 
57 /*
58  * This variable is used to tell whether the most recent surface
59  * analysis error was caused by a media defect or some other problem.
60  * It is declared in analyze.c.
61  */
62 extern	int media_error;
63 extern	int disk_error;
64 
65 /*
66  * These defines are flags for the surface analysis types.
67  */
68 #define	SCAN_VALID		0x01		/* read data off disk */
69 #define	SCAN_PATTERN		0x02		/* write and read pattern */
70 #define	SCAN_COMPARE		0x04		/* manually check pattern */
71 #define	SCAN_WRITE		0x08		/* write data to disk */
72 #define	SCAN_PURGE		0x10		/* purge data on disk */
73 #define	SCAN_PURGE_READ_PASS	0x20		/* read/compare pass */
74 #define	SCAN_PURGE_ALPHA_PASS	0x40		/* alpha pattern pass */
75 #define	SCAN_VERIFY		0x80		/* verify data on disk */
76 #define	SCAN_VERIFY_READ_PASS	0x100		/* read/compare pass */
77 
78 
79 /*
80  * Miscellaneous defines.
81  */
82 #define	BUF_SECTS		126		/* size of the buffers */
83 /*
84  * Number of passes for purge command.  It is kept here to allow
85  * it to be used in menu_analyze.c also
86  * This feature is added at the request of Sun Fed.
87  */
88 #define	NPPATTERNS	4	/* number of purge patterns */
89 #define	READPATTERN	(NPPATTERNS - 1)
90 
91 
92 /*
93  * defines for disk errors during surface analysis.
94  */
95 #define	DISK_STAT_RESERVED		0x01	/* disk is reserved */
96 #define	DISK_STAT_NOTREADY		0x02	/* disk not ready */
97 #define	DISK_STAT_UNAVAILABLE		0x03	/* disk is being formatted */
98 #define	DISK_STAT_DATA_PROTECT		0x04	/* disk is write protected */
99 
100 /*
101  *	Prototypes for ANSI C compilers
102  */
103 int	do_scan(int flags, int mode);
104 
105 #ifdef	__cplusplus
106 }
107 #endif
108 
109 #endif	/* _ANALYZE_H */
110