]>
Commit | Line | Data |
---|---|---|
726f69e2 KZ |
1 | /* |
2 | fdisk.h | |
3 | */ | |
4 | ||
5c36a0eb KZ |
5 | #define DEFAULT_SECTOR_SIZE 512 |
6 | #define MAX_SECTOR_SIZE 2048 | |
7 | #define SECTOR_SIZE 512 /* still used in BSD code */ | |
2b6fc908 KZ |
8 | #define MAXIMUM_PARTS 60 |
9 | ||
5c36a0eb KZ |
10 | #define ACTIVE_FLAG 0x80 |
11 | ||
12 | #define EXTENDED 0x05 | |
13 | #define WIN98_EXTENDED 0x0f | |
14 | #define LINUX_PARTITION 0x81 | |
15 | #define LINUX_SWAP 0x82 | |
16 | #define LINUX_NATIVE 0x83 | |
17 | #define LINUX_EXTENDED 0x85 | |
18 | ||
19 | #define IS_EXTENDED(i) \ | |
20 | ((i) == EXTENDED || (i) == WIN98_EXTENDED || (i) == LINUX_EXTENDED) | |
21 | ||
2b6fc908 KZ |
22 | #define SIZE(a) (sizeof(a)/sizeof((a)[0])) |
23 | ||
726f69e2 KZ |
24 | #define cround(n) (((n) + display_factor * unit_flag) / display_factor) |
25 | ||
26 | #if defined(__GNUC__) || defined(HAS_LONG_LONG) | |
27 | typedef long long ext2_loff_t; | |
28 | #else | |
29 | typedef long ext2_loff_t; | |
30 | #endif | |
31 | ||
32 | extern ext2_loff_t ext2_llseek(unsigned int fd, | |
33 | ext2_loff_t offset, | |
34 | unsigned int origin); | |
35 | ||
2b6fc908 KZ |
36 | struct partition { |
37 | unsigned char boot_ind; /* 0x80 - active */ | |
38 | unsigned char head; /* starting head */ | |
39 | unsigned char sector; /* starting sector */ | |
40 | unsigned char cyl; /* starting cylinder */ | |
41 | unsigned char sys_ind; /* What partition type */ | |
42 | unsigned char end_head; /* end head */ | |
43 | unsigned char end_sector; /* end sector */ | |
44 | unsigned char end_cyl; /* end cylinder */ | |
45 | unsigned char start4[4]; /* starting sector counting from 0 */ | |
46 | unsigned char size4[4]; /* nr of sectors in partition */ | |
47 | }; | |
48 | ||
726f69e2 | 49 | enum failure {usage, unable_to_open, unable_to_read, unable_to_seek, |
5c36a0eb | 50 | unable_to_write, out_of_memory, no_partition, no_device}; |
726f69e2 | 51 | |
2b6fc908 KZ |
52 | enum action {fdisk, require, try_only, create_empty}; |
53 | ||
726f69e2 KZ |
54 | struct systypes { |
55 | unsigned char index; | |
56 | char *name; | |
57 | }; | |
58 | ||
59 | /* prototypes for fdisk.c */ | |
60 | extern char *disk_device, | |
61 | *line_ptr; | |
62 | extern int fd, | |
63 | partitions; | |
64 | extern uint unit_flag, | |
65 | display_factor; | |
66 | extern struct partition *part_table[]; | |
67 | extern void fatal(enum failure why); | |
2b6fc908 | 68 | extern int get_boot(enum action what); |
726f69e2 | 69 | extern int get_partition(int warn, int max); |
2b6fc908 | 70 | extern void list_types(struct systypes *sys); |
726f69e2 KZ |
71 | extern int read_line (void); |
72 | extern char read_char(char *mesg); | |
2b6fc908 | 73 | extern int read_hex(struct systypes *sys); |
5c36a0eb | 74 | uint read_int(uint low, uint dflt, uint high, uint base, char *mesg); |
726f69e2 KZ |
75 | extern char *const str_units(void); |
76 | ||
2b6fc908 KZ |
77 | extern unsigned int get_start_sect(struct partition *p); |
78 | extern unsigned int get_nr_sects(struct partition *p); | |
79 | ||
5c36a0eb | 80 | /* prototypes for fdiskbsdlabel.c */ |
726f69e2 | 81 | extern void bselect(void); |
2b6fc908 KZ |
82 | extern int btrydev (char * dev); |
83 | ||
5c36a0eb KZ |
84 | /* prototypes for fdisksgilabel.c */ |
85 | extern int valid_part_table_flag(unsigned char *b); |