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