spa_boot.c revision e7cbe64f7a72dae5cb44f100db60ca88f3313c65
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
char *
{
char *zfs_bp;
return (NULL);
return (zfs_bp);
}
void
spa_free_bootfs(char *bootfs)
{
}
/*
* Calculate how many device pathnames are in devpath_list.
* The devpath_list could look like this:
*
*/
static int
spa_count_devpath(char *devpath_list)
{
int numpath;
numpath = 0;
/* skip leading blanks */
while (*tmp_path == ' ')
tmp_path++;
numpath++;
/* skip contiguous blanks */
while (*blank == ' ')
blank++;
}
numpath++;
return (numpath);
}
/*
* Only allow booting the device if it has the same vdev information as
* the most recently updated vdev (highest txg) and is in a valid state.
*
* list as what GRUB passes in.
*/
static int
{
char *type;
&nvtop) == 0);
/*
* Check if the devpath_list is the same as the path list in conf.
* If these two lists are different, then the booting device is not an
* up-to-date device that can be booted.
*/
label_path = 0;
for (c = 0; c < children; c++) {
char *physpath;
&physpath) != 0)
return (EINVAL);
if (spa_rootdev_validate(child[c])) {
return (EINVAL);
label_path++;
} else {
char *blank;
*blank = '\0';
return (EINVAL);
if (blank)
*blank = ' ';
}
}
if (label_path != grub_path)
return (EINVAL);
return (0);
}
/*
* Given a list of vdev physpath names, pick the vdev with the most recent txg,
* and return the point of the device's physpath in the list and the device's
* label configuration. The content of the label would be the most recent
* updated information.
*/
int
{
while (devpath[0] == ' ')
devpath++;
*blank = '\0';
*blank = ' ';
while (*blank == ' ')
blank++;
}
/* for the only or the last devpath in the devpath_list */
return (EINVAL);
/*
* Check if the device is in a bootable state.
* dev may have a trailing blank since it points to a string
* in the devpath_list.
*/
return (EINVAL);
return (0);
}