fsys_ufs.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 2005 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) {
break;
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. */
{
/* 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 */