diff options
author | Davidlohr Bueso | 2012-05-06 14:10:18 +0200 |
---|---|---|
committer | Karel Zak | 2012-05-10 11:34:43 +0200 |
commit | 9dea2923c861a74c28864c083b2b5b785ac18ac0 (patch) | |
tree | 43c4c155722aa2297913d547aabdb717ed3f62b9 /fdisk/fdisk.h | |
parent | fdisk: remove unused hsc2sector macro (diff) | |
download | kernel-qcow2-util-linux-9dea2923c861a74c28864c083b2b5b785ac18ac0.tar.gz kernel-qcow2-util-linux-9dea2923c861a74c28864c083b2b5b785ac18ac0.tar.xz kernel-qcow2-util-linux-9dea2923c861a74c28864c083b2b5b785ac18ac0.zip |
fdisk: move DOS new/add partition code
Since this is DOS specific logic, it belongs in its own label file.
Additionally, a dos_new_partition() function is created that asks the user for
partition type and then calls the actual dos_add_partition().
This patch passed fdisk regression tests, builds without problems and it was
locally tested against adding and removing DOS partitions.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Diffstat (limited to 'fdisk/fdisk.h')
-rw-r--r-- | fdisk/fdisk.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/fdisk/fdisk.h b/fdisk/fdisk.h index 3a1cfd7c0..0dafbf8ac 100644 --- a/fdisk/fdisk.h +++ b/fdisk/fdisk.h @@ -20,6 +20,12 @@ #define LINUX_LVM 0x8e #define LINUX_RAID 0xfd +#define ALIGN_UP 1 +#define ALIGN_DOWN 2 +#define ALIGN_NEAREST 3 + +#define LINE_LENGTH 800 + #define IS_EXTENDED(i) \ ((i) == EXTENDED || (i) == WIN98_EXTENDED || (i) == LINUX_EXTENDED) @@ -78,7 +84,7 @@ extern void print_menu(enum menutype); extern void print_partition_size(int num, unsigned long long start, unsigned long long stop, int sysid); extern void zeroize_mbr_buffer(void); - +extern void fill_bounds(unsigned long long *first, unsigned long long *last); extern unsigned int heads, cylinders, sector_size; extern unsigned long long sectors; extern char *partition_type(unsigned char type); @@ -89,6 +95,10 @@ extern void set_all_unchanged(void); extern int warn_geometry(void); extern void warn_limits(void); extern void warn_alignment(void); +extern unsigned int read_int_with_suffix(unsigned int low, unsigned int dflt, unsigned int high, + unsigned int base, char *mesg, int *is_suffix_used); +extern unsigned long long align_lba(unsigned long long lba, int direction); +extern int get_partition_dflt(int warn, int max, int dflt); #define PLURAL 0 #define SINGULAR 1 @@ -114,7 +124,8 @@ extern enum labeltype disklabel; */ extern unsigned char *MBRbuffer; extern int MBRbuffer_changed; - +extern unsigned long long total_number_of_sectors; +extern unsigned long grain; /* start_sect and nr_sects are stored little endian on all machines */ /* moreover, they are not aligned correctly */ static inline void @@ -168,6 +179,13 @@ static inline unsigned long long get_start_sect(struct partition *p) return read4_little_endian(p->start4); } +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)); +} + /* prototypes for fdiskbsdlabel.c */ extern void bsd_command_prompt(void); extern int check_osf_label(void); |