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