blob: dfcf6d8d149d18090ff79d2f64801b327249ab2e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#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 */
sector_t offset; /* disk sector number */
unsigned char *sectorbuffer; /* disk sector contents */
};
extern struct pte ptes[MAXIMUM_PARTS];
#define pt_offset(b, n) ((struct partition *)((b) + 0x1be + \
(n) * sizeof(struct partition)))
extern sector_t extended_offset;
/* A valid partition table sector ends in 0x55 0xaa */
static inline unsigned int part_table_flag(unsigned char *b)
{
return ((unsigned int) b[510]) + (((unsigned int) b[511]) << 8);
}
static inline sector_t get_partition_start(struct pte *pe)
{
return pe->offset + get_start_sect(pe->part_table);
}
static inline int is_cleared_partition(struct partition *p)
{
return !(!p || p->boot_ind || p->head || p->sector || p->cyl ||
p->sys_ind || p->end_head || p->end_sector || p->end_cyl ||
get_start_sect(p) || get_nr_sects(p));
}
extern void dos_print_mbr_id(struct fdisk_context *cxt);
extern void dos_set_mbr_id(struct fdisk_context *cxt);
extern void dos_init(struct fdisk_context *cxt);
extern int dos_list_table(struct fdisk_context *cxt, int xtra);
extern void dos_list_table_expert(struct fdisk_context *cxt, int extend);
extern void dos_fix_partition_table_order(struct fdisk_context *cxt);
extern void dos_move_begin(struct fdisk_context *cxt, int i);
extern void dos_toggle_active(struct fdisk_context *cxt, int i);
extern int mbr_is_valid_magic(unsigned char *b);
extern void change_units(struct fdisk_context *cxt);
extern void update_units(struct fdisk_context *cxt); /* called from sunlabel too */
#define is_dos_compatible(_x) \
(fdisk_is_disklabel(_x, DOS) && \
fdisk_dos_is_compatible(fdisk_context_get_label(_x, NULL)))
#endif
|