Deleted Added
full compact
zhack.c (249643) zhack.c (252764)
1/*
2 * CDDL HEADER START
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

--- 7 unchanged lines hidden (view full) ---

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/*
23 * Copyright (c) 2012 by Delphix. All rights reserved.
1/*
2 * CDDL HEADER START
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

--- 7 unchanged lines hidden (view full) ---

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/*
23 * Copyright (c) 2012 by Delphix. All rights reserved.
24 * Copyright (c) 2013 Steven Hartland. All rights reserved.
24 */
25
26/*
27 * zhack is a debugging tool that can write changes to ZFS pool using libzpool
28 * for testing purposes. Altering pools with zhack is unsupported and may
29 * result in corrupted pools.
30 */
31

--- 116 unchanged lines hidden (view full) ---

148 g_importargs.unique = B_TRUE;
149 g_importargs.can_be_active = readonly;
150 g_pool = strdup(target);
151 if ((sepp = strpbrk(g_pool, "/@")) != NULL)
152 *sepp = '\0';
153 g_importargs.poolname = g_pool;
154 pools = zpool_search_import(g_zfs, &g_importargs);
155
25 */
26
27/*
28 * zhack is a debugging tool that can write changes to ZFS pool using libzpool
29 * for testing purposes. Altering pools with zhack is unsupported and may
30 * result in corrupted pools.
31 */
32

--- 116 unchanged lines hidden (view full) ---

149 g_importargs.unique = B_TRUE;
150 g_importargs.can_be_active = readonly;
151 g_pool = strdup(target);
152 if ((sepp = strpbrk(g_pool, "/@")) != NULL)
153 *sepp = '\0';
154 g_importargs.poolname = g_pool;
155 pools = zpool_search_import(g_zfs, &g_importargs);
156
156 if (pools == NULL || nvlist_next_nvpair(pools, NULL) == NULL) {
157 if (nvlist_empty(pools)) {
157 if (!g_importargs.can_be_active) {
158 g_importargs.can_be_active = B_TRUE;
159 if (zpool_search_import(g_zfs, &g_importargs) != NULL ||
160 spa_open(target, &spa, FTAG) == 0) {
161 fatal("cannot import '%s': pool is active; run "
162 "\"zpool export %s\" first\n",
163 g_pool, g_pool);
164 }

--- 377 unchanged lines hidden ---
158 if (!g_importargs.can_be_active) {
159 g_importargs.can_be_active = B_TRUE;
160 if (zpool_search_import(g_zfs, &g_importargs) != NULL ||
161 spa_open(target, &spa, FTAG) == 0) {
162 fatal("cannot import '%s': pool is active; run "
163 "\"zpool export %s\" first\n",
164 g_pool, g_pool);
165 }

--- 377 unchanged lines hidden ---