Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bsdinstall/partedit/part_wizard.c
Show First 20 Lines • Show All 251 Lines • ▼ Show 20 Lines | sprintf(warning, "The existing partition scheme on this " | ||||
"FreeBSD, it must be repartitioned. This will destroy all " | "FreeBSD, it must be repartitioned. This will destroy all " | ||||
"data on the disk. Are you sure you want to proceed?", | "data on the disk. Are you sure you want to proceed?", | ||||
scheme); | scheme); | ||||
subchoice = dialog_yesno("Non-bootable Disk", warning, 0, 0); | subchoice = dialog_yesno("Non-bootable Disk", warning, 0, 0); | ||||
if (subchoice != 0) | if (subchoice != 0) | ||||
goto query; | goto query; | ||||
gpart_destroy(gpart); | gpart_destroy(gpart); | ||||
gpart_partition(disk, default_scheme()); | scheme = choose_part_type(default_scheme()); | ||||
scheme = default_scheme(); | if (scheme == NULL) | ||||
return NULL; | |||||
gpart_partition(disk, scheme); | |||||
} | } | ||||
marcel: When the user cancels for choose_part_type, he/she is confronted with exactly the same dialog… | |||||
Not Done Inline Actionsreturn NULL from wizard_partition() when the user hits cancel, which will cause part_wizard() to exit with an error allanjude: return NULL from wizard_partition() when the user hits cancel, which will cause part_wizard()… | |||||
if (scheme == NULL || choice == 0) { | if (scheme == NULL || choice == 0) { | ||||
if (gpart != NULL && scheme != NULL) { | if (gpart != NULL && scheme != NULL) { | ||||
/* Erase partitioned disk */ | /* Erase partitioned disk */ | ||||
choice = dialog_yesno("Confirmation", "This will erase " | choice = dialog_yesno("Confirmation", "This will erase " | ||||
"the disk. Are you sure you want to proceed?", 0, 0); | "the disk. Are you sure you want to proceed?", 0, 0); | ||||
if (choice != 0) | if (choice != 0) | ||||
goto query; | goto query; | ||||
gpart_destroy(gpart); | gpart_destroy(gpart); | ||||
} | } | ||||
gpart_partition(disk, default_scheme()); | scheme = choose_part_type(default_scheme()); | ||||
scheme = default_scheme(); | if (scheme == NULL) | ||||
return NULL; | |||||
gpart_partition(disk, scheme); | |||||
} | } | ||||
Done Inline ActionsSame as line 260/261. marcel: Same as line 260/261. | |||||
if (strcmp(scheme, "PC98") == 0 || strcmp(scheme, "MBR") == 0) { | if (strcmp(scheme, "PC98") == 0 || strcmp(scheme, "MBR") == 0) { | ||||
struct gmesh submesh; | struct gmesh submesh; | ||||
geom_gettree(&submesh); | geom_gettree(&submesh); | ||||
gpart_create(provider_for_name(&submesh, disk), | gpart_create(provider_for_name(&submesh, disk), | ||||
"freebsd", NULL, NULL, &retval, | "freebsd", NULL, NULL, &retval, | ||||
choice /* Non-interactive for "Entire Disk" */); | choice /* Non-interactive for "Entire Disk" */); | ||||
geom_deletetree(&submesh); | geom_deletetree(&submesh); | ||||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |
When the user cancels for choose_part_type, he/she is confronted with exactly the same dialog again by virtue of passing NULL to part_partition and that function calling choose_part_type.
I don't know the bigger flow, but maybe call gpart_partition only when scheme != NULL?