xref: /titanic_52/usr/src/cmd/format/badsec.h (revision 74e20cfe817b82802b16fac8690dadcda76f54f5)
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 /*
24  * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  *
27  * copyright (c) 1990, 1991 UNIX System Laboratories, Inc.
28  * copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T
29  * All Rights Reserved
30  */
31 
32 #ifndef	_BADSEC_H
33 #define	_BADSEC_H
34 
35 #pragma ident	"%Z%%M%	%I%	%E% SMI"
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 #define	BADSECFILE	"/etc/scsi/badsec"
42 #define	FAILURE	1
43 #define	SUCCESS	0
44 
45 #define	MAXBLENT	4
46 struct	badsec_lst {
47 	int	bl_cnt;
48 	struct	badsec_lst *bl_nxt;
49 	int	bl_sec[MAXBLENT];
50 };
51 
52 #define	BADSLSZ		sizeof (struct badsec_lst)
53 #define	BFI_FORMAT	0
54 #define	ATA_FORMAT	1
55 
56 #define	ALTS_ADDPART	0x1	/* add alternate partition		*/
57 struct	alts_mempart {			/* incore alts partition info	*/
58 	int	ap_flag;		/* flag for alternate partition	*/
59 	struct	alts_parttbl *ap_tblp;	/* alts partition table		*/
60 	int	ap_tbl_secsiz;		/* alts parttbl sector size	*/
61 	uchar_t	*ap_memmapp;		/* incore alternate sector map	*/
62 	uchar_t	*ap_mapp;		/* alternate sector map		*/
63 	int	ap_map_secsiz;		/* alts partmap sector size	*/
64 	int	ap_map_sectot;		/* alts partmap # sector 	*/
65 	struct  alts_ent *ap_entp;	/* alternate sector entry table */
66 	int	ap_ent_secsiz;		/* alts entry sector size	*/
67 	struct	alts_ent *ap_gbadp;	/* growing badsec entry table	*/
68 	int	ap_gbadcnt;		/* growing bad sector count	*/
69 	struct	partition part;		/* alts partition configuration */
70 };
71 
72 /*	size of incore alternate partition memory structure		*/
73 #define	ALTS_MEMPART_SIZE	sizeof (struct alts_mempart)
74 
75 struct	altsectbl {			/* working alts info		*/
76 	struct  alts_ent *ast_entp;	/* alternate sector entry table */
77 	int	ast_entused;		/* entry used			*/
78 	struct	alt_info *ast_alttblp;	/* alts info			*/
79 	int	ast_altsiz;		/* size of alts info		*/
80 	struct  alts_ent *ast_gbadp;	/* growing bad sector entry ptr */
81 	int	ast_gbadcnt;		/* growing bad sector entry cnt */
82 };
83 /*	size of incore alternate partition memory structure		*/
84 #define	ALTSECTBL_SIZE	sizeof (struct altsectbl)
85 
86 /*	macro definitions						*/
87 #define	byte_to_secsiz(APSIZE, BPS)	(daddr_t) \
88 					((((APSIZE) + (BPS) - 1) \
89 					    / (uint_t)(BPS)) * (BPS))
90 
91 #ifdef	__cplusplus
92 }
93 #endif
94 
95 #endif	/* _BADSEC_H */
96