~ubuntu-branches/debian/sid/grub2/sid-200907171837

« back to all changes in this revision

Viewing changes to include/grub/file.h

  • Committer: Bazaar Package Importer
  • Author(s): Otavio Salvador
  • Date: 2006-01-05 15:20:40 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060105152040-1ab076d4n3y2o5yf
Tags: 1.92-1
* New upstream release.
  - Add support for GPT partition table format.
  - Add a new command "play" to play an audio file on PC.
  - Add support for Linux/ADFS partition table format.
  - Add support for BASH-like scripting.
  - Add support for Apple HFS+ filesystems.
* 01_fix_grub-install.patch: Added. Fix grub-install to use
  /bin/grub-mkimage instead of /sbin/grub-mkimage. Closes: #338824
* Do not use CDBS tarball mode anymore. Closes: #344272  

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  GRUB  --  GRand Unified Bootloader
 
3
 *  Copyright (C) 2002  Free Software Foundation, Inc.
 
4
 *
 
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.
 
9
 *
 
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.
 
14
 *
 
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.
 
18
 */
 
19
 
 
20
#ifndef GRUB_FILE_HEADER
 
21
#define GRUB_FILE_HEADER        1
 
22
 
 
23
#include <grub/types.h>
 
24
#include <grub/err.h>
 
25
#include <grub/device.h>
 
26
#include <grub/fs.h>
 
27
 
 
28
/* File description.  */
 
29
struct grub_file
 
30
{
 
31
  /* The underlying device.  */
 
32
  grub_device_t device;
 
33
 
 
34
  /* The underlying filesystem.  */
 
35
  grub_fs_t fs;
 
36
 
 
37
  /* The current offset.  */
 
38
  grub_ssize_t offset;
 
39
 
 
40
  /* The file size.  */
 
41
  grub_ssize_t size;
 
42
 
 
43
  /* Filesystem-specific data.  */
 
44
  void *data;
 
45
 
 
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);
 
48
};
 
49
typedef struct grub_file *grub_file_t;
 
50
 
 
51
/* Get a device name from NAME.  */
 
52
char *EXPORT_FUNC(grub_file_get_device_name) (const char *name);
 
53
 
 
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,
 
56
                                          grub_ssize_t len);
 
57
grub_ssize_t EXPORT_FUNC(grub_file_seek) (grub_file_t file,
 
58
                                          grub_ssize_t offset);
 
59
grub_err_t EXPORT_FUNC(grub_file_close) (grub_file_t file);
 
60
 
 
61
static inline grub_ssize_t
 
62
grub_file_size (const grub_file_t file)
 
63
{
 
64
  return file->size;
 
65
}
 
66
 
 
67
static inline grub_ssize_t
 
68
grub_file_tell (const grub_file_t file)
 
69
{
 
70
  return file->offset;
 
71
}
 
72
 
 
73
#endif /* ! GRUB_FILE_HEADER */