/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Basic file system reading code for standalone I/O system.
* Simulates a primitive UNIX I/O system (read(), write(), open(), etc).
* Does not support writes.
*/
#include <sys/sysmacros.h>
#ifdef _BOOT
#else
#endif
#define SUSP_SP_IX 0
#ifdef _BOOT
#else
/* PRINTFLIKE1 */
extern void kobj_printf(char *, ...);
#endif
extern int bootrd_debug;
extern void *bkmem_alloc(size_t);
extern void bkmem_free(void *, size_t);
extern int cf_check_compressed(fileid_t *);
struct dirstuff {
int loc;
};
struct hs_direct {
};
static char *hsfs_sig_tab[] = {
};
/*
* Local prototypes
*/
static int bhsfs_mountroot(char *str);
static int bhsfs_unmountroot(void);
static int bhsfs_close(int fd);
static void bhsfs_closeall(void);
static fileid_t *
{
if (fd >= 0) {
}
return (0);
}
static int
{
/* Set up the IO request */
return (0);
return (0);
return (0);
}
return (1);
}
static ino_t
{
char *q;
char c;
ino_t n;
return (0);
return (0);
while (*path) {
while (*path == '/')
path++;
q = path;
while (*q != '/' && *q != '\0')
q++;
c = *q;
*q = '\0';
*q = c;
path = q;
if (n != 0) {
if (c == '\0')
break;
return (0);
continue;
} else {
return (0);
}
}
return ((ino_t)n);
}
static ino_t
{
int len;
dprintf("dlook: %s\n", s);
if (s == NULL || *s == '\0')
return (0);
return (0);
}
return (0);
}
continue;
continue;
}
}
return (0);
}
/*
* get next entry in a directory.
*/
static struct hs_direct *
{
int off;
dprintf("readdir: start\n");
for (;;) {
return (NULL);
}
if (off == 0) {
dprintf("readdir: diskread failed\n");
return (NULL);
}
}
continue;
}
return (&hsdep);
}
}
static int
{
dprintf("getblock: start\n");
if (diff <= 0)
return (-1);
/* which block (or frag) in the file do we read? */
return (-1);
dprintf("getblock: end\n");
return (0);
}
static ssize_t
{
int i, j;
caddr_t n;
return (-1);
n = buf;
if ((i = count) <= 0)
return (0);
while (i > 0) {
return (0); /* encountered an error */
if (j < i)
i = j; /* short read, must have hit EOF */
} else {
return (0);
}
}
buf += j;
i -= j;
}
return (buf - n);
}
/*ARGSUSED*/
static int
{
char *bufp;
return (0); /* already mounted */
dprintf("mounting ramdisk as hsfs\n");
/* now read the superblock. */
printf("failed to read superblock\n");
return (-1);
}
/* Since RRIP is based on ISO9660, that's where we start */
dprintf("volume type does not match\n");
return (-1);
}
/* Now we fill in the volume descriptor */
/* Make sure we have a valid logical block size */
return (-1);
}
/* Since an HSFS root could be located anywhere on the media! */
return (0);
}
static int
bhsfs_unmountroot(void)
{
return (-1);
return (0);
}
/*
* Open a file.
*/
/*ARGSUSED*/
int
{
if (ino == 0) {
return (-1);
}
if (cf_check_compressed(filep) != 0)
return (-1);
dprintf("open done\n");
return (filep->fi_filedes);
}
int
{
return (-1);
return (-1);
}
/* unlink and deallocate node */
dprintf("close done\n");
return (0);
}
static void
bhsfs_closeall(void)
{
printf("Filesystem may be inconsistent.\n");
}
/*
* This version of seek() only performs absolute seeks (whence == 0).
*/
static off_t
{
return (-1);
} else {
switch (whence) {
case SEEK_CUR:
break;
case SEEK_SET:
break;
default:
case SEEK_END:
break;
}
}
return (0);
}
static int
{
return (-1);
return (0);
case IFDIR:
break;
case IFREG:
break;
default:
break;
}
/*
* NOTE: this size will be the compressed size for a compressed file
* This could confuse the caller since we decompress the file behind
* the scenes when the file is read.
*/
/* file times */
return (0);
}
/*
* Parse a directory entry.
*
*/
static uint_t
{
uint_t i;
uchar_t c;
/* a zero length dir entry terminates the dir block */
return (0);
/* fill in some basic hsfs info */
/* we use lbn of data extent as an inode # equivalent */
if (IDE_REGULAR_FILE(c)) {
} else if (IDE_REGULAR_DIR(c)) {
} else {
printf("pd(): file type=0x%x unknown.\n", c);
}
/*
* Massage hsfs name, recognizing special entries for . and ..
* else lopping off version junk.
*/
/* Some initial conditions */
/* Special Case: Current Directory */
/* Special Case: Parent Directory */
/* Other file name */
} else {
for (i = 0; i < nmlen; i++) {
if (c == ';')
break;
else if (c == ' ')
continue;
else
}
}
/* System Use Fields */
if (ce_len == 0)
/* there is an SUA for this dir entry; go parse it */
if (ce_lbn) {
/*
* store away current position in dir,
* as we will be using the iobuf to reading SUA.
*/
do {
printf("failed to read cont. area\n");
ce_len = 0;
ce_lbn = 0;
break;
}
hsdep);
} while (ce_lbn);
}
}
/*
* Parse the System Use Fields in this System Use Area.
* Return blk number of continuation/SUA, or 0 if no continuation/not a SUA.
*/
static uint_t
{
char *susp;
uint_t i;
/*
* A null entry, or an entry with zero length
* terminates the SUSP.
*/
break;
/*
* Compare current entry to all known signatures.
*/
for (i = 0; i < hsfs_num_sig; i++)
break;
switch (i) {
case SUSP_CE_IX:
/*
* CE signature: continuation of SUSP.
* will want to return new lbn, len.
*/
break;
case RRIP_NM_IX:
/* NM signature: POSIX-style file name */
if (!RRIP_NAME_FLAGS(susp)) {
}
break;
case HSFS_NUM_SIG:
/* couldn't find a legit susp, terminate loop */
case SUSP_ST_IX:
/* ST signature: terminates SUSP */
return (ce_lbn);
case SUSP_SP_IX:
case RRIP_RR_IX:
default:
break;
}
}
return (ce_lbn);
}
"boot_hsfs",
};