xref: /titanic_54/usr/src/cmd/zinject/zinject.h (revision 99653d4ee642c6528e88224f12409a5f23060994)
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 /*
22ea8dc4b6Seschrock  * Copyright 2006 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		*/
47ea8dc4b6Seschrock 	TYPE_INVAL
48ea8dc4b6Seschrock } err_type_t;
49ea8dc4b6Seschrock 
50ea8dc4b6Seschrock #define	MOS_TYPE(t)	\
51ea8dc4b6Seschrock 	((t) >= TYPE_MOS && (t) < TYPE_INVAL)
52ea8dc4b6Seschrock 
53ea8dc4b6Seschrock int translate_record(err_type_t type, const char *object, const char *range,
54ea8dc4b6Seschrock     int level, zinject_record_t *record, char *poolname, char *dataset);
55ea8dc4b6Seschrock int translate_raw(const char *raw, zinject_record_t *record);
56ea8dc4b6Seschrock int translate_device(const char *pool, const char *device,
57ea8dc4b6Seschrock     zinject_record_t *record);
58ea8dc4b6Seschrock void usage(void);
59ea8dc4b6Seschrock 
60*99653d4eSeschrock extern libzfs_handle_t *g_zfs;
61*99653d4eSeschrock 
62ea8dc4b6Seschrock #ifdef	__cplusplus
63ea8dc4b6Seschrock }
64ea8dc4b6Seschrock #endif
65ea8dc4b6Seschrock 
66ea8dc4b6Seschrock #endif	/* _ZINJECT_H */
67