2
* GRUB -- GRand Unified Bootloader
3
* Copyright (C) 2002 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 2 of the License, or
8
* (at your option) any later version.
10
* This program 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, write to the Free Software
17
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
#ifndef GRUB_FILE_HEADER
21
#define GRUB_FILE_HEADER 1
23
#include <grub/types.h>
25
#include <grub/device.h>
28
/* File description. */
31
/* The underlying device. */
34
/* The underlying filesystem. */
37
/* The current offset. */
43
/* Filesystem-specific data. */
46
/* This is called when a sector is read. Used only for a disk device. */
47
void (*read_hook) (unsigned long sector, 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_ssize_t EXPORT_FUNC(grub_file_seek) (grub_file_t file,
59
grub_err_t EXPORT_FUNC(grub_file_close) (grub_file_t file);
61
static inline grub_ssize_t
62
grub_file_size (const grub_file_t file)
67
static inline grub_ssize_t
68
grub_file_tell (const grub_file_t file)
73
#endif /* ! GRUB_FILE_HEADER */