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 227c478bd9Sstevel@tonic-gate /* 23*342440ecSPrasad Singamsetty * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate * 267c478bd9Sstevel@tonic-gate * copyright (c) 1990, 1991 UNIX System Laboratories, Inc. 277c478bd9Sstevel@tonic-gate * copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T 287c478bd9Sstevel@tonic-gate * All Rights Reserved 297c478bd9Sstevel@tonic-gate */ 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifndef _BADSEC_H 327c478bd9Sstevel@tonic-gate #define _BADSEC_H 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #ifdef __cplusplus 357c478bd9Sstevel@tonic-gate extern "C" { 367c478bd9Sstevel@tonic-gate #endif 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #define BADSECFILE "/etc/scsi/badsec" 397c478bd9Sstevel@tonic-gate #define FAILURE 1 407c478bd9Sstevel@tonic-gate #define SUCCESS 0 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #define MAXBLENT 4 437c478bd9Sstevel@tonic-gate struct badsec_lst { 44*342440ecSPrasad Singamsetty uint_t bl_cnt; 457c478bd9Sstevel@tonic-gate struct badsec_lst *bl_nxt; 46*342440ecSPrasad Singamsetty uint_t bl_sec[MAXBLENT]; 477c478bd9Sstevel@tonic-gate }; 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate #define BADSLSZ sizeof (struct badsec_lst) 507c478bd9Sstevel@tonic-gate #define BFI_FORMAT 0 517c478bd9Sstevel@tonic-gate #define ATA_FORMAT 1 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate #define ALTS_ADDPART 0x1 /* add alternate partition */ 547c478bd9Sstevel@tonic-gate struct alts_mempart { /* incore alts partition info */ 557c478bd9Sstevel@tonic-gate int ap_flag; /* flag for alternate partition */ 567c478bd9Sstevel@tonic-gate struct alts_parttbl *ap_tblp; /* alts partition table */ 57*342440ecSPrasad Singamsetty uint_t ap_tbl_secsiz; /* alts parttbl sector size */ 587c478bd9Sstevel@tonic-gate uchar_t *ap_memmapp; /* incore alternate sector map */ 597c478bd9Sstevel@tonic-gate uchar_t *ap_mapp; /* alternate sector map */ 60*342440ecSPrasad Singamsetty uint_t ap_map_secsiz; /* alts partmap sector size */ 61*342440ecSPrasad Singamsetty uint_t ap_map_sectot; /* alts partmap # sector */ 627c478bd9Sstevel@tonic-gate struct alts_ent *ap_entp; /* alternate sector entry table */ 63*342440ecSPrasad Singamsetty uint_t ap_ent_secsiz; /* alts entry sector size */ 647c478bd9Sstevel@tonic-gate struct alts_ent *ap_gbadp; /* growing badsec entry table */ 65*342440ecSPrasad Singamsetty uint_t ap_gbadcnt; /* growing bad sector count */ 66*342440ecSPrasad Singamsetty struct dkl_partition part; /* alts partition configuration */ 677c478bd9Sstevel@tonic-gate }; 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate /* size of incore alternate partition memory structure */ 707c478bd9Sstevel@tonic-gate #define ALTS_MEMPART_SIZE sizeof (struct alts_mempart) 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gate struct altsectbl { /* working alts info */ 737c478bd9Sstevel@tonic-gate struct alts_ent *ast_entp; /* alternate sector entry table */ 74*342440ecSPrasad Singamsetty uint_t ast_entused; /* entry used */ 757c478bd9Sstevel@tonic-gate struct alt_info *ast_alttblp; /* alts info */ 76*342440ecSPrasad Singamsetty uint_t ast_altsiz; /* size of alts info */ 777c478bd9Sstevel@tonic-gate struct alts_ent *ast_gbadp; /* growing bad sector entry ptr */ 78*342440ecSPrasad Singamsetty uint_t ast_gbadcnt; /* growing bad sector entry cnt */ 797c478bd9Sstevel@tonic-gate }; 807c478bd9Sstevel@tonic-gate /* size of incore alternate partition memory structure */ 817c478bd9Sstevel@tonic-gate #define ALTSECTBL_SIZE sizeof (struct altsectbl) 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate /* macro definitions */ 84*342440ecSPrasad Singamsetty #define byte_to_secsiz(APSIZE, BPS) (uint_t) \ 857c478bd9Sstevel@tonic-gate ((((APSIZE) + (BPS) - 1) \ 867c478bd9Sstevel@tonic-gate / (uint_t)(BPS)) * (BPS)) 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gate #ifdef __cplusplus 897c478bd9Sstevel@tonic-gate } 907c478bd9Sstevel@tonic-gate #endif 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate #endif /* _BADSEC_H */ 93