3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24
25 /*
26 * This file is intended for functions that ought to be common between user
27 * land (libzfs) and the kernel. When many common routines need to be shared
28 * then a separate file should to be created.
29 */
30
31 #if defined(_KERNEL)
32 #include <sys/systm.h>
33 #else
34 #include <string.h>
35 #endif
36
37 #include <sys/types.h>
38 #include <sys/fs/zfs.h>
39 #include <sys/int_limits.h>
40 #include <sys/nvpair.h>
41 #include "zfs_comutil.h"
42
140 }
141
142 /*
143 * Return the min spa version for a corresponding spa version
144 * -1 is returned if no mapping exists.
145 */
146 int
147 zfs_spa_version_map(int zpl_version)
148 {
149 int i;
150 int version = -1;
151
152 for (i = 0; zfs_version_table[i].version_zpl; i++) {
153 if (zfs_version_table[i].version_zpl >= zpl_version)
154 return (zfs_version_table[i].version_spa);
155 }
156
157 return (version);
158 }
159
160 const char *zfs_history_event_names[LOG_END] = {
161 "invalid event",
162 "pool create",
163 "vdev add",
164 "pool remove",
165 "pool destroy",
166 "pool export",
167 "pool import",
168 "vdev attach",
169 "vdev replace",
170 "vdev detach",
171 "vdev online",
172 "vdev offline",
173 "vdev upgrade",
174 "pool clear",
175 "pool scrub",
176 "pool property set",
177 "create",
178 "clone",
179 "destroy",
180 "destroy_begin_sync",
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2012 by Delphix. All rights reserved.
24 */
25
26 /*
27 * This file is intended for functions that ought to be common between user
28 * land (libzfs) and the kernel. When many common routines need to be shared
29 * then a separate file should to be created.
30 */
31
32 #if defined(_KERNEL)
33 #include <sys/systm.h>
34 #else
35 #include <string.h>
36 #endif
37
38 #include <sys/types.h>
39 #include <sys/fs/zfs.h>
40 #include <sys/int_limits.h>
41 #include <sys/nvpair.h>
42 #include "zfs_comutil.h"
43
141 }
142
143 /*
144 * Return the min spa version for a corresponding spa version
145 * -1 is returned if no mapping exists.
146 */
147 int
148 zfs_spa_version_map(int zpl_version)
149 {
150 int i;
151 int version = -1;
152
153 for (i = 0; zfs_version_table[i].version_zpl; i++) {
154 if (zfs_version_table[i].version_zpl >= zpl_version)
155 return (zfs_version_table[i].version_spa);
156 }
157
158 return (version);
159 }
160
161 /*
162 * This is the table of legacy internal event names; it should not be modified.
163 * The internal events are now stored in the history log as strings.
164 */
165 const char *zfs_history_event_names[ZFS_NUM_LEGACY_HISTORY_EVENTS] = {
166 "invalid event",
167 "pool create",
168 "vdev add",
169 "pool remove",
170 "pool destroy",
171 "pool export",
172 "pool import",
173 "vdev attach",
174 "vdev replace",
175 "vdev detach",
176 "vdev online",
177 "vdev offline",
178 "vdev upgrade",
179 "pool clear",
180 "pool scrub",
181 "pool property set",
182 "create",
183 "clone",
184 "destroy",
185 "destroy_begin_sync",
|