/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006 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.
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifdef FSYS_UFS
#include "shared.h"
#include "filesys.h"
#include "ufs.h"
/* These are the pools of buffers, etc. */
static int openi(grub_ino_t);
/* read superblock and check fs magic */
int
ufs_mount(void)
{
if (! IS_PC_SLICE_TYPE_SOLARIS(current_slice) ||
return 0;
return 1;
}
/*
* searching for a file, if successful, inode will be loaded in INODE
* The entry point should really be named ufs_open(char *pathname).
* For now, keep it consistent with the rest of fsys modules.
*/
int
{
/* skip leading slashes */
while (*dirname == '/')
dirname++;
return 0;
/* parse for next path component */
dirname++;
*dirname = 0; /* ensure null termination */
while (*dirname == '/')
dirname++;
}
/* return 1 only if inode exists and is a regular file */
return (0);
filepos = 0;
}
/*
* This is the high-level read function.
*/
int
{
while (len) {
/* we are in a file hole, just zero the buf */
} else {
disk_read_func = 0;
if (!ok)
return 0;
}
}
return (ret);
}
int
{
if (needed_sectors > 14)
return 0;
*start_sector = 2;
return 1;
}
/* read inode and place content in INODE */
static int
{
int off;
/* get block and byte offset into the block */
}
/*
* Performs fileblock mapping. Convert file block no. to disk block no.
* Returns 0 when block doesn't exist and <0 when block isn't initialized
* (i.e belongs to a hole in the file).
*/
{
/* blocks 0..UFS_NDADDR are direct blocks */
if (bn < UFS_NDADDR) {
}
/* determine how many levels of indirection. */
level = 0;
bn -= UFS_NDADDR;
level++;
}
return ((grub_daddr32_t)0);
/* fetch the first indirect block */
if (nb == 0) {
return ((grub_daddr32_t)0);
}
indirblk0 = 0;
(char *)INDIRBLK0))
return (0);
}
/* fetch through the indirect blocks */
for (i = 1; i <= level; i++) {
(char *)INDIRBLK1))
return (0);
}
if (nb == 0)
return ((grub_daddr32_t)0);
}
return (nb);
}
/* search directory content for name, return inode number */
static grub_ino_t
{
return 0;
loc = 0;
/* offset into block */
if (off == 0) { /* need to read in a new block */
/* get logical block number */
/* resolve indrect blocks */
if (dbn == 0)
return (0);
(char *)DIRENT)) {
return 0;
}
}
}
return (0);
}
#endif /* FSYS_UFS */