1 /* partition.h - Partition table handling
3 * Copyright 1992-1998 Werner Almesberger
4 * Copyright 1999-2004 John Coffman
5 * Copyright 2009-2015 Joachim Wiedorn
8 * Licensed under the terms contained in the file 'COPYING'
9 * in the source directory.
16 #include <linux/unistd.h>
18 typedef struct _change_rule {
22 struct _change_rule *next;
25 enum {PTW_OKAY=0, PTW_DOS=1, PTW_OS2=2, PTW_SWAP, PTW_XFS,
26 PTW_mask=7, PTW_NTFS=8};
29 #define LLSECTORSIZE ((int64_t)SECTOR_SIZE)
31 #if __GLIBC__ < 2 || __GLIBC_MINOR__ < 1
32 typedef int64_t lloff_t;
35 lloff_t lseek64(unsigned int fd, lloff_t offs, unsigned int whence);
40 unsigned char boot_ind; /* 0x80 - active */
41 unsigned char head; /* starting head */
42 unsigned char sector; /* starting sector */
43 unsigned char cyl; /* starting cylinder */
44 unsigned char sys_ind; /* What partition type */
45 unsigned char end_head; /* end head */
46 unsigned char end_sector; /* end sector */
47 unsigned char end_cyl; /* end cylinder */
48 unsigned int start_sect; /* starting sector counting from 0 */
49 unsigned int nr_sects; /* nr of sectors in partition */
53 int part_nowrite(char* device);
54 /* identify partitions which would be destroyed if the boot block
57 known problems occur for:
60 DOS FAT (relocation will fix)
63 #define is_extd_part(x) ((x)==PART_DOS_EXTD||(x)==PART_WIN_EXTD_LBA||(x)==PART_LINUX_EXTD)
65 void part_verify(int dev_nr,int type);
66 /* Verify the partition table of the disk of which dev_nr is a partition. May
67 also try to "fix" a partition table. Fail on non-Linux partitions if the
68 TYPE flag is non-zero (unless IGNORE-TABLE is set too). */
70 void do_cr_auto(void);
71 /* do automatic change-rules */
73 void preload_types(void);
74 /* Preload some partition types for convenience */
76 void do_activate(char *where, char *which);
77 /* Activate the specified partition */
79 void do_install_mbr(char *where, char *what);
80 /* Install a new MBR (Master Boot Record) */
82 int read_partitions(char *part, int max, int *volid,
83 struct partition *p, int64_t *where);
84 /* read all partitions & partition tables */