]> git.ipfire.org Git - thirdparty/util-linux.git/blame - fdisk/fdisk.h
Imported from util-linux-2.9v tarball.
[thirdparty/util-linux.git] / fdisk / fdisk.h
CommitLineData
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
7eda085c
KZ
24#define cround(n) (display_in_cyl_units ? ((n)/units_per_sector)+1 : (n))
25#define scround(x) (((x)+units_per_sector-1)/units_per_sector)
726f69e2
KZ
26
27#if defined(__GNUC__) || defined(HAS_LONG_LONG)
28typedef long long ext2_loff_t;
29#else
30typedef long ext2_loff_t;
31#endif
32
33extern ext2_loff_t ext2_llseek(unsigned int fd,
34 ext2_loff_t offset,
35 unsigned int origin);
36
2b6fc908
KZ
37struct partition {
38 unsigned char boot_ind; /* 0x80 - active */
39 unsigned char head; /* starting head */
40 unsigned char sector; /* starting sector */
41 unsigned char cyl; /* starting cylinder */
42 unsigned char sys_ind; /* What partition type */
43 unsigned char end_head; /* end head */
44 unsigned char end_sector; /* end sector */
45 unsigned char end_cyl; /* end cylinder */
46 unsigned char start4[4]; /* starting sector counting from 0 */
47 unsigned char size4[4]; /* nr of sectors in partition */
48};
49
7eda085c
KZ
50enum failure {usage, usage2, ioctl_error,
51 unable_to_open, unable_to_read, unable_to_seek,
5c36a0eb 52 unable_to_write, out_of_memory, no_partition, no_device};
726f69e2 53
2b6fc908
KZ
54enum action {fdisk, require, try_only, create_empty};
55
726f69e2
KZ
56/* prototypes for fdisk.c */
57extern char *disk_device,
58 *line_ptr;
59extern int fd,
60 partitions;
7eda085c
KZ
61extern uint display_in_cyl_units,
62 units_per_sector;
726f69e2
KZ
63extern struct partition *part_table[];
64extern void fatal(enum failure why);
2b6fc908 65extern int get_boot(enum action what);
726f69e2 66extern int get_partition(int warn, int max);
2b6fc908 67extern void list_types(struct systypes *sys);
726f69e2
KZ
68extern int read_line (void);
69extern char read_char(char *mesg);
2b6fc908 70extern int read_hex(struct systypes *sys);
5c36a0eb 71uint read_int(uint low, uint dflt, uint high, uint base, char *mesg);
7eda085c
KZ
72
73#define PLURAL 0
74#define SINGULAR 1
75extern char *const str_units(int);
726f69e2 76
2b6fc908
KZ
77extern unsigned int get_start_sect(struct partition *p);
78extern unsigned int get_nr_sects(struct partition *p);
79
5c36a0eb 80/* prototypes for fdiskbsdlabel.c */
726f69e2 81extern void bselect(void);
2b6fc908
KZ
82extern int btrydev (char * dev);
83
5c36a0eb
KZ
84/* prototypes for fdisksgilabel.c */
85extern int valid_part_table_flag(unsigned char *b);