ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock/*
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * CDDL HEADER START
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock *
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * The contents of this file are subject to the terms of the
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * Common Development and Distribution License (the "License").
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * You may not use this file except in compliance with the License.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock *
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * or http://www.opensolaris.org/os/licensing.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * See the License for the specific language governing permissions
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * and limitations under the License.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock *
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * When distributing Covered Code, include this CDDL HEADER in each
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * If applicable, add the following below this CDDL HEADER, with the
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * fields enclosed by brackets "[]" replaced with your own identifying
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * information: Portions Copyright [yyyy] [name of copyright owner]
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock *
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock * CDDL HEADER END
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock */
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock/*
98d1cbfec254295273b6a761bc1861c0374bdf02George Wilson * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock */
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock#ifndef _ZINJECT_H
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock#define _ZINJECT_H
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock#include <sys/zfs_ioctl.h>
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock#ifdef __cplusplus
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrockextern "C" {
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock#endif
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrocktypedef enum {
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock TYPE_DATA, /* plain file contents */
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock TYPE_DNODE, /* metadnode contents */
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock TYPE_MOS, /* all MOS data */
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock TYPE_MOSDIR, /* MOS object directory */
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock TYPE_METASLAB, /* metaslab objects */
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock TYPE_CONFIG, /* MOS config */
cde58dbc6a23d4d38db7c8866312be83221c765fMatthew Ahrens TYPE_BPOBJ, /* block pointer list */
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock TYPE_SPACEMAP, /* space map objects */
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock TYPE_ERRLOG, /* persistent error log */
21bf64a78855d076f09716ea1c06175d954e934cgw TYPE_LABEL_UBERBLOCK, /* label specific uberblock */
21bf64a78855d076f09716ea1c06175d954e934cgw TYPE_LABEL_NVLIST, /* label specific nvlist */
98d1cbfec254295273b6a761bc1861c0374bdf02George Wilson TYPE_LABEL_PAD1, /* label specific 8K pad1 area */
98d1cbfec254295273b6a761bc1861c0374bdf02George Wilson TYPE_LABEL_PAD2, /* label specific 8K pad2 area */
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock TYPE_INVAL
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock} err_type_t;
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock#define MOS_TYPE(t) \
21bf64a78855d076f09716ea1c06175d954e934cgw ((t) >= TYPE_MOS && (t) < TYPE_LABEL_UBERBLOCK)
21bf64a78855d076f09716ea1c06175d954e934cgw
21bf64a78855d076f09716ea1c06175d954e934cgw#define LABEL_TYPE(t) \
21bf64a78855d076f09716ea1c06175d954e934cgw ((t) >= TYPE_LABEL_UBERBLOCK && (t) < TYPE_INVAL)
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrockint translate_record(err_type_t type, const char *object, const char *range,
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock int level, zinject_record_t *record, char *poolname, char *dataset);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrockint translate_raw(const char *raw, zinject_record_t *record);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrockint translate_device(const char *pool, const char *device,
21bf64a78855d076f09716ea1c06175d954e934cgw err_type_t label_type, zinject_record_t *record);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrockvoid usage(void);
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock
99653d4ee642c6528e88224f12409a5f23060994eschrockextern libzfs_handle_t *g_zfs;
99653d4ee642c6528e88224f12409a5f23060994eschrock
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock#ifdef __cplusplus
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock}
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock#endif
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock
ea8dc4b6d2251b437950c0056bc626b311c73c27eschrock#endif /* _ZINJECT_H */