From a2f6293fd245bd17fea42cddc69bc93d3c1def32 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Thu, 27 Aug 2009 09:13:22 +0200 Subject: [PATCH] installer: Enable writing to the disk label area prior to wiping it. While here, move the few lines of fn_create_subpartitions() to flow.c. Suggested-by: dillon Reported-by: Dragonfly-bug: --- usr.sbin/installer/dfuibe_installer/flow.c | 26 +++++++++++++++- usr.sbin/installer/dfuibe_installer/fn.h | 1 - .../dfuibe_installer/fn_subpart_ufs.c | 31 ------------------- 3 files changed, 25 insertions(+), 33 deletions(-) diff --git a/usr.sbin/installer/dfuibe_installer/flow.c b/usr.sbin/installer/dfuibe_installer/flow.c index 19f61394ab..96320f7ae9 100644 --- a/usr.sbin/installer/dfuibe_installer/flow.c +++ b/usr.sbin/installer/dfuibe_installer/flow.c @@ -1187,6 +1187,7 @@ void state_create_subpartitions(struct i_fn_args *a) { char msg_buf[1][1024]; + struct commands *cmds; if (measure_activated_swap_from_slice(a, storage_get_selected_disk(a->s), storage_get_selected_slice(a->s)) > 0) { @@ -1215,7 +1216,30 @@ state_create_subpartitions(struct i_fn_args *a) } } - fn_create_subpartitions(a); + cmds = commands_new(); + + /* + * Auto-disklabel the slice. + * NB: one cannot use "/dev/adXsY" here - + * it must be in the form "adXsY". + */ + command_add(cmds, "%s%s -W %s", + a->os_root, cmd_name(a, "DISKLABEL64"), + slice_get_raw_device_name(storage_get_selected_slice(a->s))); + command_add(cmds, "%s%s if=/dev/zero of=/dev/%s bs=32k count=16", + a->os_root, cmd_name(a, "DD"), + slice_get_raw_device_name(storage_get_selected_slice(a->s))); + command_add(cmds, "%s%s -B -r -w %s auto", + a->os_root, cmd_name(a, "DISKLABEL64"), + slice_get_raw_device_name(storage_get_selected_slice(a->s))); + commands_execute(a, cmds); + commands_free(cmds); + + if (use_hammer) + fn_create_subpartitions_hammer(a); + else + fn_create_subpartitions_ufs(a); + if (a->result) { state = state_install_os; } else { diff --git a/usr.sbin/installer/dfuibe_installer/fn.h b/usr.sbin/installer/dfuibe_installer/fn.h index 08800af629..8ec1b380df 100644 --- a/usr.sbin/installer/dfuibe_installer/fn.h +++ b/usr.sbin/installer/dfuibe_installer/fn.h @@ -99,7 +99,6 @@ void fn_create_memtest86_floppy(struct i_fn_args *); int format_slice(struct i_fn_args *); -void fn_create_subpartitions(struct i_fn_args *); void fn_create_subpartitions_ufs(struct i_fn_args *); void fn_create_subpartitions_hammer(struct i_fn_args *); void fn_install_os(struct i_fn_args *); diff --git a/usr.sbin/installer/dfuibe_installer/fn_subpart_ufs.c b/usr.sbin/installer/dfuibe_installer/fn_subpart_ufs.c index a6082bb277..719cf62ae3 100644 --- a/usr.sbin/installer/dfuibe_installer/fn_subpart_ufs.c +++ b/usr.sbin/installer/dfuibe_installer/fn_subpart_ufs.c @@ -712,37 +712,6 @@ show_create_subpartitions_form(struct dfui_form *f, struct i_fn_args *a) } } -/* - * fn_create_subpartitions: let the user specify what subpartitions they - * want on the disk, how large each should be, and where it should be mounted. - */ -void -fn_create_subpartitions(struct i_fn_args *a) -{ - struct commands *cmds; - - cmds = commands_new(); - - /* - * Auto-disklabel the slice. - * NB: one cannot use "/dev/adXsY" here - - * it must be in the form "adXsY". - */ - command_add(cmds, "%s%s if=/dev/zero of=/dev/%s bs=32k count=16", - a->os_root, cmd_name(a, "DD"), - slice_get_raw_device_name(storage_get_selected_slice(a->s))); - command_add(cmds, "%s%s -B -r -w %s auto", - a->os_root, cmd_name(a, "DISKLABEL64"), - slice_get_raw_device_name(storage_get_selected_slice(a->s))); - commands_execute(a, cmds); - commands_free(cmds); - - if (use_hammer) - fn_create_subpartitions_hammer(a); - else - fn_create_subpartitions_ufs(a); -} - void fn_create_subpartitions_ufs(struct i_fn_args *a) { -- 2.41.0