installer: More /dev/serno work.
authorSascha Wildner <saw@online.de>
Mon, 14 Sep 2009 21:25:06 +0000 (23:25 +0200)
committerSascha Wildner <saw@online.de>
Mon, 14 Sep 2009 21:25:46 +0000 (23:25 +0200)
Take back the devtab(5) support in the installer.

mountroot didn't work for the UFS with serial numbers case since the
data for '/' is taken from fstab and that would have a devtab label
in it and we're not setting vfs.root.mountfrom explicitly for UFS.
We don't want to, either.

So just use /dev/serno/* nodes (which will work everywhere) always.

Suggested-by: dillon
usr.sbin/installer/dfuibe_installer/fn_install.c
usr.sbin/installer/libinstaller/diskutil.c
usr.sbin/installer/libinstaller/diskutil.h

index 0b2536b..3293bc7 100644 (file)
@@ -122,7 +122,6 @@ handle_pfs(struct i_fn_args *a, struct commands *cmds)
 void
 fn_install_os(struct i_fn_args *a)
 {
-       struct disk *d;
        struct subpartition *sp;
        struct commands *cmds;
        struct command *cmd;
@@ -530,13 +529,6 @@ fn_install_os(struct i_fn_args *a)
        command_add(cmds, "%s%s %smnt/mnt",
            a->os_root, cmd_name(a, "MKDIR"), a->os_root);
 
-       /* Write devtab entries if a serial number is available. */
-       for (d = storage_disk_first(a->s); d != NULL; d = disk_next(d))
-               if (disk_get_serno(d) != NULL)
-                       command_add(cmds, "%s%s 'disk%d\t\tserno\t\t%s' >>%smnt/etc/devtab",
-                           a->os_root, cmd_name(a, "ECHO"),
-                           disk_get_number(d), disk_get_serno(d), a->os_root);
-
        /* Write new fstab. */
        command_add(cmds, "%s%s '%s' >%smnt/etc/fstab",
            a->os_root, cmd_name(a, "ECHO"),
@@ -546,15 +538,15 @@ fn_install_os(struct i_fn_args *a)
        for (sp = slice_subpartition_first(storage_get_selected_slice(a->s));
             sp != NULL; sp = subpartition_next(sp)) {
                if (strcmp(subpartition_get_mountpoint(sp), "swap") == 0) {
-                       command_add(cmds, "%s%s '%s\t\tnone\t\tswap\tsw\t\t0\t0' >>%smnt/etc/fstab",
+                       command_add(cmds, "%s%s '/dev/%s\t\tnone\t\tswap\tsw\t\t0\t0' >>%smnt/etc/fstab",
                            a->os_root, cmd_name(a, "ECHO"),
-                           subpartition_get_devtab_name(sp),
+                           subpartition_get_device_name(sp),
                            a->os_root);
                } else if (use_hammer == 0) {
                        if (strcmp(subpartition_get_mountpoint(sp), "/") == 0) {
-                               command_add(cmds, "%s%s '%s\t\t%s\t\tufs\trw\t\t1\t1' >>%smnt/etc/fstab",
+                               command_add(cmds, "%s%s '/dev/%s\t\t%s\t\tufs\trw\t\t1\t1' >>%smnt/etc/fstab",
                                    a->os_root, cmd_name(a, "ECHO"),
-                                   subpartition_get_devtab_name(sp),
+                                   subpartition_get_device_name(sp),
                                    subpartition_get_mountpoint(sp),
                                    a->os_root);
                        } else if (subpartition_is_mfsbacked(sp)) {
@@ -566,17 +558,17 @@ fn_install_os(struct i_fn_args *a)
                                        subpartition_get_fsize(sp),
                                        a->os_root);
                        } else {
-                               command_add(cmds, "%s%s '%s\t\t%s\t\tufs\trw\t\t2\t2' >>%smnt/etc/fstab",
+                               command_add(cmds, "%s%s '/dev/%s\t\t%s\t\tufs\trw\t\t2\t2' >>%smnt/etc/fstab",
                                    a->os_root, cmd_name(a, "ECHO"),
-                                   subpartition_get_devtab_name(sp),
+                                   subpartition_get_device_name(sp),
                                    subpartition_get_mountpoint(sp),
                                    a->os_root);
                        }
                } else {
                        if (strcmp(subpartition_get_mountpoint(sp), "/") == 0) {
-                               command_add(cmds, "%s%s '%s\t\t%s\t\thammer\trw\t\t1\t1' >>%smnt/etc/fstab",
+                               command_add(cmds, "%s%s '/dev/%s\t\t%s\t\thammer\trw\t\t1\t1' >>%smnt/etc/fstab",
                                    a->os_root, cmd_name(a, "ECHO"),
-                                   subpartition_get_devtab_name(sp),
+                                   subpartition_get_device_name(sp),
                                    subpartition_get_mountpoint(sp),
                                    a->os_root);
                                command_add(cmds, "%s%s 'vfs.root.mountfrom=\"hammer:%s\"' >>%smnt/boot/loader.conf",
@@ -584,9 +576,9 @@ fn_install_os(struct i_fn_args *a)
                                    subpartition_get_device_name(sp),
                                    a->os_root);
                        } else if (strcmp(subpartition_get_mountpoint(sp), "/boot") == 0) {
-                               command_add(cmds, "%s%s '%s\t\t%s\t\tufs\trw\t\t1\t1' >>%smnt/etc/fstab",
+                               command_add(cmds, "%s%s '/dev/%s\t\t%s\t\tufs\trw\t\t1\t1' >>%smnt/etc/fstab",
                                    a->os_root, cmd_name(a, "ECHO"),
-                                   subpartition_get_devtab_name(sp),
+                                   subpartition_get_device_name(sp),
                                    subpartition_get_mountpoint(sp),
                                    a->os_root);
                        }
index 71e4917..7158e30 100644 (file)
@@ -759,25 +759,6 @@ subpartition_get_device_name(const struct subpartition *sp)
        return(tmp_dev_name);
 }
 
-/*
- * Returns the devtab conversion label used to represent the subpartition.
- * Note that the storage used for the returned string is static,
- * and the string is overwritten each time this function is called.
- */
-const char *
-subpartition_get_devtab_name(const struct subpartition *sp)
-{
-       static char tmp_dev_name[256];
-
-       if (sp->parent->parent->serno != NULL)
-               snprintf(tmp_dev_name, 256, "disk%d.s%d%c",
-                   sp->parent->parent->number, sp->parent->number, sp->letter);
-       else
-               snprintf(tmp_dev_name, 256, "/dev/%ss%d%c",
-                   sp->parent->parent->device, sp->parent->number, sp->letter);
-       return(tmp_dev_name);
-}
-
 const char *
 subpartition_get_mountpoint(const struct subpartition *sp)
 {
index 3257be5..acb7aca 100644 (file)
@@ -169,7 +169,6 @@ struct subpartition *subpartition_next(const struct subpartition *);
 int                     subpartition_get_pfs(const struct subpartition *);
 const char             *subpartition_get_mountpoint(const struct subpartition *);
 const char             *subpartition_get_device_name(const struct subpartition *);
-const char             *subpartition_get_devtab_name(const struct subpartition *);
 char                    subpartition_get_letter(const struct subpartition *);
 unsigned long           subpartition_get_fsize(const struct subpartition *);
 unsigned long           subpartition_get_bsize(const struct subpartition *);