xref: /titanic_54/usr/src/cmd/zinject/zinject.h (revision ea8dc4b6d2251b437950c0056bc626b311c73c27)
1*ea8dc4b6Seschrock /*
2*ea8dc4b6Seschrock  * CDDL HEADER START
3*ea8dc4b6Seschrock  *
4*ea8dc4b6Seschrock  * The contents of this file are subject to the terms of the
5*ea8dc4b6Seschrock  * Common Development and Distribution License (the "License").
6*ea8dc4b6Seschrock  * You may not use this file except in compliance with the License.
7*ea8dc4b6Seschrock  *
8*ea8dc4b6Seschrock  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*ea8dc4b6Seschrock  * or http://www.opensolaris.org/os/licensing.
10*ea8dc4b6Seschrock  * See the License for the specific language governing permissions
11*ea8dc4b6Seschrock  * and limitations under the License.
12*ea8dc4b6Seschrock  *
13*ea8dc4b6Seschrock  * When distributing Covered Code, include this CDDL HEADER in each
14*ea8dc4b6Seschrock  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*ea8dc4b6Seschrock  * If applicable, add the following below this CDDL HEADER, with the
16*ea8dc4b6Seschrock  * fields enclosed by brackets "[]" replaced with your own identifying
17*ea8dc4b6Seschrock  * information: Portions Copyright [yyyy] [name of copyright owner]
18*ea8dc4b6Seschrock  *
19*ea8dc4b6Seschrock  * CDDL HEADER END
20*ea8dc4b6Seschrock  */
21*ea8dc4b6Seschrock /*
22*ea8dc4b6Seschrock  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*ea8dc4b6Seschrock  * Use is subject to license terms.
24*ea8dc4b6Seschrock  */
25*ea8dc4b6Seschrock 
26*ea8dc4b6Seschrock #ifndef	_ZINJECT_H
27*ea8dc4b6Seschrock #define	_ZINJECT_H
28*ea8dc4b6Seschrock 
29*ea8dc4b6Seschrock #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*ea8dc4b6Seschrock 
31*ea8dc4b6Seschrock #include <sys/zfs_ioctl.h>
32*ea8dc4b6Seschrock 
33*ea8dc4b6Seschrock #ifdef	__cplusplus
34*ea8dc4b6Seschrock extern "C" {
35*ea8dc4b6Seschrock #endif
36*ea8dc4b6Seschrock 
37*ea8dc4b6Seschrock typedef enum {
38*ea8dc4b6Seschrock 	TYPE_DATA,		/* plain file contents		*/
39*ea8dc4b6Seschrock 	TYPE_DNODE,		/* metadnode contents		*/
40*ea8dc4b6Seschrock 	TYPE_MOS,		/* all MOS data			*/
41*ea8dc4b6Seschrock 	TYPE_MOSDIR,		/* MOS object directory		*/
42*ea8dc4b6Seschrock 	TYPE_METASLAB,		/* metaslab objects		*/
43*ea8dc4b6Seschrock 	TYPE_CONFIG,		/* MOS config			*/
44*ea8dc4b6Seschrock 	TYPE_BPLIST,		/* block pointer list		*/
45*ea8dc4b6Seschrock 	TYPE_SPACEMAP,		/* space map objects		*/
46*ea8dc4b6Seschrock 	TYPE_ERRLOG,		/* persistent error log		*/
47*ea8dc4b6Seschrock 	TYPE_INVAL
48*ea8dc4b6Seschrock } err_type_t;
49*ea8dc4b6Seschrock 
50*ea8dc4b6Seschrock #define	MOS_TYPE(t)	\
51*ea8dc4b6Seschrock 	((t) >= TYPE_MOS && (t) < TYPE_INVAL)
52*ea8dc4b6Seschrock 
53*ea8dc4b6Seschrock int translate_record(err_type_t type, const char *object, const char *range,
54*ea8dc4b6Seschrock     int level, zinject_record_t *record, char *poolname, char *dataset);
55*ea8dc4b6Seschrock int translate_raw(const char *raw, zinject_record_t *record);
56*ea8dc4b6Seschrock int translate_device(const char *pool, const char *device,
57*ea8dc4b6Seschrock     zinject_record_t *record);
58*ea8dc4b6Seschrock void usage(void);
59*ea8dc4b6Seschrock 
60*ea8dc4b6Seschrock #ifdef	__cplusplus
61*ea8dc4b6Seschrock }
62*ea8dc4b6Seschrock #endif
63*ea8dc4b6Seschrock 
64*ea8dc4b6Seschrock #endif	/* _ZINJECT_H */
65