]> git.ozlabs.org Git - yaboot.git/blob - second/fs.c
Commit yaboot 1.3.1
[yaboot.git] / second / fs.c
1 /*
2     FileSystems common definitions
3
4     Copyright (C) 1999 Benjamin Herrenschmidt
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 #include "stdlib.h"
22 #include "fs.h"
23
24 extern const struct fs_t        of_filesystem;
25 extern const struct fs_t        of_net_filesystem;
26 extern const struct fs_t        ext2_filesystem;
27 extern const struct fs_t        reiserfs_filesystem;
28 //extern const struct fs_t      iso_filesystem;
29
30 /* Filesystem handlers yaboot knows about */
31 static const struct fs_t *block_filesystems[] = {
32         &ext2_filesystem,               /* ext2 */
33         &reiserfs_filesystem,           /* reiserfs */
34         &of_filesystem,                 /* HFS/HFS+, ISO9660, UDF, UFS */
35         NULL
36 };
37
38 const struct fs_t *fs_of = &of_filesystem;              /* needed by ISO9660 */
39 const struct fs_t *fs_of_netboot = &of_net_filesystem;  /* needed by file.c */
40
41 const struct fs_t *
42 fs_open( struct boot_file_t *file, const char *dev_name,
43          struct partition_t *part, const char *file_name)
44 {
45     const struct fs_t **fs;
46     for( fs = block_filesystems; *fs; fs++ )
47         if( (*fs)->open( file, dev_name, part, file_name ) == FILE_ERR_OK )
48             break;
49
50     return *fs;
51 }