2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * Function prototypes 2N/A * Gets a dmgt_disk_t for the given disk dm_descriptor_t. 2N/A * 1. Success: error is set to 0 and a dmgt_disk_t is returned 2N/A * 2. Failure: error is set to -1 and NULL is returned 2N/A "could not get media from disk %s",
2N/A /* Get free slices */ 2N/A /* Normalize error */ 2N/A /* For each alias... */ 2N/A /* Free previously-allocated names */ 2N/A /* Try to get the status */ 2N/A * Gets the slices for the given disk. 2N/A * 1. Success: error is set to 0 and slices are returned 2N/A * 2. Failure: error is set to -1 and NULL is returned 2N/A /* For each slice... */ 2N/A /* NULL-terminated array */ 2N/A /* Normalize error */ 2N/A * Gets the slices for the given disk. 2N/A * 1. Success: error is set to 0 and slices are returned 2N/A * 2. Failure: error is set to -1 and NULL is returned 2N/A /* Prune slices based on use */ 2N/A * Slice at this index could be NULL if 2N/A * removed in earlier iteration 2N/A /* Disk is in use */ 2N/A * Remove any slice that overlaps with this 2N/A /* Normalize error */ 2N/A /* Try to get the number of accessible blocks */ 2N/A /* Disk is probably not labeled, get raw size instead */ 2N/A /* Get slice use statistics */ 2N/A /* Get the type of usage for this slice */ 2N/A /* Get the object using this slice */ 2N/A /* Get the size in blocks */ 2N/A /* Convert to bytes */ 2N/A /* Get the starting block */ 2N/A "start block of slice: %s",
2N/A /* Convert to bytes */ 2N/A/* Should go away once 6285992 is fixed */ 2N/A /* Determine whether this slice could be passed to "zpool -f" */ 2N/A "can't use %s: used name: %s: used by: %s\n message: %s\n",
2N/A * Iterates through each available disk on the system. For each free 2N/A * dmgt_disk_t *, runs the given function with the dmgt_disk_t * as 2N/A * the first arg and the given void * as the second arg. 2N/A /* Search for fixed disks */ 2N/A /* For each disk... */ 2N/A /* Reset error flag for each disk */ 2N/A /* Is this disk online? */ 2N/A /* Get a dmgt_disk_t for this dm_descriptor_t */ 2N/A * If this disk or any of its 2N/A * slices is usable... 2N/A /* Run the given function */ 2N/A "has no available slices: " 2N/A * For clients that need to capture error output.