main.c revision 199767f8919635c4928607450d9e0abb932109ce
/*-
* Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
* Copyright (c) 1998,2000 Doug Rabson <dfr@freebsd.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
__FBSDID("$FreeBSD$");
#include <stand.h>
#include <string.h>
#include <setjmp.h>
#include "bootstrap.h"
#include "disk.h"
#include "libuserboot.h"
#if defined(USERBOOT_ZFS_SUPPORT)
static void userboot_zfs_probe(void);
static int userboot_zfs_found;
#endif
/* Minimum version required */
#define USERBOOT_VERSION USERBOOT_VERSION_3
struct loader_callbacks *callbacks;
void *callbacks_arg;
extern char bootprog_name[];
extern char bootprog_rev[];
extern char bootprog_date[];
extern char bootprog_maker[];
static void extract_currdev(void);
void
{
}
void
exit(int v)
{
}
void
{
const char *var;
int i;
if (version < USERBOOT_VERSION)
abort();
callbacks_arg = arg;
/*
* initialise the heap as early as possible. Once this is done,
* alloc() is usable.
*/
/*
* Hook up the console
*/
cons_probe();
printf("\n");
#if 0
#endif
/*
* Set custom environment variables
*/
i = 0;
while (1) {
break;
}
#if defined(USERBOOT_ZFS_SUPPORT)
#endif
/*
* March through the device switch probing for things.
*/
return;
exit(0);
}
/*
* Set the 'current device' by (if possible) recovering the boot device as
* supplied by the initial bootstrap.
*/
static void
extract_currdev(void)
{
struct disk_devdesc dev;
//bzero(&dev, sizeof(dev));
#if defined(USERBOOT_ZFS_SUPPORT)
if (userboot_zfs_found) {
struct zfs_devdesc zdev;
} else
#endif
if (userboot_disk_maxunit > 0) {
dev.d_partition = 0;
/*
* If we cannot auto-detect the partition type then
* access the disk as a raw device.
*/
}
} else {
}
}
#if defined(USERBOOT_ZFS_SUPPORT)
static void
userboot_zfs_probe(void)
{
char devname[32];
int unit;
/*
* Open all the disks we can find and see if we can reconstruct
* ZFS pools from them. Record if any were found.
*/
pool_guid = 0;
if (pool_guid != 0)
userboot_zfs_found = 1;
}
}
static int
{
int err;
if (argc != 2) {
command_errmsg = "a single dataset must be supplied";
return (CMD_ERROR);
}
if (err != 0) {
return (CMD_ERROR);
}
return (CMD_OK);
}
static int
{
int err;
char *root;
if (argc > 2) {
command_errmsg = "wrong number of arguments";
return (CMD_ERROR);
}
if (argc == 2) {
} else {
return (CMD_OK);
}
}
if (err != 0) {
return (CMD_ERROR);
}
return (CMD_OK);
}
#endif /* USERBOOT_ZFS_SUPPORT */
static int
{
return (CMD_OK);
}
static int
{
return (CMD_OK);
}