From ecf40cda764496d3d1b29435ea64a65335ae0acf Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 15 Oct 2014 12:17:40 +0200 Subject: libfdisk: make it possible to use zero for size and start The zero may be valid size and start of the partition. This patch introduces: fdisk_partition_has_start() fdisk_partition_has_size() fdisk_partition_unset_size() fdisk_partition_unset_start() to make it possible to work with zero. The feature is internally implemented by magic constant ((type) -1) for undefined sizes and offsets. Signed-off-by: Karel Zak --- disk-utils/fdisk-list.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'disk-utils/fdisk-list.c') diff --git a/disk-utils/fdisk-list.c b/disk-utils/fdisk-list.c index 46d50a7f3..d0d752ef6 100644 --- a/disk-utils/fdisk-list.c +++ b/disk-utils/fdisk-list.c @@ -171,6 +171,8 @@ void list_disklabel(struct fdisk_context *cxt) /* print warnings */ while (itr && fdisk_table_next_partition(tb, itr, &pa) == 0) { + if (!fdisk_partition_has_start(pa)) + continue; if (!fdisk_lba_is_phy_aligned(cxt, fdisk_partition_get_start(pa))) fdisk_warnx(cxt, _("Partition %zu does not start on physical sector boundary."), fdisk_partition_get_partno(pa) + 1); -- cgit v1.2.3-55-g7522