]>
Commit | Line | Data |
---|---|---|
6a161fa9 | 1 | /* fs.h - filesystem manager */ |
2 | /* | |
3 | * PUPA -- Preliminary Universal Programming Architecture for GRUB | |
4 | * Copyright (C) 2002 Yoshinori K. Okuji <okuji@enbug.org> | |
5 | * | |
6 | * PUPA 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 PUPA; if not, write to the Free Software | |
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
19 | */ | |
20 | ||
21 | #ifndef PUPA_FS_HEADER | |
22 | #define PUPA_FS_HEADER 1 | |
23 | ||
24 | #include <pupa/device.h> | |
25 | #include <pupa/symbol.h> | |
26 | #include <pupa/types.h> | |
27 | ||
28 | /* Forward declaration is required, because of mutual reference. */ | |
29 | struct pupa_file; | |
30 | ||
31 | /* Filesystem descriptor. */ | |
32 | struct pupa_fs | |
33 | { | |
34 | /* My name. */ | |
35 | const char *name; | |
36 | ||
37 | /* Call HOOK with each file under DIR. */ | |
38 | pupa_err_t (*dir) (pupa_device_t device, const char *path, | |
39 | int (*hook) (const char *filename, int dir)); | |
40 | ||
41 | /* Open a file named NAME and initialize FILE. */ | |
42 | pupa_err_t (*open) (struct pupa_file *file, const char *name); | |
43 | ||
44 | /* Read LEN bytes data from FILE into BUF. */ | |
45 | pupa_ssize_t (*read) (struct pupa_file *file, char *buf, pupa_ssize_t len); | |
46 | ||
47 | /* Close the file FILE. */ | |
48 | pupa_err_t (*close) (struct pupa_file *file); | |
49 | ||
50 | /* The next filesystem. */ | |
51 | struct pupa_fs *next; | |
52 | }; | |
53 | typedef struct pupa_fs *pupa_fs_t; | |
54 | ||
55 | /* This is special, because block lists are not files in usual sense. */ | |
56 | extern struct pupa_fs pupa_fs_blocklist; | |
57 | ||
58 | void EXPORT_FUNC(pupa_fs_register) (pupa_fs_t fs); | |
59 | void EXPORT_FUNC(pupa_fs_unregister) (pupa_fs_t fs); | |
60 | void EXPORT_FUNC(pupa_fs_iterate) (int (*hook) (const pupa_fs_t fs)); | |
61 | pupa_fs_t EXPORT_FUNC(pupa_fs_probe) (pupa_device_t device); | |
62 | ||
1cc73a62 | 63 | #ifdef PUPA_UTIL |
64 | void pupa_fat_init (void); | |
65 | void pupa_fat_fini (void); | |
1f7315a3 | 66 | void pupa_ext2_init (void); |
67 | void pupa_ext2_fini (void); | |
1cc73a62 | 68 | #endif /* PUPA_UTIL */ |
69 | ||
6a161fa9 | 70 | #endif /* ! PUPA_FS_HEADER */ |