1185029Spjd/*
2185029Spjd * CDDL HEADER START
3185029Spjd *
4185029Spjd * The contents of this file are subject to the terms of the
5185029Spjd * Common Development and Distribution License (the "License").
6185029Spjd * You may not use this file except in compliance with the License.
7185029Spjd *
8185029Spjd * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9185029Spjd * or http://www.opensolaris.org/os/licensing.
10185029Spjd * See the License for the specific language governing permissions
11185029Spjd * and limitations under the License.
12185029Spjd *
13185029Spjd * When distributing Covered Code, include this CDDL HEADER in each
14185029Spjd * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15185029Spjd * If applicable, add the following below this CDDL HEADER, with the
16185029Spjd * fields enclosed by brackets "[]" replaced with your own identifying
17185029Spjd * information: Portions Copyright [yyyy] [name of copyright owner]
18185029Spjd *
19185029Spjd * CDDL HEADER END
20185029Spjd */
21185029Spjd/*
22219089Spjd * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23185029Spjd */
24185029Spjd
25185029Spjd#ifndef	_ZINJECT_H
26185029Spjd#define	_ZINJECT_H
27185029Spjd
28185029Spjd#include <sys/zfs_ioctl.h>
29185029Spjd
30185029Spjd#ifdef	__cplusplus
31185029Spjdextern "C" {
32185029Spjd#endif
33185029Spjd
34185029Spjdtypedef enum {
35185029Spjd	TYPE_DATA,		/* plain file contents		*/
36185029Spjd	TYPE_DNODE,		/* metadnode contents		*/
37185029Spjd	TYPE_MOS,		/* all MOS data			*/
38185029Spjd	TYPE_MOSDIR,		/* MOS object directory		*/
39185029Spjd	TYPE_METASLAB,		/* metaslab objects		*/
40185029Spjd	TYPE_CONFIG,		/* MOS config			*/
41219089Spjd	TYPE_BPOBJ,		/* block pointer list		*/
42185029Spjd	TYPE_SPACEMAP,		/* space map objects		*/
43185029Spjd	TYPE_ERRLOG,		/* persistent error log		*/
44185029Spjd	TYPE_LABEL_UBERBLOCK,	/* label specific uberblock	*/
45185029Spjd	TYPE_LABEL_NVLIST,	/* label specific nvlist	*/
46219089Spjd	TYPE_LABEL_PAD1,	/* label specific 8K pad1 area	*/
47219089Spjd	TYPE_LABEL_PAD2,	/* label specific 8K pad2 area	*/
48185029Spjd	TYPE_INVAL
49185029Spjd} err_type_t;
50185029Spjd
51185029Spjd#define	MOS_TYPE(t)	\
52185029Spjd	((t) >= TYPE_MOS && (t) < TYPE_LABEL_UBERBLOCK)
53185029Spjd
54185029Spjd#define	LABEL_TYPE(t)	\
55185029Spjd	((t) >= TYPE_LABEL_UBERBLOCK && (t) < TYPE_INVAL)
56185029Spjd
57185029Spjdint translate_record(err_type_t type, const char *object, const char *range,
58185029Spjd    int level, zinject_record_t *record, char *poolname, char *dataset);
59185029Spjdint translate_raw(const char *raw, zinject_record_t *record);
60185029Spjdint translate_device(const char *pool, const char *device,
61185029Spjd    err_type_t label_type, zinject_record_t *record);
62185029Spjdvoid usage(void);
63185029Spjd
64185029Spjdextern libzfs_handle_t *g_zfs;
65185029Spjd
66185029Spjd#ifdef	__cplusplus
67185029Spjd}
68185029Spjd#endif
69185029Spjd
70185029Spjd#endif	/* _ZINJECT_H */
71