xref: /illumos-gate/usr/src/cmd/zinject/zinject.h (revision 21bf64a78855d076f09716ea1c06175d954e934c)
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 /*
22*21bf64a7Sgw  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23ea8dc4b6Seschrock  * Use is subject to license terms.
24ea8dc4b6Seschrock  */
25ea8dc4b6Seschrock 
26ea8dc4b6Seschrock #ifndef	_ZINJECT_H
27ea8dc4b6Seschrock #define	_ZINJECT_H
28ea8dc4b6Seschrock 
29ea8dc4b6Seschrock #pragma ident	"%Z%%M%	%I%	%E% SMI"
30ea8dc4b6Seschrock 
31ea8dc4b6Seschrock #include <sys/zfs_ioctl.h>
32ea8dc4b6Seschrock 
33ea8dc4b6Seschrock #ifdef	__cplusplus
34ea8dc4b6Seschrock extern "C" {
35ea8dc4b6Seschrock #endif
36ea8dc4b6Seschrock 
37ea8dc4b6Seschrock typedef enum {
38ea8dc4b6Seschrock 	TYPE_DATA,		/* plain file contents		*/
39ea8dc4b6Seschrock 	TYPE_DNODE,		/* metadnode contents		*/
40ea8dc4b6Seschrock 	TYPE_MOS,		/* all MOS data			*/
41ea8dc4b6Seschrock 	TYPE_MOSDIR,		/* MOS object directory		*/
42ea8dc4b6Seschrock 	TYPE_METASLAB,		/* metaslab objects		*/
43ea8dc4b6Seschrock 	TYPE_CONFIG,		/* MOS config			*/
44ea8dc4b6Seschrock 	TYPE_BPLIST,		/* block pointer list		*/
45ea8dc4b6Seschrock 	TYPE_SPACEMAP,		/* space map objects		*/
46ea8dc4b6Seschrock 	TYPE_ERRLOG,		/* persistent error log		*/
47*21bf64a7Sgw 	TYPE_LABEL_UBERBLOCK,	/* label specific uberblock	*/
48*21bf64a7Sgw 	TYPE_LABEL_NVLIST,	/* label specific nvlist	*/
49ea8dc4b6Seschrock 	TYPE_INVAL
50ea8dc4b6Seschrock } err_type_t;
51ea8dc4b6Seschrock 
52ea8dc4b6Seschrock #define	MOS_TYPE(t)	\
53*21bf64a7Sgw 	((t) >= TYPE_MOS && (t) < TYPE_LABEL_UBERBLOCK)
54*21bf64a7Sgw 
55*21bf64a7Sgw #define	LABEL_TYPE(t)	\
56*21bf64a7Sgw 	((t) >= TYPE_LABEL_UBERBLOCK && (t) < TYPE_INVAL)
57ea8dc4b6Seschrock 
58ea8dc4b6Seschrock int translate_record(err_type_t type, const char *object, const char *range,
59ea8dc4b6Seschrock     int level, zinject_record_t *record, char *poolname, char *dataset);
60ea8dc4b6Seschrock int translate_raw(const char *raw, zinject_record_t *record);
61ea8dc4b6Seschrock int translate_device(const char *pool, const char *device,
62*21bf64a7Sgw     err_type_t label_type, zinject_record_t *record);
63ea8dc4b6Seschrock void usage(void);
64ea8dc4b6Seschrock 
6599653d4eSeschrock extern libzfs_handle_t *g_zfs;
6699653d4eSeschrock 
67ea8dc4b6Seschrock #ifdef	__cplusplus
68ea8dc4b6Seschrock }
69ea8dc4b6Seschrock #endif
70ea8dc4b6Seschrock 
71ea8dc4b6Seschrock #endif	/* _ZINJECT_H */
72