1
/* fs.h - filesystem manager */
3
* GRUB -- GRand Unified Bootloader
4
* Copyright (C) 2002,2003,2004 Free Software Foundation, Inc.
6
* GRUB 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.
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.
16
* You should have received a copy of the GNU General Public License
17
* along with GRUB; if not, write to the Free Software
18
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
#ifndef GRUB_FS_HEADER
22
#define GRUB_FS_HEADER 1
24
#include <grub/device.h>
25
#include <grub/symbol.h>
26
#include <grub/types.h>
28
/* Forward declaration is required, because of mutual reference. */
31
/* Filesystem descriptor. */
37
/* Call HOOK with each file under DIR. */
38
grub_err_t (*dir) (grub_device_t device, const char *path,
39
int (*hook) (const char *filename, int dir));
41
/* Open a file named NAME and initialize FILE. */
42
grub_err_t (*open) (struct grub_file *file, const char *name);
44
/* Read LEN bytes data from FILE into BUF. */
45
grub_ssize_t (*read) (struct grub_file *file, char *buf, grub_ssize_t len);
47
/* Close the file FILE. */
48
grub_err_t (*close) (struct grub_file *file);
50
/* Return the label of the device DEVICE in LABEL. The label is
51
returned in a grub_malloc'ed buffer and should be freed by the
53
grub_err_t (*label) (grub_device_t device, char **label);
55
/* The next filesystem. */
58
typedef struct grub_fs *grub_fs_t;
60
/* This is special, because block lists are not files in usual sense. */
61
extern struct grub_fs grub_fs_blocklist;
63
/* This hook is used to automatically load filesystem modules.
64
If this hook loads a module, return non-zero. Otherwise return zero.
65
The newly loaded filesystem is assumed to be inserted into the head of
66
the linked list GRUB_FS_LIST through the function grub_fs_register. */
67
typedef int (*grub_fs_autoload_hook_t) (void);
68
extern grub_fs_autoload_hook_t EXPORT_VAR(grub_fs_autoload_hook);
70
void EXPORT_FUNC(grub_fs_register) (grub_fs_t fs);
71
void EXPORT_FUNC(grub_fs_unregister) (grub_fs_t fs);
72
void EXPORT_FUNC(grub_fs_iterate) (int (*hook) (const grub_fs_t fs));
73
grub_fs_t EXPORT_FUNC(grub_fs_probe) (grub_device_t device);
76
void grub_fat_init (void);
77
void grub_fat_fini (void);
78
void grub_ext2_init (void);
79
void grub_ext2_fini (void);
80
void grub_ufs_init (void);
81
void grub_ufs_fini (void);
82
void grub_minix_init (void);
83
void grub_minix_fini (void);
84
void grub_hfs_init (void);
85
void grub_hfs_fini (void);
86
void grub_jfs_init (void);
87
void grub_jfs_fini (void);
88
void grub_xfs_init (void);
89
void grub_xfs_fini (void);
90
void grub_affs_init (void);
91
void grub_affs_fini (void);
92
void grub_sfs_init (void);
93
void grub_sfs_fini (void);
94
void grub_iso9660_init (void);
95
#endif /* GRUB_UTIL */
97
#endif /* ! GRUB_FS_HEADER */