summaryrefslogtreecommitdiffstats
path: root/fdisks/fdiskdoslabel.c
diff options
context:
space:
mode:
authorKarel Zak2013-06-25 16:14:23 +0200
committerKarel Zak2013-09-16 16:47:04 +0200
commitbb58112e74fdbce1fe0170776e7695abd8d9200c (patch)
tree5d6f723d59c6b817060547eba33def9e750f8256 /fdisks/fdiskdoslabel.c
parentfdisk: cleanup header file (diff)
downloadkernel-qcow2-util-linux-bb58112e74fdbce1fe0170776e7695abd8d9200c.tar.gz
kernel-qcow2-util-linux-bb58112e74fdbce1fe0170776e7695abd8d9200c.tar.xz
kernel-qcow2-util-linux-bb58112e74fdbce1fe0170776e7695abd8d9200c.zip
fdisk: (dos) remove unnecessary header file stuff
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks/fdiskdoslabel.c')
-rw-r--r--fdisks/fdiskdoslabel.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/fdisks/fdiskdoslabel.c b/fdisks/fdiskdoslabel.c
index 67199eaea..37d27e2c9 100644
--- a/fdisks/fdiskdoslabel.c
+++ b/fdisks/fdiskdoslabel.c
@@ -10,9 +10,20 @@
#include "nls.h"
#include "randutils.h"
#include "common.h"
+#include "pt-mbr.h"
+
#include "fdisk.h"
#include "fdiskdoslabel.h"
+#define MAXIMUM_PARTS 60
+
+#define ACTIVE_FLAG 0x80
+
+#define IS_EXTENDED(i) \
+ ((i) == MBR_DOS_EXTENDED_PARTITION \
+ || (i) == MBR_W95_EXTENDED_PARTITION \
+ || (i) == MBR_LINUX_EXTENDED_PARTITION)
+
/*
* per partition table entry data
*
@@ -742,7 +753,7 @@ static int add_partition(struct fdisk_context *cxt, int n, struct fdisk_parttype
first[cxt->label->nparts_max],
last[cxt->label->nparts_max];
- sys = t ? t->type : LINUX_NATIVE;
+ sys = t ? t->type : MBR_LINUX_DATA_PARTITION;
if (p && p->sys_ind) {
fdisk_warnx(cxt, _("Partition %d is already defined. Delete "
@@ -908,10 +919,11 @@ static int add_partition(struct fdisk_context *cxt, int n, struct fdisk_parttype
set_partition(cxt, n, 0, start, stop, sys);
if (n > 4) {
struct pte *pe = self_pte(cxt, n);
- set_partition(cxt, n - 1, 1, pe->offset, stop, EXTENDED);
+ set_partition(cxt, n - 1, 1, pe->offset, stop,
+ MBR_DOS_EXTENDED_PARTITION);
}
- if (IS_EXTENDED (sys)) {
+ if (IS_EXTENDED(sys)) {
struct pte *pe4 = self_pte(cxt, 4);
struct pte *pen = self_pte(cxt, n);
@@ -1079,7 +1091,7 @@ static int dos_verify_disklabel(struct fdisk_context *cxt)
struct pte *pe = self_pte(cxt, i);
p = self_partition(cxt, i);
- if (p->sys_ind && !IS_EXTENDED (p->sys_ind)) {
+ if (p->sys_ind && !IS_EXTENDED(p->sys_ind)) {
check_consistency(cxt, p, i);
fdisk_warn_alignment(cxt, get_abs_partition_start(pe), i);
if (get_abs_partition_start(pe) < first[i])
@@ -1193,7 +1205,7 @@ static int dos_add_partition(
rc = add_partition(cxt, j, t);
} else {
char buf[16];
- char c, prompt[LINE_LENGTH];
+ char c, prompt[BUFSIZ];
int dflt;
dflt = (free_primary == 1 && !l->ext_offset) ? 'e' : 'p';
@@ -1228,7 +1240,8 @@ static int dos_add_partition(
} else if (c == 'e' && !l->ext_offset) {
int j = get_partition_unused_primary(cxt);
if (j >= 0) {
- t = fdisk_get_parttype_from_code(cxt, EXTENDED);
+ t = fdisk_get_parttype_from_code(cxt,
+ MBR_DOS_EXTENDED_PARTITION);
rc = add_partition(cxt, j, t);
}
goto done;