pcfs_glue.c revision 3bbf88b3546192f29c18986b9fb8a19ff364a4ea
/*
* 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
*/
/*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <libintl.h>
#include <locale.h>
#include "message.h"
/*
* It's main functionality is to get the stage file blocklist. It's
* used for installing grub on a Solaris boot partition.
*/
extern struct boot_fs_ops bpcfs_ops;
struct boot_fs_ops *bfs_ops;
static int dev_fd;
int bootrd_debug = 0;
#define DEV_BSIZE 512
#define MAX_CHUNK 64
static unsigned int *blocklist;
/* diskread_callback is set in filesytem module (pcfs.c) */
int (*diskread_callback)(int, int);
int (*fileread_callback)(int, int);
static int
{
static int i = -2;
return (0);
}
i += 2;
if (i >= DEV_BSIZE / 8) {
exit(-1);
}
return (0);
}
/*
* This one reads the ramdisk. If fi_memp is set, we copy the
* ramdisk content to the designated buffer. Otherwise, we
* do a "cached" read (set fi_memp to the actual ramdisk buffer).
*/
int
{
int ret;
if (diskread_callback) {
return (0);
}
}
return (-1);
}
if (ret < 0)
perror("diskread: pread");
return (ret >= 0 ? 0 : -1);
}
void *
{
return (malloc(s));
}
/*ARGSUSED*/
void
bkmem_free(void *p, size_t s)
{
free(p);
}
static int
{
int i;
/* try ops in bfs_tab and return the first successful one */
return (0);
}
return (-1);
}
static int
{
return (BRD_UNMOUNTROOT(bfs_ops));
}
static int
{
}
static int
pcfs_glue_close(int fd)
{
}
static ssize_t
{
}
/*
* Get the blocklist for stage2
*/
int
{
int i, fd, stage2_block;
if (mountroot("dummy") != 0) {
return (-1);
}
return (-1);
}
if (bootrd_debug)
(void) printf("start reading stage2:\n");
stage2_block = 0;
for (;;) {
break;
stage2_block++;
}
(void) pcfs_glue_close(fd);
if (bootrd_debug) {
for (i = 0; blocklist[i] != 0; i += 2) {
(void) printf("sectors: %d-%d\n",
blocklist[i],
}
}
(void) unmountroot();
return (0);
}