xref: /titanic_50/usr/src/cmd/addbadsec/badsec.h (revision 24da5b34f49324ed742a340010ed5bd3d4e06625)
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 /*	Copyright (c) 1990, 1991 UNIX System Laboratories, Inc.	*/
23 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T	*/
24 /*	  All Rights Reserved  	*/
25 
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #define	BADSECFILE	"/etc/scsi/badsec"
29 #define FAILURE	0
30 #define SUCCESS	1
31 
32 #define	MAXBLENT	4
33 struct	badsec_lst {
34 	int	bl_cnt;
35 	struct	badsec_lst *bl_nxt;
36 	int	bl_sec[MAXBLENT];
37 };
38 
39 #define BADSLSZ		sizeof(struct badsec_lst)
40 
41 #define ALTS_ADDPART	0x1	/* add alternate partition		*/
42 struct	alts_mempart {			/* incore alts partition info	*/
43 	int	ap_flag;		/* flag for alternate partition	*/
44 	struct	alts_parttbl *ap_tblp;	/* alts partition table		*/
45 	int	ap_tbl_secsiz;		/* alts parttbl sector size	*/
46 	unchar	*ap_memmapp;		/* incore alternate sector map	*/
47 	unchar	*ap_mapp;		/* alternate sector map		*/
48 	int	ap_map_secsiz;		/* alts partmap sector size	*/
49 	int	ap_map_sectot;		/* alts partmap # sector 	*/
50 	struct  alts_ent *ap_entp;	/* alternate sector entry table */
51 	int	ap_ent_secsiz;		/* alts entry sector size	*/
52 	struct	alts_ent *ap_gbadp;	/* growing badsec entry table	*/
53 	int	ap_gbadcnt;		/* growing bad sector count	*/
54 	struct	partition part;		/* alts partition configuration */
55 } ;
56 
57 /*	size of incore alternate partition memory structure		*/
58 #define	ALTS_MEMPART_SIZE	sizeof(struct alts_mempart)
59 
60 struct	altsectbl {			/* working alts info		*/
61 	struct  alts_ent *ast_entp;	/* alternate sector entry table */
62 	int	ast_entused;		/* entry used			*/
63 	struct	alt_info *ast_alttblp;	/* alts info			*/
64 	int	ast_altsiz;		/* size of alts info		*/
65 	struct  alts_ent *ast_gbadp;	/* growing bad sector entry ptr */
66 	int	ast_gbadcnt;		/* growing bad sector entry cnt */
67 };
68 /*	size of incore alternate partition memory structure		*/
69 #define	ALTSECTBL_SIZE	sizeof(struct altsectbl)
70 
71 /*	macro definitions						*/
72 #define	byte_to_secsiz(APSIZE, BPS)	(daddr_t) \
73 					((((APSIZE) + (BPS) - 1) \
74 					 / (uint)(BPS)) * (BPS))
75