1/* filesys.h - abstract filesystem interface */ 2/* 3 * GRUB -- GRand Unified Bootloader 4 * Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 */ 20 21#include "pc_slice.h" 22 23#ifdef FSYS_FFS 24#define FSYS_FFS_NUM 1 25int ffs_mount (void); 26int ffs_read (char *buf, int len); 27int ffs_dir (char *dirname); 28int ffs_embed (int *start_sector, int needed_sectors); 29#else 30#define FSYS_FFS_NUM 0 31#endif 32 33#ifdef FSYS_UFS2 34#define FSYS_UFS2_NUM 1 35int ufs2_mount (void); 36int ufs2_read (char *buf, int len); 37int ufs2_dir (char *dirname); 38int ufs2_embed (int *start_sector, int needed_sectors); 39#else 40#define FSYS_UFS2_NUM 0 41#endif 42 43#ifdef FSYS_FAT 44#define FSYS_FAT_NUM 1 45int fat_mount (void); 46int fat_read (char *buf, int len); 47int fat_dir (char *dirname); 48#else 49#define FSYS_FAT_NUM 0 50#endif 51 52#ifdef FSYS_EXT2FS 53#define FSYS_EXT2FS_NUM 1 54int ext2fs_mount (void); 55int ext2fs_read (char *buf, int len); 56int ext2fs_dir (char *dirname); 57#else 58#define FSYS_EXT2FS_NUM 0 59#endif 60 61#ifdef FSYS_MINIX 62#define FSYS_MINIX_NUM 1 63int minix_mount (void); 64int minix_read (char *buf, int len); 65int minix_dir (char *dirname); 66#else 67#define FSYS_MINIX_NUM 0 68#endif 69 70#ifdef FSYS_REISERFS 71#define FSYS_REISERFS_NUM 1 72int reiserfs_mount (void); 73int reiserfs_read (char *buf, int len); 74int reiserfs_dir (char *dirname); 75int reiserfs_embed (int *start_sector, int needed_sectors); 76#else 77#define FSYS_REISERFS_NUM 0 78#endif 79 80#ifdef FSYS_VSTAFS 81#define FSYS_VSTAFS_NUM 1 82int vstafs_mount (void); 83int vstafs_read (char *buf, int len); 84int vstafs_dir (char *dirname); 85#else 86#define FSYS_VSTAFS_NUM 0 87#endif 88 89#ifdef FSYS_JFS 90#define FSYS_JFS_NUM 1 91int jfs_mount (void); 92int jfs_read (char *buf, int len); 93int jfs_dir (char *dirname); 94int jfs_embed (int *start_sector, int needed_sectors); 95#else 96#define FSYS_JFS_NUM 0 97#endif 98 99#ifdef FSYS_XFS 100#define FSYS_XFS_NUM 1 101int xfs_mount (void); 102int xfs_read (char *buf, int len); 103int xfs_dir (char *dirname); 104#else 105#define FSYS_XFS_NUM 0 106#endif 107 108#ifdef FSYS_TFTP 109#define FSYS_TFTP_NUM 1 110int tftp_mount (void); 111int tftp_read (char *buf, int len); 112int tftp_dir (char *dirname); 113void tftp_close (void); 114#else 115#define FSYS_TFTP_NUM 0 116#endif 117 118#ifdef FSYS_ISO9660 119#define FSYS_ISO9660_NUM 1 120int iso9660_mount (void); 121int iso9660_read (char *buf, int len); 122int iso9660_dir (char *dirname); 123#else 124#define FSYS_ISO9660_NUM 0 125#endif 126 127#ifndef NUM_FSYS 128#define NUM_FSYS \ 129 (FSYS_FFS_NUM + FSYS_FAT_NUM + FSYS_EXT2FS_NUM + FSYS_MINIX_NUM \ 130 + FSYS_REISERFS_NUM + FSYS_VSTAFS_NUM + FSYS_JFS_NUM + FSYS_XFS_NUM \ 131 + FSYS_TFTP_NUM + FSYS_ISO9660_NUM + FSYS_UFS2_NUM) 132#endif 133 134/* defines for the block filesystem info area */ 135#ifndef NO_BLOCK_FILES 136#define BLK_CUR_FILEPOS (*((int*)FSYS_BUF)) 137#define BLK_CUR_BLKLIST (*((int*)(FSYS_BUF+4))) 138#define BLK_CUR_BLKNUM (*((int*)(FSYS_BUF+8))) 139#define BLK_MAX_ADDR (FSYS_BUF+0x7FF9) 140#define BLK_BLKSTART(l) (*((int*)l)) 141#define BLK_BLKLENGTH(l) (*((int*)(l+4))) 142#define BLK_BLKLIST_START (FSYS_BUF+12) 143#define BLK_BLKLIST_INC_VAL 8 144#endif /* NO_BLOCK_FILES */ 145 146/* this next part is pretty ugly, but it keeps it in one place! */ 147 148struct fsys_entry 149{ 150 char *name; 151 int (*mount_func) (void); 152 int (*read_func) (char *buf, int len); 153 int (*dir_func) (char *dirname); 154 void (*close_func) (void); 155 int (*embed_func) (int *start_sector, int needed_sectors); 156}; 157 158#ifdef STAGE1_5 159# define print_possibilities 0 160#else 161extern int print_possibilities; 162#endif 163 164extern int fsmax; 165extern struct fsys_entry fsys_table[NUM_FSYS + 1]; 166