2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2002,2007 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef GRUB_FILE_HEADER
20 #define GRUB_FILE_HEADER 1
22 #include <grub/types.h>
24 #include <grub/device.h>
27 /* File description. */
30 /* The underlying device. */
33 /* The underlying filesystem. */
36 /* The current offset. */
42 /* Filesystem-specific data. */
45 /* This is called when a sector is read. Used only for a disk device. */
46 void NESTED_FUNC_ATTR (*read_hook
) (grub_disk_addr_t sector
,
47 unsigned offset
, unsigned length
);
49 typedef struct grub_file
*grub_file_t
;
51 /* Get a device name from NAME. */
52 char *EXPORT_FUNC(grub_file_get_device_name
) (const char *name
);
54 grub_file_t
EXPORT_FUNC(grub_file_open
) (const char *name
);
55 grub_ssize_t
EXPORT_FUNC(grub_file_read
) (grub_file_t file
, char *buf
,
57 grub_off_t
EXPORT_FUNC(grub_file_seek
) (grub_file_t file
, grub_off_t offset
);
58 grub_err_t
EXPORT_FUNC(grub_file_close
) (grub_file_t file
);
60 static inline grub_off_t
61 grub_file_size (const grub_file_t file
)
66 static inline grub_off_t
67 grub_file_tell (const grub_file_t file
)
72 #endif /* ! GRUB_FILE_HEADER */