]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: (bsd) support non-nested version too
authorKarel Zak <kzak@redhat.com>
Mon, 11 Mar 2013 14:51:22 +0000 (15:51 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 11 Mar 2013 14:56:05 +0000 (15:56 +0100)
 note that btrydev() should be unnecessary, regular list_table()
should be enough for all types.

Signed-off-by: Karel Zak <kzak@redhat.com>
fdisks/fdisk.c
fdisks/fdiskbsdlabel.c
libfdisk/src/context.c

index 87fb191619cf8f813e8844273fb1b301ac0b12ed..ade91a57c9461bd79a51ed318688cb27bd266341 100644 (file)
@@ -923,16 +923,10 @@ static void print_partition_table_from_option(struct fdisk_context *cxt,
                fdisk_override_geometry(cxt, user_cylinders,
                                        user_heads, user_sectors);
 
-       if (!fdisk_dev_has_disklabel(cxt)) {
-               /*
-                * Try BSD -- TODO: move to list_table() too
-                */
-               list_disk_geometry(cxt);
-               if (!fdisk_is_disklabel(cxt, AIX) &&
-                   !fdisk_is_disklabel(cxt, MAC))
-                       btrydev(cxt);
-       } else
+       if (fdisk_dev_has_disklabel(cxt))
                list_table(cxt, 0);
+       else
+               list_disk_geometry(cxt);
 }
 
 /*
index c507338b016c0f89df12d321e0360476d7e605d8..baee4ef2c8daf90c846107e8172b5f6ae2fb8251 100644 (file)
@@ -126,16 +126,6 @@ osf_probe_label(struct fdisk_context *cxt)
        return 1;
 }
 
-int
-btrydev (struct fdisk_context *cxt)
-{
-       if (xbsd_readlabel (cxt, NULL, &xbsd_dlabel) == 0)
-               return -1;
-       printf(_("\nBSD label for device: %s\n"), cxt->dev_path);
-       xbsd_print_disklabel (cxt, 0);
-       return 0;
-}
-
 #if !defined (__alpha__)
 static int hidden(int type)
 {
@@ -864,6 +854,9 @@ xbsd_link_part (struct fdisk_context *cxt)
        int i;
        struct partition *p;
 
+       if (!cxt->parent)
+               return;         /* not nested PT */
+
        if (fdisk_ask_partnum(cxt->parent, &k, FALSE))
                return;
 
index 139932620b3989e6c7492e2602d42a89e5b01154..814d84c4f2fb8535d800c4829f002278095abe7d 100644 (file)
@@ -21,6 +21,7 @@ struct fdisk_context *fdisk_new_context(void)
        cxt->labels[ cxt->nlabels++ ] = fdisk_new_gpt_label(cxt);
        cxt->labels[ cxt->nlabels++ ] = fdisk_new_dos_label(cxt);
        cxt->labels[ cxt->nlabels++ ] = fdisk_new_aix_label(cxt);
+       cxt->labels[ cxt->nlabels++ ] = fdisk_new_bsd_label(cxt);
        cxt->labels[ cxt->nlabels++ ] = fdisk_new_mac_label(cxt);
        cxt->labels[ cxt->nlabels++ ] = fdisk_new_sgi_label(cxt);
        cxt->labels[ cxt->nlabels++ ] = fdisk_new_sun_label(cxt);