2012-04-29 00:02:45 +02:00
|
|
|
#ifndef FDISK_DOS_LABEL_H
|
|
|
|
#define FDISK_DOS_LABEL_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* per partition table entry data
|
|
|
|
*
|
|
|
|
* The four primary partitions have the same sectorbuffer (MBRbuffer)
|
|
|
|
* and have NULL ext_pointer.
|
|
|
|
* Each logical partition table entry has two pointers, one for the
|
|
|
|
* partition and one link to the next one.
|
|
|
|
*/
|
|
|
|
struct pte {
|
|
|
|
struct partition *part_table; /* points into sectorbuffer */
|
|
|
|
struct partition *ext_pointer; /* points into sectorbuffer */
|
|
|
|
char changed; /* boolean */
|
2012-05-27 21:44:17 +02:00
|
|
|
sector_t offset; /* disk sector number */
|
2012-04-29 00:02:45 +02:00
|
|
|
unsigned char *sectorbuffer; /* disk sector contents */
|
2012-05-02 14:05:51 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct pte ptes[MAXIMUM_PARTS];
|
2012-04-29 00:02:45 +02:00
|
|
|
|
|
|
|
#define pt_offset(b, n) ((struct partition *)((b) + 0x1be + \
|
|
|
|
(n) * sizeof(struct partition)))
|
|
|
|
|
2012-05-02 14:05:51 +02:00
|
|
|
extern int ext_index; /* the prime extended partition */
|
2012-12-03 15:32:16 +01:00
|
|
|
extern sector_t extended_offset;
|
2012-04-29 00:02:45 +02:00
|
|
|
|
|
|
|
/* A valid partition table sector ends in 0x55 0xaa */
|
2012-05-02 14:05:51 +02:00
|
|
|
static inline unsigned int part_table_flag(unsigned char *b)
|
2012-04-29 00:02:45 +02:00
|
|
|
{
|
|
|
|
return ((unsigned int) b[510]) + (((unsigned int) b[511]) << 8);
|
|
|
|
}
|
|
|
|
|
2012-05-27 21:44:17 +02:00
|
|
|
static inline sector_t get_partition_start(struct pte *pe)
|
2012-04-29 00:02:45 +02:00
|
|
|
{
|
|
|
|
return pe->offset + get_start_sect(pe->part_table);
|
|
|
|
}
|
|
|
|
|
2012-06-17 18:10:07 +02:00
|
|
|
extern void dos_print_mbr_id(struct fdisk_context *cxt);
|
|
|
|
extern void dos_set_mbr_id(struct fdisk_context *cxt);
|
2012-06-03 20:15:17 +02:00
|
|
|
extern void dos_init(struct fdisk_context *cxt);
|
2012-04-29 00:02:45 +02:00
|
|
|
|
2013-01-21 12:01:44 +01:00
|
|
|
extern int dos_list_table(struct fdisk_context *cxt, int xtra);
|
|
|
|
|
2013-01-21 12:06:17 +01:00
|
|
|
extern void dos_fix_partition_table_order(void);
|
2013-01-21 12:11:43 +01:00
|
|
|
extern void dos_move_begin(struct fdisk_context *cxt, int i);
|
2013-01-21 12:06:17 +01:00
|
|
|
|
2012-07-23 14:07:35 +02:00
|
|
|
extern int mbr_is_valid_magic(unsigned char *b);
|
|
|
|
|
2012-12-03 16:22:17 +01:00
|
|
|
extern void change_units(struct fdisk_context *cxt);
|
|
|
|
extern void update_units(struct fdisk_context *cxt); /* called from sunlabel too */
|
|
|
|
|
2012-12-11 15:08:06 +01:00
|
|
|
#define is_dos_compatible(_x) \
|
|
|
|
(fdisk_is_disklabel(_x, DOS) && \
|
|
|
|
fdisk_dos_is_compatible(fdisk_context_get_label(_x, NULL)))
|
|
|
|
|
2012-04-29 00:02:45 +02:00
|
|
|
#endif
|