ufs.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 1991-1994, 2002 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.
*/
#include "iob.h"
#include "cbootblk.h"
/*
* due to boot block size problems, these macros are coded
* to use the older narrow file offset type (31 bit). This
* saves a lot of code space. Since we will never encounter
* a large file here, it is safe to cast offset_t to off_t.
*/
#define NULL 0
char fscompname[] = "ufsboot";
static int
{
return (0);
return (1);
}
static ino_t
{
char *q;
char c;
ino_t n;
char *link;
return (0);
root:
return (0);
while (*path) {
while (*path == '/')
path++;
q = path;
while (*q != '/' && *q != '\0')
q++;
c = *q;
*q = '\0';
*q = c;
return (0);
case IFREG:
case IFDIR:
break;
case IFLNK:
return (0);
if (*link == '/')
/*
* Copy unprocessed pathname up & prepend link
* (Yes, this bcopy handles overlapping args)
*/
goto root;
/*NOTREACHED*/
default:
return (0);
}
if (c == '\0')
break;
path = q;
continue;
} else
return (0);
}
}
static daddr_t
{
int i, j, sh;
/* These are the pools of buffers, iob's, etc. */
static union {
} b;
/*
* blocks 0..NDADDR are direct blocks
*/
/*
* addresses NIADDR have single and double indirect blocks.
* the first step is to determine how many levels of indirection.
*/
sh = 1;
for (j = NIADDR; j > 0; j--) {
break;
}
if (j == 0)
return ((daddr_t)0);
/*
* fetch the first indirect block address from the inode
*/
if (nb == 0)
return ((daddr_t)0);
/*
* fetch through the indirect blocks
*/
for (; j <= NIADDR; j++) {
return ((daddr_t)0);
}
if (nb == 0)
return ((daddr_t)0);
}
return (nb);
}
static ino_t
{
if (s == NULL || *s == '\0')
return (0);
return (0);
continue;
}
return (0);
}
/*
* get next entry in a directory.
*/
static struct direct *
{
int off;
int bsize;
for (;;) {
return (NULL);
if (off == 0) {
return (NULL);
return (NULL);
}
continue;
return (dp);
}
}
static int
{
if (diff <= 0)
return (-1);
return (-1);
return (0);
}
int
{
int i, j;
if ((i = count) <= 0)
return (0);
while (i > 0) {
return (0);
}
buf += j;
i -= j;
}
return (count);
}
/*
* Open a file.
*/
int
{
return (-1); /* if devopen fails, open fails */
/* Pseudo-mount a file system; read the superblock. */
goto failed;
puts("bootblk: not a UFS file system.\n");
goto failed;
}
goto failed;
return (0); /* only one open file! */
return (-1);
}
int
{
}
/*
* This version of seek() only performs absolute seeks (whence == 0).
*/
void
{
}