2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 1999,2000,2001,2002,2004,2006,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_PART_HEADER
20 #define GRUB_PART_HEADER 1
26 typedef struct grub_partition
*grub_partition_t
;
28 /* Partition map type. */
29 struct grub_partition_map
31 /* The name of the partition map type. */
34 /* Call HOOK with each partition, until HOOK returns non-zero. */
35 grub_err_t (*iterate
) (struct grub_disk
*disk
,
36 int (*hook
) (struct grub_disk
*disk
,
37 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. */
55 grub_disk_addr_t start
;
57 /* The length in sector units. */
60 /* The offset of the partition table. */
61 grub_disk_addr_t offset
;
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_msdos_partition_map_init (void);
88 void grub_msdos_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 void grub_gpt_partition_map_init (void);
96 void grub_gpt_partition_map_fini (void);
97 void grub_apple_partition_map_init (void);
98 void grub_apple_partition_map_fini (void);
101 static inline grub_disk_addr_t
102 grub_partition_get_start (const grub_partition_t p
)
107 static inline grub_uint64_t
108 grub_partition_get_len (const grub_partition_t p
)
113 #endif /* ! GRUB_PART_HEADER */