xref: /titanic_52/usr/src/cmd/format/analyze.h (revision 342440ec94087b8c751c580ab9ed6c693d31d418)
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
5*342440ecSPrasad Singamsetty  * Common Development and Distribution License (the "License").
6*342440ecSPrasad Singamsetty  * 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 /*
22*342440ecSPrasad Singamsetty  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_ANALYZE_H
277c478bd9Sstevel@tonic-gate #define	_ANALYZE_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate /*
347c478bd9Sstevel@tonic-gate  * This file contains definitions related to surface analysis.
357c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate  * These are variables referenced by the analysis routines.  They
397c478bd9Sstevel@tonic-gate  * are declared in analyze.c.
407c478bd9Sstevel@tonic-gate  */
417c478bd9Sstevel@tonic-gate extern	int scan_entire;
427c478bd9Sstevel@tonic-gate extern	diskaddr_t scan_lower, scan_upper;
437c478bd9Sstevel@tonic-gate extern	int scan_correct, scan_stop, scan_loop, scan_passes;
44*342440ecSPrasad Singamsetty extern	int scan_random, scan_auto;
45*342440ecSPrasad Singamsetty extern	uint_t scan_size;
467c478bd9Sstevel@tonic-gate extern	int scan_restore_defects, scan_restore_label;
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate /*
497c478bd9Sstevel@tonic-gate  * These variables hold summary info for the end of analysis.
507c478bd9Sstevel@tonic-gate  * They are declared in analyze.c.
517c478bd9Sstevel@tonic-gate  */
527c478bd9Sstevel@tonic-gate extern	offset_t scan_cur_block;
537c478bd9Sstevel@tonic-gate extern	int64_t scan_blocks_fixed;
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate /*
567c478bd9Sstevel@tonic-gate  * This variable is used to tell whether the most recent surface
577c478bd9Sstevel@tonic-gate  * analysis error was caused by a media defect or some other problem.
587c478bd9Sstevel@tonic-gate  * It is declared in analyze.c.
597c478bd9Sstevel@tonic-gate  */
607c478bd9Sstevel@tonic-gate extern	int media_error;
617c478bd9Sstevel@tonic-gate extern	int disk_error;
627c478bd9Sstevel@tonic-gate 
637c478bd9Sstevel@tonic-gate /*
647c478bd9Sstevel@tonic-gate  * These defines are flags for the surface analysis types.
657c478bd9Sstevel@tonic-gate  */
667c478bd9Sstevel@tonic-gate #define	SCAN_VALID		0x01		/* read data off disk */
677c478bd9Sstevel@tonic-gate #define	SCAN_PATTERN		0x02		/* write and read pattern */
687c478bd9Sstevel@tonic-gate #define	SCAN_COMPARE		0x04		/* manually check pattern */
697c478bd9Sstevel@tonic-gate #define	SCAN_WRITE		0x08		/* write data to disk */
707c478bd9Sstevel@tonic-gate #define	SCAN_PURGE		0x10		/* purge data on disk */
717c478bd9Sstevel@tonic-gate #define	SCAN_PURGE_READ_PASS	0x20		/* read/compare pass */
727c478bd9Sstevel@tonic-gate #define	SCAN_PURGE_ALPHA_PASS	0x40		/* alpha pattern pass */
737c478bd9Sstevel@tonic-gate #define	SCAN_VERIFY		0x80		/* verify data on disk */
747c478bd9Sstevel@tonic-gate #define	SCAN_VERIFY_READ_PASS	0x100		/* read/compare pass */
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate /*
787c478bd9Sstevel@tonic-gate  * Miscellaneous defines.
797c478bd9Sstevel@tonic-gate  */
807c478bd9Sstevel@tonic-gate #define	BUF_SECTS		126		/* size of the buffers */
817c478bd9Sstevel@tonic-gate /*
827c478bd9Sstevel@tonic-gate  * Number of passes for purge command.  It is kept here to allow
837c478bd9Sstevel@tonic-gate  * it to be used in menu_analyze.c also
847c478bd9Sstevel@tonic-gate  * This feature is added at the request of Sun Fed.
857c478bd9Sstevel@tonic-gate  */
867c478bd9Sstevel@tonic-gate #define	NPPATTERNS	4	/* number of purge patterns */
877c478bd9Sstevel@tonic-gate #define	READPATTERN	(NPPATTERNS - 1)
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate /*
917c478bd9Sstevel@tonic-gate  * defines for disk errors during surface analysis.
927c478bd9Sstevel@tonic-gate  */
937c478bd9Sstevel@tonic-gate #define	DISK_STAT_RESERVED		0x01	/* disk is reserved */
947c478bd9Sstevel@tonic-gate #define	DISK_STAT_NOTREADY		0x02	/* disk not ready */
957c478bd9Sstevel@tonic-gate #define	DISK_STAT_UNAVAILABLE		0x03	/* disk is being formatted */
967c478bd9Sstevel@tonic-gate #define	DISK_STAT_DATA_PROTECT		0x04	/* disk is write protected */
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate /*
997c478bd9Sstevel@tonic-gate  *	Prototypes for ANSI C compilers
1007c478bd9Sstevel@tonic-gate  */
1017c478bd9Sstevel@tonic-gate int	do_scan(int flags, int mode);
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1047c478bd9Sstevel@tonic-gate }
1057c478bd9Sstevel@tonic-gate #endif
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate #endif	/* _ANALYZE_H */
108