diff options
author | Karel Zak | 2018-01-11 15:18:00 +0100 |
---|---|---|
committer | Karel Zak | 2018-01-11 15:18:00 +0100 |
commit | 9c76f85f9a9de1117bf6d89e8df7bdc664e25fa0 (patch) | |
tree | 901d65bc2042264f368f3a9c0e0c2a15d0c394a4 /libfdisk | |
parent | libfdisk: (sun) fix n-1 bug and whole-disk (diff) | |
download | kernel-qcow2-util-linux-9c76f85f9a9de1117bf6d89e8df7bdc664e25fa0.tar.gz kernel-qcow2-util-linux-9c76f85f9a9de1117bf6d89e8df7bdc664e25fa0.tar.xz kernel-qcow2-util-linux-9c76f85f9a9de1117bf6d89e8df7bdc664e25fa0.zip |
libfdisk: allow to start freespace for zero
This is necessary for disk labels like SUN where whole disk is possible
to address by partitions.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk')
-rw-r--r-- | libfdisk/src/context.c | 2 | ||||
-rw-r--r-- | libfdisk/src/sun.c | 5 | ||||
-rw-r--r-- | libfdisk/src/table.c | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/libfdisk/src/context.c b/libfdisk/src/context.c index 95d17acde..ee9c40ea6 100644 --- a/libfdisk/src/context.c +++ b/libfdisk/src/context.c @@ -301,6 +301,8 @@ int __fdisk_switch_label(struct fdisk_context *cxt, struct fdisk_label *lb) } cxt->label = lb; DBG(CXT, ul_debugobj(cxt, "--> switching context to %s!", lb->name)); + + fdisk_apply_label_device_properties(cxt); return 0; } diff --git a/libfdisk/src/sun.c b/libfdisk/src/sun.c index a247dbcf5..7257081f3 100644 --- a/libfdisk/src/sun.c +++ b/libfdisk/src/sun.c @@ -507,6 +507,8 @@ static int sun_add_partition( size_t i; unsigned int first, last; + DBG(LABEL, ul_debug("SUN adding partition")); + rc = fdisk_partition_next_partno(pa, cxt, &n); if (rc) return rc; @@ -704,6 +706,8 @@ static int sun_add_partition( if (whole_disk) sys = SUN_TAG_WHOLEDISK; + DBG(LABEL, ul_debug("SUN new partition #%zu: first=%u, last=%u, sys=%d", n, first, last, sys)); + set_partition(cxt, n, first, last, sys); cxt->label->nparts_cur = count_used_partitions(cxt); if (partno) @@ -1088,6 +1092,7 @@ static int sun_set_partition( static int sun_reset_alignment(struct fdisk_context *cxt __attribute__((__unused__))) { + fdisk_set_first_lba(cxt, 0); return 0; } diff --git a/libfdisk/src/table.c b/libfdisk/src/table.c index c5ad382ca..4881db68e 100644 --- a/libfdisk/src/table.c +++ b/libfdisk/src/table.c @@ -411,7 +411,7 @@ static int new_freespace(struct fdisk_context *cxt, if (start == end) return 0; - assert(start); + assert(start >= cxt->first_lba); assert(end); assert(end > start); |