resize: add function find_partitions

find_partitions can find partitions of given type.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
resize: add function calculate_target_partitions

And introduce parameter create_surplus to indicate whether to
create surplus partition or not. Later this parameter will be
used by when calculating positions for target logical partitions.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
resize: Fix whitespace in calculate_target_partitions function.

This updates commit 21677c5b46468609d393a724ea629d948c87aec7.
resize: add function mbr_part_type

Function mbr_part_type returns one of "primary", "extended" and
"logical". The type is used by parted when adding partitions.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
resize: Simplify if-conditional in mbr_part_type function.

This should be equivalent to the previous code, but it makes it easier
for the compiler to pick up errors (eg. missing cases).

This updates commit fc34e2d16c2d13d6ae7a381ba931e345ab5ae56d.