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 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _SD_PCU_H 27 #define _SD_PCU_H 28 29 /* 30 * All structures here are on-disk, unless specified otherwise. 31 * In-core stuff is hidden inside implementation modules. 32 */ 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 /* 39 * Header. 40 */ 41 #define SDBC_PWF_MAGIC 0xbcbcbc01 42 43 typedef struct sdbc_pwf_hdr_s { 44 int32_t magic; /* magic number to distinguish file revs */ 45 int32_t alignment; /* all sections are multiples of this */ 46 /* a cache block is this identical size */ 47 int32_t bmap_size; /* number of entries in each bitmap entry */ 48 int32_t cd_count; /* number of devices we have data for */ 49 nsc_off_t string_pool; /* offset in file to pool of filenames */ 50 nsc_off_t descriptor_pool; /* offset in file to dbc_pwf_desc_t vector */ 51 int64_t dump_time; /* Timestamp == longest time_t */ 52 } sdbc_pwf_hdr_t; 53 54 /* 55 * File description 56 */ 57 typedef struct sdbc_pwf_desc_s { 58 int32_t pad0; 59 uint32_t name; /* name + stringpool == offset of filename */ 60 /* the name given to nsc_open */ 61 nsc_off_t blocks; /* offset into swap for this device's data */ 62 nsc_off_t bitmaps; /* offset into swap for data bitmaps */ 63 /* (i.e. nothing to do with rdc bitmaps */ 64 uint64_t nblocks; /* number of data blocks == bitmap dimension */ 65 /* long rdc_data; */ /* offset to rdc data (NYI) */ 66 } sdbc_pwf_desc_t; 67 68 /* 69 * record status section - describes the state of each cache block in the file 70 * 71 * zaitcev - XXX errs is per block, not per fba? 72 */ 73 typedef struct sdbc_pwf_rec_s { 74 uint32_t dirty; /* Bitmap of dirty fba'a (_sd_bitmap_t) */ 75 int32_t errs; /* error status per fba, needed to recover */ 76 /* from errors to a raidset where we must recover */ 77 /* from a stripe write error */ 78 /* (i.e. parity is bad or suspect ) */ 79 nsc_off_t fba_num; /* the block on the disk */ 80 } sdbc_pwf_rec_t; 81 82 typedef struct sdbc_pwf_bitmap_s { 83 sdbc_pwf_rec_t bitmaps[1]; /* dynamic array based on cache block size */ 84 } sdbc_pwf_bitmap_t; 85 86 /* 87 * Prototypes 88 */ 89 #ifdef _KERNEL /* XXX Split into sd_pcu_ondisk.h, sd_pcu_iface.h */ 90 extern char _sdbc_shutdown_in_progress; 91 92 extern int _sdbc_pcu_config(int c, char **v); 93 extern void _sdbc_pcu_unload(void); 94 extern void _sdbc_power_lost(int rideout); 95 extern void _sdbc_power_ok(void); 96 extern void _sdbc_power_down(void); 97 #endif 98 99 #ifdef __cplusplus 100 } 101 #endif 102 103 #endif /* _SD_PCU_H */ 104