installer: Enable writing to the disk label area prior to wiping it.
authorSascha Wildner <saw@online.de>
Thu, 27 Aug 2009 07:13:22 +0000 (09:13 +0200)
committerSascha Wildner <saw@online.de>
Thu, 27 Aug 2009 07:13:22 +0000 (09:13 +0200)
While here, move the few lines of fn_create_subpartitions() to flow.c.

Suggested-by: dillon
Reported-by: <elekktretterr@exemail.com.au>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1461>

usr.sbin/installer/dfuibe_installer/flow.c
usr.sbin/installer/dfuibe_installer/fn.h
usr.sbin/installer/dfuibe_installer/fn_subpart_ufs.c

index 19f6139..96320f7 100644 (file)
@@ -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 {
index 08800af..8ec1b38 100644 (file)
@@ -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 *);
index a6082bb..719cf62 100644 (file)
@@ -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)
 {