2
* GRUB -- GRand Unified Bootloader
3
* Copyright (C) 1999,2000,2001,2002,2004 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_PART_HEADER
21
#define GRUB_PART_HEADER 1
27
typedef struct grub_partition *grub_partition_t;
29
/* Partition map type. */
30
struct grub_partition_map
32
/* The name of the partition map type. */
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));
39
/* Return the partition named STR on the disk DISK. */
40
grub_partition_t (*probe) (struct grub_disk *disk,
43
/* Return the name of the partition PARTITION. */
44
char *(*get_name) (const grub_partition_t partition);
46
/* The next partition map type. */
47
struct grub_partition_map *next;
49
typedef struct grub_partition_map *grub_partition_map_t;
51
/* Partition description. */
54
/* The start sector. */
57
/* The length in sector units. */
60
/* The offset of the partition table. */
63
/* The index of this partition in the partition table. */
66
/* Partition map type specific data. */
69
/* The type partition map. */
70
grub_partition_map_t partmap;
73
grub_partition_t EXPORT_FUNC(grub_partition_probe) (struct grub_disk *disk,
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);
80
int EXPORT_FUNC(grub_partition_map_iterate) (int (*hook) (const grub_partition_map_t partmap));
82
void EXPORT_FUNC(grub_partition_map_register) (grub_partition_map_t partmap);
84
void EXPORT_FUNC(grub_partition_map_unregister) (grub_partition_map_t partmap);
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);
97
static inline unsigned long
98
grub_partition_get_start (const grub_partition_t p)
103
static inline unsigned long
104
grub_partition_get_len (const grub_partition_t p)
109
#endif /* ! GRUB_PART_HEADER */