fsys_ffs.c revision 1b8adde7ba7d5e04395c141c5400dc2cffd7d809
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* Elements of this file were originally from the FreeBSD "biosboot"
* bootloader file "disk.c" dated 4/12/95.
*
* The license and header comments from that file are included here.
*/
/*
* Mach Operating System
* Copyright (c) 1992, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*
* from: Mach, Revision 2.2 92/04/04 11:35:49 rpd
* $Id: fsys_ffs.c,v 1.1.1.1 2003/11/20 02:04:59 fengshuo Exp $
*/
#ifdef FSYS_FFS
#include "shared.h"
#include "filesys.h"
#include "defs.h"
#include "disk_inode.h"
#include "disk_inode_ffs.h"
#include "dir.h"
#include "fs.h"
/* used for filesystem map blocks */
static int mapblock;
static int mapblock_offset;
static int mapblock_bsize;
/* pointer to superblock */
#define MAPBUF_LEN 8192
int
ffs_mount (void)
{
int retval = 1;
retval = 0;
mapblock = -1;
mapblock_offset = -1;
return retval;
}
static int
block_map (int file_block)
{
if (file_block < NDADDR)
/* If the blockmap loaded does not include FILE_BLOCK,
load a new blockmap. */
{
{
bsize = MAPBUF_LEN;
}
else
{
offset = 0;
}
{
mapblock = -1;
mapblock_bsize = -1;
mapblock_offset = -1;
return -1;
}
}
- mapblock_offset]);
}
int
{
{
break;
}
if (errnum)
ret = 0;
return ret;
}
int
{
/* main loop to find destination inode */
loop:
/* load current inode (defaults to the root inode) */
return 0; /* XXX what return value? */
/* if we have a real file (and we're not just printing possibilities),
then this is where we want to exit */
{
{
return 0;
}
/* incomplete implementation requires this! */
return 1;
}
while (*dirname == '/')
dirname++;
{
return 0;
}
*rest = 0;
loc = 0;
/* loop for reading a the entries in a directory */
do
{
{
#if 0
putchar ('\n');
#endif
if (print_possibilities < 0)
return 1;
return 0;
}
{
(char *) FSYS_BUF))
{
return 0;
}
}
#ifndef STAGE1_5
{
if (print_possibilities > 0)
}
#endif /* STAGE1_5 */
}
/* only get here if we have a matching directory entry */
/* go back to main loop at top of function */
goto loop;
}
int
{
/* XXX: I don't know if this is really correct. Someone who is
familiar with BSD should check for this. */
if (needed_sectors > 14)
return 0;
*start_sector = 1;
#if 1
/* FIXME: Disable the embedding in FFS until someone checks if
the code above is correct. */
return 0;
#else
return 1;
#endif
}
#endif /* FSYS_FFS */