Deleted Added
full compact
libzfs_import.c (224171) libzfs_import.c (228103)
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

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

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) 2005, 2010, Oracle and/or its affiliates. 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

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

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) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 * Copyright (c) 2011 by Delphix. All rights reserved.
23 */
24
25/*
26 * Pool import support functions.
27 *
28 * To import a pool, we rely on reading the configuration information from the
29 * ZFS label of each device. If we successfully read the label, then we
30 * organize the configuration information in the following hierarchy:

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

430 pool_entry_t *pe;
431 vdev_entry_t *ve;
432 config_entry_t *ce;
433 nvlist_t *ret = NULL, *config = NULL, *tmp, *nvtop, *nvroot;
434 nvlist_t **spares, **l2cache;
435 uint_t i, nspares, nl2cache;
436 boolean_t config_seen;
437 uint64_t best_txg;
25 */
26
27/*
28 * Pool import support functions.
29 *
30 * To import a pool, we rely on reading the configuration information from the
31 * ZFS label of each device. If we successfully read the label, then we
32 * organize the configuration information in the following hierarchy:

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

432 pool_entry_t *pe;
433 vdev_entry_t *ve;
434 config_entry_t *ce;
435 nvlist_t *ret = NULL, *config = NULL, *tmp, *nvtop, *nvroot;
436 nvlist_t **spares, **l2cache;
437 uint_t i, nspares, nl2cache;
438 boolean_t config_seen;
439 uint64_t best_txg;
438 char *name, *hostname;
440 char *name, *hostname, *comment;
439 uint64_t version, guid;
440 uint_t children = 0;
441 nvlist_t **child = NULL;
442 uint_t holes;
443 uint64_t *hole_array, max_id;
444 uint_t c;
445 boolean_t isactive;
446 uint64_t hostid;

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

519 if (!config_seen) {
520 /*
521 * Copy the relevant pieces of data to the pool
522 * configuration:
523 *
524 * version
525 * pool guid
526 * name
441 uint64_t version, guid;
442 uint_t children = 0;
443 nvlist_t **child = NULL;
444 uint_t holes;
445 uint64_t *hole_array, max_id;
446 uint_t c;
447 boolean_t isactive;
448 uint64_t hostid;

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

521 if (!config_seen) {
522 /*
523 * Copy the relevant pieces of data to the pool
524 * configuration:
525 *
526 * version
527 * pool guid
528 * name
529 * comment (if available)
527 * pool state
528 * hostid (if available)
529 * hostname (if available)
530 */
531 uint64_t state;
532
533 verify(nvlist_lookup_uint64(tmp,
534 ZPOOL_CONFIG_VERSION, &version) == 0);

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

540 if (nvlist_add_uint64(config,
541 ZPOOL_CONFIG_POOL_GUID, guid) != 0)
542 goto nomem;
543 verify(nvlist_lookup_string(tmp,
544 ZPOOL_CONFIG_POOL_NAME, &name) == 0);
545 if (nvlist_add_string(config,
546 ZPOOL_CONFIG_POOL_NAME, name) != 0)
547 goto nomem;
530 * pool state
531 * hostid (if available)
532 * hostname (if available)
533 */
534 uint64_t state;
535
536 verify(nvlist_lookup_uint64(tmp,
537 ZPOOL_CONFIG_VERSION, &version) == 0);

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

543 if (nvlist_add_uint64(config,
544 ZPOOL_CONFIG_POOL_GUID, guid) != 0)
545 goto nomem;
546 verify(nvlist_lookup_string(tmp,
547 ZPOOL_CONFIG_POOL_NAME, &name) == 0);
548 if (nvlist_add_string(config,
549 ZPOOL_CONFIG_POOL_NAME, name) != 0)
550 goto nomem;
551
552 /*
553 * COMMENT is optional, don't bail if it's not
554 * there, instead, set it to NULL.
555 */
556 if (nvlist_lookup_string(tmp,
557 ZPOOL_CONFIG_COMMENT, &comment) != 0)
558 comment = NULL;
559 else if (nvlist_add_string(config,
560 ZPOOL_CONFIG_COMMENT, comment) != 0)
561 goto nomem;
562
548 verify(nvlist_lookup_uint64(tmp,
549 ZPOOL_CONFIG_POOL_STATE, &state) == 0);
550 if (nvlist_add_uint64(config,
551 ZPOOL_CONFIG_POOL_STATE, state) != 0)
552 goto nomem;
563 verify(nvlist_lookup_uint64(tmp,
564 ZPOOL_CONFIG_POOL_STATE, &state) == 0);
565 if (nvlist_add_uint64(config,
566 ZPOOL_CONFIG_POOL_STATE, state) != 0)
567 goto nomem;
568
553 hostid = 0;
554 if (nvlist_lookup_uint64(tmp,
555 ZPOOL_CONFIG_HOSTID, &hostid) == 0) {
556 if (nvlist_add_uint64(config,
557 ZPOOL_CONFIG_HOSTID, hostid) != 0)
558 goto nomem;
559 verify(nvlist_lookup_string(tmp,
560 ZPOOL_CONFIG_HOSTNAME,

--- 1166 unchanged lines hidden ---
569 hostid = 0;
570 if (nvlist_lookup_uint64(tmp,
571 ZPOOL_CONFIG_HOSTID, &hostid) == 0) {
572 if (nvlist_add_uint64(config,
573 ZPOOL_CONFIG_HOSTID, hostid) != 0)
574 goto nomem;
575 verify(nvlist_lookup_string(tmp,
576 ZPOOL_CONFIG_HOSTNAME,

--- 1166 unchanged lines hidden ---