unsigned int partno_follow_default : 1, /* use default partno */
start_follow_default : 1, /* use default start */
end_follow_default : 1, /* use default end */
+ 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 */
extern int fdisk_partition_set_end(struct fdisk_partition *pa, uint64_t off);
extern uint64_t fdisk_partition_get_end(struct fdisk_partition *pa);
extern int fdisk_partition_set_size(struct fdisk_partition *pa, uint64_t size);
+extern int fdisk_partition_size_explicit(struct fdisk_partition *pa, int enable);
extern uint64_t fdisk_partition_get_size(struct fdisk_partition *pa);
extern int fdisk_partition_set_partno(struct fdisk_partition *pa, size_t n);
return pa->end_follow_default;
}
+/**
+ * fdisk_partition_size_explicit:
+ * @pa: partition
+ * @enable: 0|1
+ *
+ * By default libfdisk aligns the size when add the new partition (by
+ * fdisk_add_partrition()). If you want to disable this functionality use
+ * @enable = 1.
+ *
+ * Returns: 0 on success, <0 on error.
+ */
+int fdisk_partition_size_explicit(struct fdisk_partition *pa, int enable)
+{
+ if (!pa)
+ return -EINVAL;
+ pa->size_explicit = enable ? 1 : 0;
+ return 0;
+}
+
const char *fdisk_partition_get_uuid(struct fdisk_partition *pa)
{
return pa ? pa->uuid : NULL;
*pa = NULL;
} else
fdisk_reset_partition(*pa);
- }
+ } else
+ (*pa)->size_explicit = 1;
return rc;
}