1N/A/* filesys.h - abstract filesystem interface */
1N/A/*
1N/A * GRUB -- GRand Unified Bootloader
1N/A * Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc.
1N/A *
1N/A * This program is free software; you can redistribute it and/or modify
1N/A * it under the terms of the GNU General Public License as published by
1N/A * the Free Software Foundation; either version 2 of the License, or
1N/A * (at your option) any later version.
1N/A *
1N/A * This program is distributed in the hope that it will be useful,
1N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
1N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1N/A * GNU General Public License for more details.
1N/A *
1N/A * You should have received a copy of the GNU General Public License
1N/A * along with this program; if not, write to the Free Software
1N/A * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1N/A */
1N/A
1N/A#include "pc_slice.h"
1N/A
1N/A#ifdef FSYS_FFS
1N/A#define FSYS_FFS_NUM 1
1N/Aint ffs_mount (void);
1N/Aint ffs_read (char *buf, int len);
1N/Aint ffs_dir (char *dirname);
1N/Aint ffs_embed (int *start_sector, int needed_sectors);
1N/A#else
1N/A#define FSYS_FFS_NUM 0
1N/A#endif
1N/A
1N/A#ifdef FSYS_UFS
1N/A#define FSYS_UFS_NUM 1
1N/Aint ufs_mount (void);
1N/Aint ufs_read (char *buf, int len);
1N/Aint ufs_dir (char *dirname);
1N/Aint ufs_embed (int *start_sector, int needed_sectors);
1N/A#else
1N/A#define FSYS_UFS_NUM 0
1N/A#endif
1N/A
1N/A#ifdef FSYS_UFS2
1N/A#define FSYS_UFS2_NUM 1
1N/Aint ufs2_mount (void);
1N/Aint ufs2_read (char *buf, int len);
1N/Aint ufs2_dir (char *dirname);
1N/Aint ufs2_embed (int *start_sector, int needed_sectors);
1N/A#else
1N/A#define FSYS_UFS2_NUM 0
1N/A#endif
1N/A
1N/A#ifdef FSYS_ZFS
1N/A#define FSYS_ZFS_NUM 1
1N/Aint zfs_mount (void);
1N/Aint zfs_read (char *buf, int len);
1N/Aint zfs_open (char *dirname);
1N/Aint zfs_embed (int *start_sector, int needed_sectors);
1N/A#else
1N/A#define FSYS_ZFS_NUM 0
1N/A#endif
1N/A
1N/A#ifdef FSYS_FAT
1N/A#define FSYS_FAT_NUM 1
1N/Aint fat_mount (void);
1N/Aint fat_read (char *buf, int len);
1N/Aint fat_dir (char *dirname);
1N/A#else
1N/A#define FSYS_FAT_NUM 0
1N/A#endif
1N/A
1N/A#ifdef FSYS_EXT2FS
1N/A#define FSYS_EXT2FS_NUM 1
1N/Aint ext2fs_mount (void);
1N/Aint ext2fs_read (char *buf, int len);
1N/Aint ext2fs_dir (char *dirname);
1N/A#else
1N/A#define FSYS_EXT2FS_NUM 0
1N/A#endif
1N/A
1N/A#ifdef FSYS_MINIX
1N/A#define FSYS_MINIX_NUM 1
1N/Aint minix_mount (void);
1N/Aint minix_read (char *buf, int len);
1N/Aint minix_dir (char *dirname);
1N/A#else
1N/A#define FSYS_MINIX_NUM 0
1N/A#endif
1N/A
1N/A#ifdef FSYS_REISERFS
1N/A#define FSYS_REISERFS_NUM 1
1N/Aint reiserfs_mount (void);
1N/Aint reiserfs_read (char *buf, int len);
1N/Aint reiserfs_dir (char *dirname);
1N/Aint reiserfs_embed (int *start_sector, int needed_sectors);
1N/A#else
1N/A#define FSYS_REISERFS_NUM 0
1N/A#endif
1N/A
1N/A#ifdef FSYS_VSTAFS
1N/A#define FSYS_VSTAFS_NUM 1
1N/Aint vstafs_mount (void);
1N/Aint vstafs_read (char *buf, int len);
1N/Aint vstafs_dir (char *dirname);
1N/A#else
1N/A#define FSYS_VSTAFS_NUM 0
1N/A#endif
1N/A
1N/A#ifdef FSYS_JFS
1N/A#define FSYS_JFS_NUM 1
1N/Aint jfs_mount (void);
1N/Aint jfs_read (char *buf, int len);
1N/Aint jfs_dir (char *dirname);
1N/Aint jfs_embed (int *start_sector, int needed_sectors);
1N/A#else
1N/A#define FSYS_JFS_NUM 0
1N/A#endif
1N/A
1N/A#ifdef FSYS_XFS
1N/A#define FSYS_XFS_NUM 1
1N/Aint xfs_mount (void);
1N/Aint xfs_read (char *buf, int len);
1N/Aint xfs_dir (char *dirname);
1N/A#else
1N/A#define FSYS_XFS_NUM 0
1N/A#endif
1N/A
1N/A#ifdef FSYS_TFTP
1N/A#define FSYS_TFTP_NUM 1
1N/Aint tftp_mount (void);
1N/Aint tftp_read (char *buf, int len);
1N/Aint tftp_dir (char *dirname);
1N/Avoid tftp_close (void);
1N/A#else
1N/A#define FSYS_TFTP_NUM 0
1N/A#endif
1N/A
1N/A#ifdef FSYS_ISO9660
1N/A#define FSYS_ISO9660_NUM 1
1N/Aint iso9660_mount (void);
1N/Aint iso9660_read (char *buf, int len);
1N/Aint iso9660_dir (char *dirname);
1N/A#else
1N/A#define FSYS_ISO9660_NUM 0
1N/A#endif
1N/A
1N/A#ifndef NUM_FSYS
1N/A#define NUM_FSYS \
1N/A (FSYS_FFS_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM + FSYS_MINIX_NUM \
1N/A + FSYS_REISERFS_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM + FSYS_XFS_NUM \
1N/A + FSYS_TFTP_NUM + FSYS_ISO9660_NUM + FSYS_UFS_NUM + FSYS_UFS2_NUM \
1N/A + FSYS_ZFS_NUM)
1N/A#endif
1N/A
1N/A/* defines for the block filesystem info area */
1N/A#ifndef NO_BLOCK_FILES
1N/A#define BLK_CUR_FILEPOS (*((int*)FSYS_BUF))
1N/A#define BLK_CUR_BLKLIST (*((int*)(FSYS_BUF+4)))
1N/A#define BLK_CUR_BLKNUM (*((int*)(FSYS_BUF+8)))
1N/A#define BLK_MAX_ADDR (FSYS_BUF+0x7FF9)
1N/A#define BLK_BLKSTART(l) (*((int*)l))
1N/A#define BLK_BLKLENGTH(l) (*((int*)(l+4)))
1N/A#define BLK_BLKLIST_START (FSYS_BUF+12)
1N/A#define BLK_BLKLIST_INC_VAL 8
1N/A#endif /* NO_BLOCK_FILES */
1N/A
1N/A/* this next part is pretty ugly, but it keeps it in one place! */
1N/A
1N/Astruct fsys_entry
1N/A{
1N/A char *name;
1N/A int (*mount_func) (void);
1N/A int (*read_func) (char *buf, int len);
1N/A int (*dir_func) (char *dirname);
1N/A void (*close_func) (void);
1N/A int (*embed_func) (int *start_sector, int needed_sectors);
1N/A};
1N/A
1N/A#ifdef STAGE1_5
1N/A# define print_possibilities 0
1N/A#else
1N/Aextern int print_possibilities;
1N/A#endif
1N/A
1N/Aextern int fsmax;
1N/Aextern struct fsys_entry fsys_table[NUM_FSYS + 1];