1 // SPDX-License-Identifier: CDDL-1.0 2 /* 3 * This file and its contents are supplied under the terms of the 4 * Common Development and Distribution License ("CDDL"), version 1.0. 5 * You may only use this file in accordance with the terms of version 6 * 1.0 of the CDDL. 7 * 8 * A full copy of the text of the CDDL should have accompanied this 9 * source. A copy of the CDDL is also available via the Internet at 10 * https://opensource.org/license/CDDL-1.0. 11 */ 12 /* 13 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 14 */ 15 16 #ifndef _ZINJECT_H 17 #define _ZINJECT_H 18 19 #include <sys/zfs_ioctl.h> 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 typedef enum { 26 TYPE_DATA, /* plain file contents */ 27 TYPE_DNODE, /* metadnode contents */ 28 TYPE_MOS, /* all MOS data */ 29 TYPE_MOSDIR, /* MOS object directory */ 30 TYPE_METASLAB, /* metaslab objects */ 31 TYPE_CONFIG, /* MOS config */ 32 TYPE_BPOBJ, /* block pointer list */ 33 TYPE_SPACEMAP, /* space map objects */ 34 TYPE_ERRLOG, /* persistent error log */ 35 TYPE_LABEL_UBERBLOCK, /* label specific uberblock */ 36 TYPE_LABEL_NVLIST, /* label specific nvlist */ 37 TYPE_LABEL_PAD1, /* label specific 8K pad1 area */ 38 TYPE_LABEL_PAD2, /* label specific 8K pad2 area */ 39 TYPE_INVAL 40 } err_type_t; 41 42 #define MOS_TYPE(t) \ 43 ((t) >= TYPE_MOS && (t) < TYPE_LABEL_UBERBLOCK) 44 45 #define LABEL_TYPE(t) \ 46 ((t) >= TYPE_LABEL_UBERBLOCK && (t) < TYPE_INVAL) 47 48 int translate_record(err_type_t type, const char *object, const char *range, 49 int level, zinject_record_t *record, char *poolname, char *dataset); 50 int translate_raw(const char *raw, zinject_record_t *record); 51 int translate_device(const char *pool, const char *device, 52 err_type_t label_type, zinject_record_t *record); 53 void usage(void); 54 55 extern libzfs_handle_t *g_zfs; 56 57 #ifdef __cplusplus 58 } 59 #endif 60 61 #endif /* _ZINJECT_H */ 62