diff options
author | Karel Zak | 2013-12-16 13:59:48 +0100 |
---|---|---|
committer | Karel Zak | 2014-03-11 11:35:12 +0100 |
commit | 187de51c8a1b334b58b9062c25255bee3e1a30c7 (patch) | |
tree | 8c6630fb5eda65a2d279b92e640144e31b9519a4 /libfdisk/src/label.c | |
parent | libfdisk: add table container (diff) | |
download | kernel-qcow2-util-linux-187de51c8a1b334b58b9062c25255bee3e1a30c7.tar.gz kernel-qcow2-util-linux-187de51c8a1b334b58b9062c25255bee3e1a30c7.tar.xz kernel-qcow2-util-linux-187de51c8a1b334b58b9062c25255bee3e1a30c7.zip |
libfdisk: move partition stuff to partition.c
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/label.c')
-rw-r--r-- | libfdisk/src/label.c | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/libfdisk/src/label.c b/libfdisk/src/label.c index db9c40204..99571232c 100644 --- a/libfdisk/src/label.c +++ b/libfdisk/src/label.c @@ -188,53 +188,7 @@ int fdisk_verify_disklabel(struct fdisk_context *cxt) return cxt->label->op->verify(cxt); } -/** - * fdisk_get_partition: - * @cxt: - * @partno: - * @pa: pointer to partition struct - * - * Fills in @pa with data about partition @n. - * - * Returns: 0 on success, otherwise, a corresponding error. - */ -int fdisk_get_partition(struct fdisk_context *cxt, size_t partno, - struct fdisk_partition **pa) -{ - int rc; - - if (!cxt || !cxt->label || !pa) - return -EINVAL; - if (!cxt->label->op->get_part) - return -ENOSYS; - - if (!*pa) { - *pa = fdisk_new_partition(); - if (!*pa) - return -ENOMEM; - } else - fdisk_reset_partition(*pa); - (*pa)->cxt = cxt; - (*pa)->partno = partno; - - rc = cxt->label->op->get_part(cxt, partno, *pa); - if (rc == 0 && fdisk_partition_is_used(*pa)) - DBG(LABEL, dbgprint("get partition %zu", partno)); - return rc; -} -/* - * This is faster than fdisk_get_partition() + fdisk_partition_is_used() - */ -int fdisk_is_partition_used(struct fdisk_context *cxt, size_t n) -{ - if (!cxt || !cxt->label) - return -EINVAL; - if (!cxt->label->op->part_is_used) - return -ENOSYS; - - return cxt->label->op->part_is_used(cxt, n); -} /** * fdisk_list_disklabel: @@ -416,56 +370,7 @@ done: return rc; } -/** - * fdisk_add_partition: - * @cxt: fdisk context - * @pa: template for the partition - * - * If @pa is not specified or any @pa item is missiong the libfdisk will ask by - * fdisk_ask_ API. - * - * Creates a new partition. - * - * Returns 0. - */ -int fdisk_add_partition(struct fdisk_context *cxt, - struct fdisk_partition *pa) -{ - assert(cxt); - assert(cxt->label); - - if (!cxt || !cxt->label) - return -EINVAL; - if (!cxt->label->op->add_part) - return -ENOSYS; - if (fdisk_missing_geometry(cxt)) - return -EINVAL; - - DBG(LABEL, dbgprint("adding new partition")); - cxt->label->op->add_part(cxt, pa); - return 0; -} -/** - * fdisk_delete_partition: - * @cxt: fdisk context - * @partnum: partition number to delete - * - * Deletes a @partnum partition. - * - * Returns 0 on success, otherwise, a corresponding error. - */ -int fdisk_delete_partition(struct fdisk_context *cxt, size_t partnum) -{ - if (!cxt || !cxt->label) - return -EINVAL; - if (!cxt->label->op->part_delete) - return -ENOSYS; - - DBG(LABEL, dbgprint("deleting %s partition number %zd", - cxt->label->name, partnum)); - return cxt->label->op->part_delete(cxt, partnum); -} /** * fdisk_create_disklabel: |