summaryrefslogtreecommitdiffstats
path: root/fdisks/fdisk.c
diff options
context:
space:
mode:
authorDavidlohr Bueso2012-07-24 09:34:22 +0200
committerKarel Zak2012-07-24 09:34:22 +0200
commit0f639e54dfca37879545fc2e0efa8a509ca87b72 (patch)
tree85ee1ca1237c6ef790ce222db0ecf1a148ab9882 /fdisks/fdisk.c
parentfdisk: API: add write to label operations (diff)
downloadkernel-qcow2-util-linux-0f639e54dfca37879545fc2e0efa8a509ca87b72.tar.gz
kernel-qcow2-util-linux-0f639e54dfca37879545fc2e0efa8a509ca87b72.tar.xz
kernel-qcow2-util-linux-0f639e54dfca37879545fc2e0efa8a509ca87b72.zip
fdisk: API: add new partition to label operations
Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Diffstat (limited to 'fdisks/fdisk.c')
-rw-r--r--fdisks/fdisk.c38
1 files changed, 9 insertions, 29 deletions
diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c
index f25f2aec0..355e313cb 100644
--- a/fdisks/fdisk.c
+++ b/fdisks/fdisk.c
@@ -1385,39 +1385,19 @@ void print_partition_size(struct fdisk_context *cxt,
static void new_partition(struct fdisk_context *cxt)
{
- if (warn_geometry(cxt))
- return;
-
- if (disklabel == SUN_LABEL) {
- add_sun_partition(cxt, get_partition(cxt, 0, partitions), LINUX_NATIVE);
- return;
- }
+ int partnum = 0;
- if (disklabel == SGI_LABEL) {
- sgi_add_partition(cxt, get_partition(cxt, 0, partitions), LINUX_NATIVE);
- return;
- }
-
- if (disklabel == AIX_LABEL) {
- printf(_("\tSorry - this fdisk cannot handle AIX disk labels."
- "\n\tIf you want to add DOS-type partitions, create"
- "\n\ta new empty DOS partition table first. (Use o.)"
- "\n\tWARNING: "
- "This will destroy the present disk contents.\n"));
+ if (warn_geometry(cxt))
return;
- }
- if (disklabel == MAC_LABEL) {
- printf(_("\tSorry - this fdisk cannot handle Mac disk labels."
- "\n\tIf you want to add DOS-type partitions, create"
- "\n\ta new empty DOS partition table first. (Use o.)"
- "\n\tWARNING: "
- "This will destroy the present disk contents.\n"));
- return;
- }
+ if (disklabel == SUN_LABEL || disklabel == SGI_LABEL)
+ partnum = get_partition(cxt, 0, partitions);
- /* default to DOS/BSD */
- dos_new_partition(cxt);
+ /*
+ * Use default LINUX_NATIVE partition type, DOS labels
+ * may override this internally.
+ */
+ fdisk_add_partition(cxt, partnum, LINUX_NATIVE);
}
static void write_table(struct fdisk_context *cxt)