]> git.ozlabs.org Git - yaboot.git/blob - second/fs.c
yaboot-1.3.17
[yaboot.git] / second / fs.c
1 /*
2  *  fs.c - Filesystem common definitions
3  *
4  *  Copyright (C) 2001, 2002 Ethan Benson
5  *
6  *  Copyright (C) 1999 Benjamin Herrenschmidt
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21  */
22
23 #include "stdlib.h"
24 #include "fs.h"
25 #include "errors.h"
26
27 extern const struct fs_t        of_filesystem;
28 extern const struct fs_t        of_net_filesystem;
29 extern const struct fs_t        ext2_filesystem;
30 extern const struct fs_t        swap_filesystem;
31 //extern const struct fs_t      iso_filesystem;
32
33 /* Configurable filesystems */
34
35 #ifdef CONFIG_FS_XFS
36 extern const struct fs_t        xfs_filesystem;
37 #endif /* CONFIG_FS_XFS */
38
39 #ifdef CONFIG_FS_REISERFS
40 extern const struct fs_t        reiserfs_filesystem;
41 #endif /* CONFIG_FS_REISERFS */
42
43 /* Filesystem handlers yaboot knows about */
44 static const struct fs_t *block_filesystems[] = {
45      &swap_filesystem,          /* swap signature checker */
46      &ext2_filesystem,          /* ext2 */
47 #ifdef CONFIG_FS_XFS
48      &xfs_filesystem,                /* XFS */
49 #endif /* CONFIG_FS_XFS */
50 #ifdef CONFIG_FS_REISERFS
51      &reiserfs_filesystem,              /* reiserfs */
52 #endif /* CONFIG_FS_REISERFS */
53      &of_filesystem,                    /* HFS/HFS+, ISO9660, UDF, UFS */
54      NULL
55 };
56
57 const struct fs_t *fs_of = &of_filesystem;              /* needed by ISO9660 */
58 const struct fs_t *fs_of_netboot = &of_net_filesystem;  /* needed by file.c */
59
60 const struct fs_t *
61 fs_open(struct boot_file_t *file,
62         struct partition_t *part, struct boot_fspec_t *fspec)
63 {
64      const struct fs_t **fs;
65      for (fs = block_filesystems; *fs; fs++)
66           if ((fserrorno = (*fs)->open(file, part, fspec)) != FILE_ERR_BAD_FSYS)
67                break;
68
69      return *fs;
70 }
71
72 /* 
73  * Local variables:
74  * c-file-style: "k&r"
75  * c-basic-offset: 5
76  * End:
77  */