xref: /titanic_52/usr/src/cmd/format/analyze.h (revision fca4268092e9961ebb9b5e0098dcebc545023586)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_ANALYZE_H
27 #define	_ANALYZE_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 /*
34  * This file contains definitions related to surface analysis.
35  */
36 
37 /*
38  * These are variables referenced by the analysis routines.  They
39  * are declared in analyze.c.
40  */
41 extern	int scan_entire;
42 extern	diskaddr_t scan_lower, scan_upper;
43 extern	int scan_correct, scan_stop, scan_loop, scan_passes;
44 extern	int scan_random, scan_auto;
45 extern	uint_t scan_size;
46 extern	int scan_restore_defects, scan_restore_label;
47 
48 /*
49  * These variables hold summary info for the end of analysis.
50  * They are declared in analyze.c.
51  */
52 extern	offset_t scan_cur_block;
53 extern	int64_t scan_blocks_fixed;
54 
55 /*
56  * This variable is used to tell whether the most recent surface
57  * analysis error was caused by a media defect or some other problem.
58  * It is declared in analyze.c.
59  */
60 extern	int media_error;
61 extern	int disk_error;
62 
63 /*
64  * These defines are flags for the surface analysis types.
65  */
66 #define	SCAN_VALID		0x01		/* read data off disk */
67 #define	SCAN_PATTERN		0x02		/* write and read pattern */
68 #define	SCAN_COMPARE		0x04		/* manually check pattern */
69 #define	SCAN_WRITE		0x08		/* write data to disk */
70 #define	SCAN_PURGE		0x10		/* purge data on disk */
71 #define	SCAN_PURGE_READ_PASS	0x20		/* read/compare pass */
72 #define	SCAN_PURGE_ALPHA_PASS	0x40		/* alpha pattern pass */
73 #define	SCAN_VERIFY		0x80		/* verify data on disk */
74 #define	SCAN_VERIFY_READ_PASS	0x100		/* read/compare pass */
75 
76 
77 /*
78  * Miscellaneous defines.
79  */
80 #define	BUF_SECTS		126		/* size of the buffers */
81 /*
82  * Number of passes for purge command.  It is kept here to allow
83  * it to be used in menu_analyze.c also
84  * This feature is added at the request of Sun Fed.
85  */
86 #define	NPPATTERNS	4	/* number of purge patterns */
87 #define	READPATTERN	(NPPATTERNS - 1)
88 
89 
90 /*
91  * defines for disk errors during surface analysis.
92  */
93 #define	DISK_STAT_RESERVED		0x01	/* disk is reserved */
94 #define	DISK_STAT_NOTREADY		0x02	/* disk not ready */
95 #define	DISK_STAT_UNAVAILABLE		0x03	/* disk is being formatted */
96 #define	DISK_STAT_DATA_PROTECT		0x04	/* disk is write protected */
97 
98 /*
99  *	Prototypes for ANSI C compilers
100  */
101 int	do_scan(int flags, int mode);
102 
103 #ifdef	__cplusplus
104 }
105 #endif
106 
107 #endif	/* _ANALYZE_H */
108