fsys_xfs.c revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
/* fsys_xfs.c - an implementation for the SGI XFS file system */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2001,2002 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.
*/
#ifdef FSYS_XFS
#include "shared.h"
#include "filesys.h"
#include "xfs.h"
#define MAX_LINK_COUNT 8
typedef struct xad {
} xad_t;
struct xfs_info {
int bsize;
int dirbsize;
int isize;
unsigned int agblocks;
int bdlog;
int blklog;
int inopblog;
int agblklog;
int agnolog;
unsigned int nextents;
int btnode_ptr0_off;
int i8param;
int dirpos;
int dirmax;
int blkoff;
int fpos;
};
static inline xfs_agblock_t
{
return agino >> XFS_INO_OFFSET_BITS;
}
static inline xfs_agnumber_t
{
return ino >> XFS_INO_AGINO_BITS;
}
static inline xfs_agino_t
{
}
static inline int
{
}
static inline __const__ __uint16_t
le16 (__uint16_t x)
{
__asm__("xchgb %b0,%h0" \
: "=q" (x) \
: "0" (x)); \
return x;
}
static inline __const__ __uint32_t
le32 (__uint32_t x)
{
#if 0
/* 386 doesn't have bswap. */
#else
/* This is slower but this works on all x86 architectures. */
__asm__("xchgb %b0, %h0" \
"\n\troll $16, %0" \
"\n\txchgb %b0, %h0" \
: "=q" (x) : "0" (x));
#endif
return x;
}
static inline __const__ __uint64_t
le64 (__uint64_t x)
{
__uint32_t h = x >> 32;
}
static xfs_fsblock_t
{
}
static xfs_fileoff_t
{
}
static xfs_filblks_t
xt_len (xfs_bmbt_rec_32_t *r)
{
}
static inline int
{
int i;
if (--v) {
for (i = 0; i < 31; i++, v >>= 1) {
if (v == 0)
return i;
}
}
return 0;
}
static int
{
}
static xfs_daddr_t
{
}
static xfs_daddr_t
{
}
#define offsetof(t,m) ((int)&(((t *)0)->m))
static inline int
btroot_maxrecs (void)
{
(sizeof (xfs_bmbt_key_t) + sizeof (xfs_bmbt_ptr_t));
}
static int
{
int offset;
+ btroot_maxrecs ()*sizeof(xfs_bmbt_key_t));
return 1;
}
static void
init_extents (void)
{
case XFS_DINODE_FMT_EXTENTS:
break;
case XFS_DINODE_FMT_BTREE:
for (;;) {
sizeof(xfs_btree_lblock_t), (char *)&h);
if (!h.bb_level) {
return;
}
sizeof(xfs_bmbt_ptr_t), (char *)&ptr0);
}
}
}
static xad_t *
next_extent (void)
{
case XFS_DINODE_FMT_EXTENTS:
return NULL;
break;
case XFS_DINODE_FMT_BTREE:
return NULL;
}
/* Yeah, I know that's slow, but I really don't care */
}
return &xad;
}
/*
* Name lies - the function reads only first 100 bytes
*/
static void
xfs_dabread (void)
{
init_extents ();
while ((xad = next_extent ())) {
0, 100, dirbuf);
break;
}
}
}
static inline xfs_ino_t
{
}
static inline xfs_ino_t
sf_parent_ino (void)
{
}
static inline int
roundup8 (int n)
{
return ((n+7)&~7);
}
static char *
{
int namelen = 1;
int toread;
static xfs_dir2_sf_entry_t *sfe;
return NULL;
xfs_dabread ();
#define h ((xfs_dir2_leaf_hdr_t *)dirbuf)
#undef h
}
case XFS_DINODE_FMT_LOCAL:
case -2:
*ino = 0;
break;
case -1:
*ino = sf_parent_ino ();
++name;
++namelen;
sfe = (xfs_dir2_sf_entry_t *)
+ sizeof(xfs_dir2_sf_hdr_t)
break;
default:
sfe = (xfs_dir2_sf_entry_t *)
}
break;
case XFS_DINODE_FMT_BTREE:
case XFS_DINODE_FMT_EXTENTS:
for (;;) {
}
continue;
}
break;
}
}
return name;
}
static char *
{
case XFS_DINODE_FMT_LOCAL:
break;
case XFS_DINODE_FMT_EXTENTS:
case XFS_DINODE_FMT_BTREE:
filepos = 0;
} else {
#define h ((xfs_dir2_leaf_hdr_t *)dirbuf)
#define n ((xfs_da_intnode_t *)dirbuf)
for (;;) {
xfs_dabread ();
break;
}
}
#undef n
#undef h
}
}
return next_dentry (ino);
}
int
xfs_mount (void)
{
& XFS_SB_VERSION_NUMBITS) != XFS_SB_VERSION_4) ) {
return 0;
}
(sizeof (xfs_bmbt_key_t) + sizeof (xfs_bmbt_ptr_t)))
* sizeof(xfs_bmbt_key_t) + sizeof(xfs_btree_block_t);
return 1;
}
int
{
return len;
}
init_extents ();
*buf++ = 0;
}
continue;
}
}
}
int
{
int di_mode;
int cmp, n, link_count;
link_count = 0;
for (;;) {
if (++link_count > MAX_LINK_COUNT) {
return 0;
}
filepos = 0;
} else {
return 0;
}
linkbuf[n] = 0;
continue;
}
return 0;
}
filepos = 0;
return 1;
}
return 0;
}
*rest = 0;
for (;;) {
#ifndef STAGE1_5
if (print_possibilities > 0)
} else
#endif
if (cmp == 0) {
parent_ino = ino;
if (new_ino)
break;
}
if (print_possibilities < 0)
return 1;
return 0;
}
}
}
}
#endif /* FSYS_XFS */