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