summaryrefslogtreecommitdiffstats
path: root/disk-utils/fdisk.h
blob: 11f529d48ae0c10bc67587922c9ef1f1b279427f (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
66
67
68
69
70
71
72
/*
   fdisk.h
*/

#define SECTOR_SIZE	512
#define MAXIMUM_PARTS	60

#define SIZE(a)	(sizeof(a)/sizeof((a)[0]))

#define cround(n)	(((n) + display_factor * unit_flag) / display_factor)

#if defined(__GNUC__) || defined(HAS_LONG_LONG)
typedef long long ext2_loff_t;
#else
typedef long      ext2_loff_t;
#endif

extern ext2_loff_t ext2_llseek(unsigned int fd,
			       ext2_loff_t offset,
			       unsigned int origin);

struct partition {
	unsigned char boot_ind;         /* 0x80 - active */
	unsigned char head;             /* starting head */
	unsigned char sector;           /* starting sector */
	unsigned char cyl;              /* starting cylinder */
	unsigned char sys_ind;          /* What partition type */
	unsigned char end_head;         /* end head */
	unsigned char end_sector;       /* end sector */
	unsigned char end_cyl;          /* end cylinder */
	unsigned char start4[4];        /* starting sector counting from 0 */
	unsigned char size4[4];         /* nr of sectors in partition */
};

enum failure {usage, unable_to_open, unable_to_read, unable_to_seek,
	unable_to_write, out_of_memory};

enum offset {ignore, lower, deflt, upper};

enum action {fdisk, require, try_only, create_empty};

struct systypes {
  unsigned char index;
  char *name;
};

/* prototypes for fdisk.c */
extern char *disk_device,
            *line_ptr;
extern int fd,
           partitions;
extern uint unit_flag,
            display_factor;
extern struct partition *part_table[];
extern void fatal(enum failure why);
extern int get_boot(enum action what);
extern int  get_partition(int warn, int max);
extern void list_types(struct systypes *sys);
extern int read_line (void);
extern char read_char(char *mesg);
extern int read_hex(struct systypes *sys);
uint read_int(uint low, uint dflt, uint high, enum offset base, char *mesg);
extern char *const str_units(void);

extern unsigned int get_start_sect(struct partition *p);
extern unsigned int get_nr_sects(struct partition *p);

/* prototypes for fdisklabel.c */
extern void bselect(void);
extern int btrydev (char * dev);

/* prototypes for fdisksunlabel.c */