Forgot tar.c
[grub2/jjazz.git] / include / grub / fs.h
blob46c74925cfa804b9376d704b67314ed65d4f51f9
1 /* fs.h - filesystem manager */
2 /*
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2002,2003,2004,2007,2008 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 3 of the License, or
9 * (at your option) any later version.
11 * GRUB 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, see <http://www.gnu.org/licenses/>.
20 #ifndef GRUB_FS_HEADER
21 #define GRUB_FS_HEADER 1
23 #include <grub/device.h>
24 #include <grub/symbol.h>
25 #include <grub/types.h>
27 /* Forward declaration is required, because of mutual reference. */
28 struct grub_file;
30 /* Filesystem descriptor. */
31 struct grub_fs
33 /* My name. */
34 const char *name;
36 /* Call HOOK with each file under DIR. */
37 grub_err_t (*dir) (grub_device_t device, const char *path,
38 int (*hook) (const char *filename, int dir));
40 /* Open a file named NAME and initialize FILE. */
41 grub_err_t (*open) (struct grub_file *file, const char *name);
43 /* Read LEN bytes data from FILE into BUF. */
44 grub_ssize_t (*read) (struct grub_file *file, char *buf, grub_size_t len);
46 /* Close the file FILE. */
47 grub_err_t (*close) (struct grub_file *file);
49 /* Return the label of the device DEVICE in LABEL. The label is
50 returned in a grub_malloc'ed buffer and should be freed by the
51 caller. */
52 grub_err_t (*label) (grub_device_t device, char **label);
54 /* Return the uuid of the device DEVICE in UUID. The uuid is
55 returned in a grub_malloc'ed buffer and should be freed by the
56 caller. */
57 grub_err_t (*uuid) (grub_device_t device, char **uuid);
59 /* The next filesystem. */
60 struct grub_fs *next;
62 typedef struct grub_fs *grub_fs_t;
64 /* This is special, because block lists are not files in usual sense. */
65 extern struct grub_fs grub_fs_blocklist;
67 /* This hook is used to automatically load filesystem modules.
68 If this hook loads a module, return non-zero. Otherwise return zero.
69 The newly loaded filesystem is assumed to be inserted into the head of
70 the linked list GRUB_FS_LIST through the function grub_fs_register. */
71 typedef int (*grub_fs_autoload_hook_t) (void);
72 extern grub_fs_autoload_hook_t EXPORT_VAR(grub_fs_autoload_hook);
74 void EXPORT_FUNC(grub_fs_register) (grub_fs_t fs);
75 void EXPORT_FUNC(grub_fs_unregister) (grub_fs_t fs);
76 void EXPORT_FUNC(grub_fs_iterate) (int (*hook) (const grub_fs_t fs));
77 grub_fs_t EXPORT_FUNC(grub_fs_probe) (grub_device_t device);
79 #endif /* ! GRUB_FS_HEADER */