summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/fdiskP.h
diff options
context:
space:
mode:
authorKarel Zak2014-10-15 12:17:40 +0200
committerKarel Zak2014-10-15 12:17:40 +0200
commitecf40cda764496d3d1b29435ea64a65335ae0acf (patch)
tree9ef1d00a3906fd495194b88ca5023c9729353df0 /libfdisk/src/fdiskP.h
parenttests: check for wipefs and helpers in fdisk tests (diff)
downloadkernel-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/fdiskP.h')
-rw-r--r--libfdisk/src/fdiskP.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/libfdisk/src/fdiskP.h b/libfdisk/src/fdiskP.h
index 253c515f8..7822466a2 100644
--- a/libfdisk/src/fdiskP.h
+++ b/libfdisk/src/fdiskP.h
@@ -113,6 +113,7 @@ enum {
struct fdisk_partition {
int refcount; /* reference counter */
+
size_t partno; /* partition number */
size_t parent_partno; /* for logical partitions */
@@ -136,24 +137,23 @@ struct fdisk_partition {
uint64_t bsize;
uint64_t cpg;
- char *start_addr; /* start C/H/S in string */
- char *end_addr; /* end C/H/S in string */
+ char *start_chs; /* start C/H/S in string */
+ char *end_chs; /* end C/H/S in string */
- int boot; /* MBR only: 1 = yes, 0 = no, -1 undefined */
+ unsigned int boot; /* MBR: bootable */
- unsigned int partno_follow_default : 1, /* use default partno */
- start_follow_default : 1, /* use default start */
+ unsigned int container : 1, /* container partition (e.g. extended partition) */
end_follow_default : 1, /* use default end */
+ freespace : 1, /* this is free space */
+ partno_follow_default : 1, /* use default partno */
size_explicit : 1, /* don't align the size */
- freespace : 1, /* this is free space */
- container : 1, /* container partition (e.g. extended partition) */
- wholedisk : 1, /* special system partition */
- used : 1; /* partition already used */
+ start_follow_default : 1, /* use default start */
+ used : 1, /* partition already used */
+ wholedisk : 1; /* special system partition */
};
-#define FDISK_EMPTY_PARTNO ((size_t) -1)
-#define FDISK_EMPTY_PARTITION { .partno = FDISK_EMPTY_PARTNO }
-#define FDISK_EMPTY_BOOTFLAG (-1)
+#define FDISK_INIT_UNDEF(_x) ((_x) = (__typeof__(_x)) -1)
+#define FDISK_IS_UNDEF(_x) ((_x) == (__typeof__(_x)) -1)
struct fdisk_table {
struct list_head parts; /* partitions */