]> git.ozlabs.org Git - yaboot.git/blob - second/fs.c
Commit yaboot 1.3.5
[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 #include "errors.h"
24
25 extern const struct fs_t        of_filesystem;
26 extern const struct fs_t        of_net_filesystem;
27 extern const struct fs_t        ext2_filesystem;
28 //extern const struct fs_t      iso_filesystem;
29
30 /* Configurable filesystems */
31
32 #ifdef CONFIG_FS_XFS
33 extern const struct fs_t        xfs_filesystem;
34 #endif /* CONFIG_FS_XFS */
35
36 #ifdef CONFIG_FS_REISERFS
37 extern const struct fs_t        reiserfs_filesystem;
38 #endif /* CONFIG_FS_REISERFS */
39
40 /* Filesystem handlers yaboot knows about */
41 static const struct fs_t *block_filesystems[] = {
42      &ext2_filesystem,          /* ext2 */
43 #ifdef CONFIG_FS_XFS
44      &xfs_filesystem,                /* XFS */
45 #endif /* CONFIG_FS_XFS */
46 #ifdef CONFIG_FS_REISERFS
47      &reiserfs_filesystem,              /* reiserfs */
48 #endif /* CONFIG_FS_REISERFS */
49      &of_filesystem,                    /* HFS/HFS+, ISO9660, UDF, UFS */
50      NULL
51 };
52
53 const struct fs_t *fs_of = &of_filesystem;              /* needed by ISO9660 */
54 const struct fs_t *fs_of_netboot = &of_net_filesystem;  /* needed by file.c */
55
56 const struct fs_t *
57 fs_open(struct boot_file_t *file, const char *dev_name,
58         struct partition_t *part, const char *file_name)
59 {
60      const struct fs_t **fs;
61      for (fs = block_filesystems; *fs; fs++)
62           if ((fserrorno = (*fs)->open(file, dev_name, part, file_name)) != FILE_ERR_BAD_FSYS)
63                break;
64
65      return *fs;
66 }
67
68 /* 
69  * Local variables:
70  * c-file-style: "k&r"
71  * c-basic-offset: 5
72  * End:
73  */