~darkmuggle-deactivatedaccount/ubuntu/quantal/grub2/fix-872244

« back to all changes in this revision

Viewing changes to include/grub/partition.h

  • Committer: Bazaar Package Importer
  • Author(s): Otavio Salvador
  • Date: 2006-01-05 15:20:40 UTC
  • mto: (17.3.1 squeeze) (1.9.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20060105152040-b72i5pq1a82z22yi
Tags: upstream-1.92
ImportĀ upstreamĀ versionĀ 1.92

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  GRUB  --  GRand Unified Bootloader
 
3
 *  Copyright (C) 1999,2000,2001,2002,2004  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_PART_HEADER
 
21
#define GRUB_PART_HEADER        1
 
22
 
 
23
#include <grub/dl.h>
 
24
 
 
25
struct grub_disk;
 
26
 
 
27
typedef struct grub_partition *grub_partition_t;
 
28
 
 
29
/* Partition map type.  */
 
30
struct grub_partition_map
 
31
{
 
32
  /* The name of the partition map type.  */
 
33
  const char *name;
 
34
  
 
35
  /* Call HOOK with each partition, until HOOK returns non-zero.  */
 
36
  grub_err_t (*iterate) (struct grub_disk *disk,
 
37
                         int (*hook) (struct grub_disk *disk, const grub_partition_t partition));
 
38
  
 
39
  /* Return the partition named STR on the disk DISK.  */
 
40
  grub_partition_t (*probe) (struct grub_disk *disk,
 
41
                             const char *str);
 
42
  
 
43
  /* Return the name of the partition PARTITION.  */
 
44
  char *(*get_name) (const grub_partition_t partition);
 
45
  
 
46
  /* The next partition map type.  */
 
47
  struct grub_partition_map *next;
 
48
};
 
49
typedef struct grub_partition_map *grub_partition_map_t;
 
50
 
 
51
/* Partition description.  */
 
52
struct grub_partition
 
53
{
 
54
  /* The start sector.  */
 
55
  unsigned long start;
 
56
 
 
57
  /* The length in sector units.  */
 
58
  unsigned long len;
 
59
 
 
60
  /* The offset of the partition table.  */
 
61
  unsigned long offset;
 
62
 
 
63
  /* The index of this partition in the partition table.  */
 
64
  int index;
 
65
  
 
66
  /* Partition map type specific data.  */
 
67
  void *data;
 
68
  
 
69
  /* The type partition map.  */
 
70
  grub_partition_map_t partmap;
 
71
};
 
72
 
 
73
grub_partition_t EXPORT_FUNC(grub_partition_probe) (struct grub_disk *disk,
 
74
                                                    const char *str);
 
75
int EXPORT_FUNC(grub_partition_iterate) (struct grub_disk *disk,
 
76
                                         int (*hook) (struct grub_disk *disk,
 
77
                                                      const grub_partition_t partition));
 
78
char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition);
 
79
 
 
80
int EXPORT_FUNC(grub_partition_map_iterate) (int (*hook) (const grub_partition_map_t partmap));
 
81
                                              
 
82
void EXPORT_FUNC(grub_partition_map_register) (grub_partition_map_t partmap);
 
83
 
 
84
void EXPORT_FUNC(grub_partition_map_unregister) (grub_partition_map_t partmap);
 
85
 
 
86
#ifdef GRUB_UTIL
 
87
void grub_pc_partition_map_init (void);
 
88
void grub_pc_partition_map_fini (void);
 
89
void grub_amiga_partition_map_init (void);
 
90
void grub_amiga_partition_map_fini (void);
 
91
void grub_apple_partition_map_init (void);
 
92
void grub_apple_partition_map_fini (void);
 
93
void grub_sun_partition_map_init (void);
 
94
void grub_sun_partition_map_fini (void);
 
95
#endif
 
96
 
 
97
static inline unsigned long
 
98
grub_partition_get_start (const grub_partition_t p)
 
99
{
 
100
  return p->start;
 
101
}
 
102
 
 
103
static inline unsigned long
 
104
grub_partition_get_len (const grub_partition_t p)
 
105
{
 
106
  return p->len;
 
107
}
 
108
 
 
109
#endif /* ! GRUB_PART_HEADER */