1ea8dc4b6Seschrock /* 2ea8dc4b6Seschrock * CDDL HEADER START 3ea8dc4b6Seschrock * 4ea8dc4b6Seschrock * The contents of this file are subject to the terms of the 5ea8dc4b6Seschrock * Common Development and Distribution License (the "License"). 6ea8dc4b6Seschrock * You may not use this file except in compliance with the License. 7ea8dc4b6Seschrock * 8ea8dc4b6Seschrock * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9ea8dc4b6Seschrock * or http://www.opensolaris.org/os/licensing. 10ea8dc4b6Seschrock * See the License for the specific language governing permissions 11ea8dc4b6Seschrock * and limitations under the License. 12ea8dc4b6Seschrock * 13ea8dc4b6Seschrock * When distributing Covered Code, include this CDDL HEADER in each 14ea8dc4b6Seschrock * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15ea8dc4b6Seschrock * If applicable, add the following below this CDDL HEADER, with the 16ea8dc4b6Seschrock * fields enclosed by brackets "[]" replaced with your own identifying 17ea8dc4b6Seschrock * information: Portions Copyright [yyyy] [name of copyright owner] 18ea8dc4b6Seschrock * 19ea8dc4b6Seschrock * CDDL HEADER END 20ea8dc4b6Seschrock */ 21ea8dc4b6Seschrock /* 2298d1cbfeSGeorge Wilson * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 23ea8dc4b6Seschrock */ 24ea8dc4b6Seschrock 25ea8dc4b6Seschrock #ifndef _ZINJECT_H 26ea8dc4b6Seschrock #define _ZINJECT_H 27ea8dc4b6Seschrock 28ea8dc4b6Seschrock #include <sys/zfs_ioctl.h> 29ea8dc4b6Seschrock 30ea8dc4b6Seschrock #ifdef __cplusplus 31ea8dc4b6Seschrock extern "C" { 32ea8dc4b6Seschrock #endif 33ea8dc4b6Seschrock 34ea8dc4b6Seschrock typedef enum { 35ea8dc4b6Seschrock TYPE_DATA, /* plain file contents */ 36ea8dc4b6Seschrock TYPE_DNODE, /* metadnode contents */ 37ea8dc4b6Seschrock TYPE_MOS, /* all MOS data */ 38ea8dc4b6Seschrock TYPE_MOSDIR, /* MOS object directory */ 39ea8dc4b6Seschrock TYPE_METASLAB, /* metaslab objects */ 40ea8dc4b6Seschrock TYPE_CONFIG, /* MOS config */ 41*cde58dbcSMatthew Ahrens TYPE_BPOBJ, /* block pointer list */ 42ea8dc4b6Seschrock TYPE_SPACEMAP, /* space map objects */ 43ea8dc4b6Seschrock TYPE_ERRLOG, /* persistent error log */ 4421bf64a7Sgw TYPE_LABEL_UBERBLOCK, /* label specific uberblock */ 4521bf64a7Sgw TYPE_LABEL_NVLIST, /* label specific nvlist */ 4698d1cbfeSGeorge Wilson TYPE_LABEL_PAD1, /* label specific 8K pad1 area */ 4798d1cbfeSGeorge Wilson TYPE_LABEL_PAD2, /* label specific 8K pad2 area */ 48ea8dc4b6Seschrock TYPE_INVAL 49ea8dc4b6Seschrock } err_type_t; 50ea8dc4b6Seschrock 51ea8dc4b6Seschrock #define MOS_TYPE(t) \ 5221bf64a7Sgw ((t) >= TYPE_MOS && (t) < TYPE_LABEL_UBERBLOCK) 5321bf64a7Sgw 5421bf64a7Sgw #define LABEL_TYPE(t) \ 5521bf64a7Sgw ((t) >= TYPE_LABEL_UBERBLOCK && (t) < TYPE_INVAL) 56ea8dc4b6Seschrock 57ea8dc4b6Seschrock int translate_record(err_type_t type, const char *object, const char *range, 58ea8dc4b6Seschrock int level, zinject_record_t *record, char *poolname, char *dataset); 59ea8dc4b6Seschrock int translate_raw(const char *raw, zinject_record_t *record); 60ea8dc4b6Seschrock int translate_device(const char *pool, const char *device, 6121bf64a7Sgw err_type_t label_type, zinject_record_t *record); 62ea8dc4b6Seschrock void usage(void); 63ea8dc4b6Seschrock 6499653d4eSeschrock extern libzfs_handle_t *g_zfs; 6599653d4eSeschrock 66ea8dc4b6Seschrock #ifdef __cplusplus 67ea8dc4b6Seschrock } 68ea8dc4b6Seschrock #endif 69ea8dc4b6Seschrock 70ea8dc4b6Seschrock #endif /* _ZINJECT_H */ 71