diff options
author | Karel Zak | 2014-10-15 12:17:40 +0200 |
---|---|---|
committer | Karel Zak | 2014-10-15 12:17:40 +0200 |
commit | ecf40cda764496d3d1b29435ea64a65335ae0acf (patch) | |
tree | 9ef1d00a3906fd495194b88ca5023c9729353df0 /libfdisk/src/script.c | |
parent | tests: check for wipefs and helpers in fdisk tests (diff) | |
download | kernel-qcow2-util-linux-ecf40cda764496d3d1b29435ea64a65335ae0acf.tar.gz kernel-qcow2-util-linux-ecf40cda764496d3d1b29435ea64a65335ae0acf.tar.xz kernel-qcow2-util-linux-ecf40cda764496d3d1b29435ea64a65335ae0acf.zip |
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 <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/script.c')
-rw-r--r-- | libfdisk/src/script.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c index d6b47a696..97b5e4d26 100644 --- a/libfdisk/src/script.c +++ b/libfdisk/src/script.c @@ -398,9 +398,9 @@ int fdisk_script_write_file(struct fdisk_script *dp, FILE *f) else fprintf(f, "%zu :", pa->partno + 1); - if (pa->start) + if (fdisk_partition_has_start(pa)) fprintf(f, " start=%12ju", pa->start); - if (pa->size) + if (fdisk_partition_has_size(pa)) fprintf(f, ", size=%12ju", pa->size); if (pa->type && fdisk_parttype_get_string(pa->type)) @@ -420,7 +420,7 @@ int fdisk_script_write_file(struct fdisk_script *dp, FILE *f) if (!lb || fdisk_label_get_type(lb) != FDISK_DISKLABEL_DOS) fprintf(f, ", attrs=\"%s\"", pa->attrs); } - if (pa->boot) + if (fdisk_partition_is_bootable(pa)) fprintf(f, ", bootable"); fputc('\n', f); } |