Add HAMMER support to the installer
authorMatthias Schmidt <matthias@dragonflybsd.org>
Tue, 30 Dec 2008 21:52:58 +0000 (22:52 +0100)
committerMatthias Schmidt <matthias@dragonflybsd.org>
Tue, 30 Dec 2008 21:52:58 +0000 (22:52 +0100)
Commit the installer work done at the 25c3 in Berlin.  This adds experimental
HAMMER support to the installer.  Note: the current version requires a recent
master which is able to boot from HAMMER.  I dropped the UFS /boot support
in favour for HAMMER boot support (yes, I know about the issues, but I'm sure
you guys will get them solved :)

Note: This is a first version, so do not blame me if the installer eats up
your hard disk :)

12 files changed:
contrib/bsdinstaller-1.1.6/src/backend/installer/Makefile
contrib/bsdinstaller-1.1.6/src/backend/installer/conf/cmdnames.conf
contrib/bsdinstaller-1.1.6/src/backend/installer/flow.c
contrib/bsdinstaller-1.1.6/src/backend/installer/flow.h
contrib/bsdinstaller-1.1.6/src/backend/installer/fn.h
contrib/bsdinstaller-1.1.6/src/backend/installer/fn_configure.c
contrib/bsdinstaller-1.1.6/src/backend/installer/fn_disk.c
contrib/bsdinstaller-1.1.6/src/backend/installer/fn_install.c
contrib/bsdinstaller-1.1.6/src/backend/installer/fn_subpart.c
contrib/bsdinstaller-1.1.6/src/lib/libinstaller/diskutil.c
contrib/bsdinstaller-1.1.6/src/lib/libinstaller/diskutil.h
usr.sbin/installer/dfuibe_installer/Makefile

index 3755ffb..27f5212 100644 (file)
@@ -3,8 +3,8 @@
 OSTYPE!=sysctl -n kern.ostype
 
 PROG=  dfuibe_installer
-OBJS=  fn_disk.o fn_configure.o fn_diagnostic.o fn_subpart.o fn_install.o \
-       flow.o main.o
+OBJS=  fn_disk.o fn_configure.o fn_diagnostic.o fn_subpart_hammer.o \
+       fn_subpart.o fn_install.o flow.o main.o
 
 WARNS= -W -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
        -Wpointer-arith -Wno-uninitialized -Wreturn-type -Wcast-qual \
index b6107f9..758b317 100644 (file)
@@ -51,11 +51,16 @@ else
 fi
 
 MOUNT=sbin/mount
+MOUNT_HAMMER=sbin/mount_hammer
+MOUNT_NULL=sbin/mount_null
 MOUNT_MFS=sbin/mount_mfs
 UMOUNT=sbin/umount
 SWAPON=sbin/swapon
 DISKLABEL=sbin/disklabel
+DISKLABEL64=sbin/disklabel64
+HAMMER=sbin/hammer
 NEWFS=sbin/newfs
+NEWFS_HAMMER=sbin/newfs_hammer
 NEWFS_MSDOS=sbin/newfs_msdos
 FDISK=sbin/fdisk
 DUMPON=sbin/dumpon
index 6c304eb..0691bb2 100644 (file)
@@ -979,6 +979,37 @@ state_select_disk(struct i_fn_args *a)
        }
 }
 
+void
+state_ask_fs(struct i_fn_args *a)
+{
+       use_hammer = 0;
+
+       switch (dfui_be_present_dialog(a->c, _("Select file system"),
+           _("Use HAMMER|Use UFS|Return to Select Disk"),
+           _("Please select the file system you want to use with %s\n\n"
+             "HAMMER is the new %s file system.  UFS the traditional BSD file system"),
+           OPERATING_SYSTEM_NAME,
+           OPERATING_SYSTEM_NAME))
+       {
+       case 1:
+               /* HAMMER */
+               use_hammer = 1;
+               break;
+       case 2:
+               /* UFS */
+               break;
+       case 3:
+               state = state_select_disk;
+               return;
+               /* NOTREACHED */
+               break;
+       default:
+               abort_backend();
+               break;
+       }
+       state = state_create_subpartitions;
+}
+
 /*
  * state_format_disk: ask the user if they wish to format the disk they
  * selected.
@@ -1018,7 +1049,7 @@ state_format_disk(struct i_fn_args *a)
 
                fn_format_disk(a);
                if (a->result)
-                       state = state_create_subpartitions;
+                       state = state_ask_fs;
                else
                        state = state_format_disk;
                break;
@@ -1113,7 +1144,7 @@ state_select_slice(struct i_fn_args *a)
                        } else {
                                inform(a->c, _("Primary partition #%d was formatted."),
                                    slice_get_number(storage_get_selected_slice(a->s)));
-                               state = state_create_subpartitions;
+                               state = state_ask_fs;
                        }
                } else {
                        inform(a->c, _("Action cancelled - no primary partitions were formatted."));
index 26c4f74..4e7576e 100644 (file)
@@ -40,6 +40,7 @@
 #define __FLOW_H_
 
 #define        DISK_MIN        340
+#define        HAMMER_MIN      50000
 #define INSTALL_USR_LOCAL
 #define INSTALL_USR_X11R6
 
@@ -51,6 +52,7 @@
 #define        MTPT_HOME       5
 
 struct i_fn_args;
+int use_hammer;
 
 /*** PROTOTYPES ***/
 
@@ -73,6 +75,7 @@ void           state_diskutil_menu(struct i_fn_args *);
 void            state_begin_install(struct i_fn_args *);
 void            state_begin_upgrade(struct i_fn_args *);
 void            state_select_disk(struct i_fn_args *);
+void            state_ask_fs(struct i_fn_args *);
 void            state_format_disk(struct i_fn_args *);
 void            state_select_slice(struct i_fn_args *);
 void            state_create_subpartitions(struct i_fn_args *);
index 0f1444c..652a421 100644 (file)
@@ -101,6 +101,8 @@ int          format_slice(struct i_fn_args *);
 int             autopacket(struct disk *);
 
 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 *);
 
 /* Global variables */
index 61ec801..5f6ba5e 100644 (file)
@@ -72,6 +72,7 @@
 #include "libinstaller/uiutil.h"
 
 #include "fn.h"
+#include "flow.h"
 #include "pathnames.h"
 
 static const char      *yes_to_y(const char *);
@@ -1285,11 +1286,19 @@ mount_target_system(struct i_fn_args *a)
        /*
         * Mount the target's / and read its /etc/fstab.
         */
-       command_add(cmds, "%s%s %sdev/%s %s%s",
-           a->os_root, cmd_name(a, "MOUNT"),
-           a->os_root,
-           subpartition_get_device_name(a_subpart),
-           a->os_root, a->cfg_root);
+       if (use_hammer == 0) {
+               command_add(cmds, "%s%s %sdev/%s %s%s",
+                   a->os_root, cmd_name(a, "MOUNT"),
+                   a->os_root,
+                   subpartition_get_device_name(a_subpart),
+                   a->os_root, a->cfg_root);
+       } else {
+               command_add(cmds, "%s%s %sdev/%s %s%s",
+                   a->os_root, cmd_name(a, "MOUNT_HAMMER"),
+                   a->os_root,
+                   subpartition_get_device_name(a_subpart),
+                   a->os_root, a->cfg_root);
+       }
        if (!commands_execute(a, cmds)) {
                commands_free(cmds);
                return(0);
@@ -1369,13 +1378,23 @@ mount_target_system(struct i_fn_args *a)
                                            cvtoptions, a->os_root, a->cfg_root, mtpt);
                                        free(cvtoptions);
                                } else {
-                                       command_add_ensure_dev(a, cmds, device);
-                                       command_add(cmds,
-                                           "%s%s -o %s %s%s %s%s%s",
-                                           a->os_root, cmd_name(a, "MOUNT"),
-                                           options,    /* XXX */
-                                           a->os_root, device, a->os_root,
-                                           a->cfg_root, mtpt);
+                                       if (use_hammer == 0 ||
+                                           (use_hammer == 1 && strcmp(mtpt, "/boot/") == 0)) {
+                                               command_add_ensure_dev(a, cmds, device);
+                                               command_add(cmds,
+                                                   "%s%s -o %s %s%s %s%s%s",
+                                                   a->os_root, cmd_name(a, "MOUNT"),
+                                                   options,    /* XXX */
+                                                   a->os_root, device, a->os_root,
+                                                   a->cfg_root, mtpt);
+                                       } else {
+                                               command_add_ensure_dev(a, cmds, device);
+                                               command_add(cmds,
+                                                   "%s%s %s%s %s%s%s",
+                                                   a->os_root, cmd_name(a, "MOUNT_HAMMER"),
+                                                   a->os_root, device, a->os_root,
+                                                   a->cfg_root, mtpt);
+                                       }
                                }
                        }
                }
index 145de13..f1d06ec 100644 (file)
@@ -676,15 +676,6 @@ format_slice(struct i_fn_args *a)
            disk_get_raw_device_name(storage_get_selected_disk(a->s)));
 
        /*
-        * Auto-disklabel the slice.
-        * NB: one cannot use "/dev/adXsY" here -
-        * it must be in the form "adXsY".
-        */
-       command_add(cmds, "%s%s -B -r -w %s auto",
-           a->os_root, cmd_name(a, "DISKLABEL"),
-           slice_get_raw_device_name(storage_get_selected_slice(a->s)));
-
-       /*
         * If there is an old 'virgin' disklabel hanging around
         * in the temp dir, get rid of it.  This won't happen
         * from a real CD, but might happen with '-o' installs.
index d6949ea..efc3d54 100644 (file)
@@ -66,6 +66,8 @@
 #include "pathnames.h"
 #include "fn.h"
 
+static const char *pfs_mountpt[5] = {"/var", "/tmp", "/usr", "/home", NULL};
+
 /*
  * fn_install_os: actually put DragonFly on a disk.
  */
@@ -75,7 +77,7 @@ fn_install_os(struct i_fn_args *a)
        struct subpartition *sp;
        struct commands *cmds;
        struct command *cmd;
-       int i, seen_it, prefix;
+       int i, seen_it, prefix, j;
        FILE *sources_conf;
        char line[256];
        char cp_src[64][256];
@@ -158,6 +160,21 @@ fn_install_os(struct i_fn_args *a)
         */
        unmount_all_under(a, cmds, "%smnt", a->os_root);
 
+       for (sp = slice_subpartition_first(storage_get_selected_slice(a->s));
+            sp != NULL; sp = subpartition_next(sp)) {
+               if (strcmp(subpartition_get_mountpoint(sp), "/") == 0) {
+                       command_add(cmds, "%s%s -p %smnt%s",
+                           a->os_root, cmd_name(a, "MKDIR"),
+                           a->os_root, subpartition_get_mountpoint(sp));
+                       command_add(cmds, "%s%s %sdev/%s %smnt%s",
+                           a->os_root, cmd_name(a, "MOUNT_HAMMER"),
+                           a->os_root,
+                           subpartition_get_device_name(sp),
+                           a->os_root,
+                           subpartition_get_mountpoint(sp));
+               }
+       }
+
        /*
         * Create mount points and mount subpartitions on them.
         */
@@ -185,11 +202,6 @@ fn_install_os(struct i_fn_args *a)
                        continue;
                }
        
-               if (strcmp(subpartition_get_mountpoint(sp), "/") != 0) {
-                       command_add(cmds, "%s%s -p %smnt%s",
-                           a->os_root, cmd_name(a, "MKDIR"),
-                           a->os_root, subpartition_get_mountpoint(sp));
-               }
 
                /*
                 * Don't mount it if it's MFS-backed.
@@ -198,13 +210,36 @@ fn_install_os(struct i_fn_args *a)
                if (subpartition_is_mfsbacked(sp)) {
                        continue;
                }
+               if (use_hammer == 0 || (strcmp(subpartition_get_mountpoint(sp), "/boot") == 0)) {
+                       command_add(cmds, "%s%s -p %smnt/boot",
+                           a->os_root, cmd_name(a, "MKDIR"),
+                           a->os_root);
+                       command_add(cmds, "%s%s %sdev/%s %smnt%s",
+                           a->os_root, cmd_name(a, "MOUNT"),
+                           a->os_root,
+                           subpartition_get_device_name(sp),
+                           a->os_root,
+                           subpartition_get_mountpoint(sp));
+               }
+       }
 
-               command_add(cmds, "%s%s %sdev/%s %smnt%s",
-                   a->os_root, cmd_name(a, "MOUNT"),
-                   a->os_root,
-                   subpartition_get_device_name(sp),
-                   a->os_root,
-                   subpartition_get_mountpoint(sp));
+       /* Create PFS dir */
+       command_add(cmds, "%s%s -p %smnt/pfs",
+           a->os_root, cmd_name(a, "MKDIR"),
+           a->os_root);
+
+       /* mount null pfs */
+       for (j = 0; pfs_mountpt[j] != NULL; j++) {
+               command_add(cmds, "%s%s pfs-master %smnt/pfs%s",
+                   a->os_root, cmd_name(a, "HAMMER"),
+                   a->os_root, pfs_mountpt[j]);
+               command_add(cmds, "%s%s -p %smnt%s",
+                   a->os_root, cmd_name(a, "MKDIR"),
+                   a->os_root, pfs_mountpt[j]);
+               command_add(cmds, "%s%s %smnt/pfs%s %smnt%s",
+                   a->os_root, cmd_name(a, "MOUNT_NULL"),
+                   a->os_root, pfs_mountpt[j],
+                   a->os_root, pfs_mountpt[j]);
        }
 
        /*
@@ -434,7 +469,7 @@ fn_install_os(struct i_fn_args *a)
                    a->os_root, dest);
                command_set_log_mode(cmd, COMMAND_LOG_QUIET);
        }
-       
+
        /*
         * Rebuild the user database, to get rid of any extra users
         * from the LiveCD that aren't supposed to be installed
@@ -458,32 +493,56 @@ 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), "/") == 0) {
-                       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_device_name(sp),
-                           subpartition_get_mountpoint(sp),
-                           a->os_root);
-               } else if (strcmp(subpartition_get_mountpoint(sp), "swap") == 0) {
+               if (strcmp(subpartition_get_mountpoint(sp), "swap") == 0) {
                        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_device_name(sp),
                            a->os_root);
-               } else if (subpartition_is_mfsbacked(sp)) {
-                        mfsbacked_size = slice_get_capacity(storage_get_selected_slice(a->s)) * 2048;
-                        command_add(cmds, "%s%s 'swap\t\t%s\t\t\tmfs\trw,-s%ld\t\t1\t1' >>%smnt/etc/fstab",
-                                a->os_root, cmd_name(a, "ECHO"),
-                                subpartition_get_mountpoint(sp),
-                                mfsbacked_size,
-                                a->os_root);
+               }
+               if (use_hammer == 0) {
+                       if (strcmp(subpartition_get_mountpoint(sp), "/") == 0) {
+                               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_device_name(sp),
+                                   subpartition_get_mountpoint(sp),
+                                   a->os_root);
+                       } else if (subpartition_is_mfsbacked(sp)) {
+                               mfsbacked_size = slice_get_capacity(storage_get_selected_slice(a->s)) * 2048;
+                               command_add(cmds, "%s%s 'swap\t\t%s\t\t\tmfs\trw,-s%ld\t\t1\t1' >>%smnt/etc/fstab",
+                                       a->os_root, cmd_name(a, "ECHO"),
+                                       subpartition_get_mountpoint(sp),
+                                       mfsbacked_size,
+                                       a->os_root);
+                       } else {
+                               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_device_name(sp),
+                                   subpartition_get_mountpoint(sp),
+                                   a->os_root);
+                       }
                } else {
-                       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_device_name(sp),
-                           subpartition_get_mountpoint(sp),
-                           a->os_root);
+                       if (strcmp(subpartition_get_mountpoint(sp), "/") == 0) {
+                               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_device_name(sp),
+                                   subpartition_get_mountpoint(sp),
+                                   a->os_root);
+                       } else if (strcmp(subpartition_get_mountpoint(sp), "/boot") == 0) {
+                               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_device_name(sp),
+                                   subpartition_get_mountpoint(sp),
+                                   a->os_root);
+                       }
                }
        }
+       for (j = 0; pfs_mountpt[j] != NULL; j++) {
+               command_add(cmds, "%s%s '/pfs%s\t\t%s\t\tnull\trw\t\t0\t0' >>%smnt/etc/fstab",
+                   a->os_root, cmd_name(a, "ECHO"),
+                   pfs_mountpt[j],
+                   pfs_mountpt[j],
+                   a->os_root);
+       }
 
        command_add(cmds, "%s%s '%s' >>%smnt/etc/fstab",
            a->os_root, cmd_name(a, "ECHO"),
@@ -491,12 +550,20 @@ fn_install_os(struct i_fn_args *a)
            a->os_root);
 
        /* Backup the disklabel and the log. */
+       if (use_hammer == 0) {
+               command_add(cmds, "%s%s %s > %smnt/etc/disklabel.%s",
+                   a->os_root, cmd_name(a, "DISKLABEL"),
+                   slice_get_device_name(storage_get_selected_slice(a->s)),
+                   a->os_root,
+                   slice_get_device_name(storage_get_selected_slice(a->s)));
+       } else {
+               command_add(cmds, "%s%s %s > %smnt/etc/disklabel.%s",
+                   a->os_root, cmd_name(a, "DISKLABEL64"),
+                   slice_get_device_name(storage_get_selected_slice(a->s)),
+                   a->os_root,
+                   slice_get_device_name(storage_get_selected_slice(a->s)));
+       }
 
-       command_add(cmds, "%s%s %s > %smnt/etc/disklabel.%s",
-           a->os_root, cmd_name(a, "DISKLABEL"),
-           slice_get_device_name(storage_get_selected_slice(a->s)),
-           a->os_root,
-           slice_get_device_name(storage_get_selected_slice(a->s)));
        command_add(cmds, "%s%s %sinstall.log %smnt/var/log/install.log",
            a->os_root, cmd_name(a, "CP"),
            a->tmp, a->os_root);
@@ -534,9 +601,15 @@ fn_install_os(struct i_fn_args *a)
         * make sure once and for all that the disklabel is bootable.
         */
        if (a->result) {
-               command_add(cmds, "%s%s -B %s",
-                   a->os_root, cmd_name(a, "DISKLABEL"),
-                   slice_get_device_name(storage_get_selected_slice(a->s)));
+               if (use_hammer == 0) {
+                       command_add(cmds, "%s%s -B %s",
+                           a->os_root, cmd_name(a, "DISKLABEL"),
+                           slice_get_device_name(storage_get_selected_slice(a->s)));
+               } else {
+                       command_add(cmds, "%s%s -B %s",
+                           a->os_root, cmd_name(a, "DISKLABEL64"),
+                           slice_get_device_name(storage_get_selected_slice(a->s)));
+               }
        }
 
        if (!commands_execute(a, cmds))
index dad04d4..156ec15 100644 (file)
@@ -76,10 +76,10 @@ static int  warn_subpartition_selections(struct i_fn_args *);
 static struct dfui_form *make_create_subpartitions_form(struct i_fn_args *);
 static int     show_create_subpartitions_form(struct dfui_form *, struct i_fn_args *);
 
-const char *def_mountpt[7]  = {"/", "swap", "/var", "/tmp", "/usr", "/home", NULL};
-long def_capacity[7]        = {128,    128,    128,    128,    256,      -1,    0};
+static const char *def_mountpt[7]  = {"/", "swap", "/var", "/tmp", "/usr", "/home", NULL};
+static long def_capacity[7]        = {128,    128,    128,    128,    256,      -1,    0};
 
-int expert = 0;
+static int expert = 0;
 
 /*
  * Given a set of subpartitions-to-be in the selected slice,
@@ -774,6 +774,35 @@ show_create_subpartitions_form(struct dfui_form *f, struct i_fn_args *a)
 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".
+        */
+       if (use_hammer == 1) {
+               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);
+               fn_create_subpartitions_hammer(a);
+       } else {
+               command_add(cmds, "%s%s -B -r -w %s auto",
+                   a->os_root, cmd_name(a, "DISKLABEL"),
+                   slice_get_raw_device_name(storage_get_selected_slice(a->s)));
+               commands_execute(a, cmds);
+               commands_free(cmds);
+               fn_create_subpartitions_ufs(a);
+       }
+}
+
+void
+fn_create_subpartitions_ufs(struct i_fn_args *a)
+{
        struct dfui_form *f;
        int done = 0;
 
index 01b64e9..cfd11ef 100644 (file)
@@ -541,6 +541,61 @@ slices_free(struct slice *head)
        }
 }
 
+struct subpartition *
+subpartition_new_hammer(struct slice *s, const char *mountpoint, long capacity)
+{
+       struct subpartition *sp;
+
+       AURA_MALLOC(sp, subpartition);
+
+       sp->parent = s;
+
+       struct subpartition *last = s->subpartition_tail;
+       if (last == NULL) {
+               sp->letter = 'a';
+       } else if (last->letter == 'b') {
+               sp->letter = 'd';
+       } else {
+               sp->letter = (char)(last->letter + 1);
+       }
+
+       sp->mountpoint = aura_strdup(mountpoint);
+       sp->capacity = capacity;
+       sp->type = FS_HAMMER;
+
+       /*
+        * We need this here, because a UFS /boot needs valid values
+        */
+       if (sp->capacity < 1024)
+               sp->fsize = 1024;
+       else
+               sp->fsize = 2048;
+
+       if (sp->capacity < 1024)
+               sp->bsize = 8192;
+       else
+               sp->bsize = 16384;
+
+       sp->is_swap = 0;
+       sp->pfs = 0;
+       if (strcasecmp(mountpoint, "swap") == 0)
+               sp->is_swap = 1;
+       if (strcmp(mountpoint, "/") != 0 && strcmp(mountpoint, "/boot") != 0 &&
+           strcmp(mountpoint, "swap") != 0)
+               sp->pfs = 1;
+
+       sp->next = NULL;
+       if (s->subpartition_head == NULL)
+               s->subpartition_head = sp;
+       else
+               s->subpartition_tail->next = sp;
+
+       sp->prev = s->subpartition_tail;
+       s->subpartition_tail = sp;
+
+       return(sp);
+}
+
 /*
  * NOTE: arguments to this function are not checked for sanity.
  *
@@ -575,6 +630,7 @@ subpartition_new(struct slice *s, const char *mountpoint, long capacity,
 
        sp->mountpoint = aura_strdup(mountpoint);
        sp->capacity = capacity;
+       sp->type = FS_UFS;
 
        if (fsize == -1) {
                if (sp->capacity < 1024)
@@ -701,6 +757,12 @@ subpartition_next(const struct subpartition *sp)
        return(sp->next);
 }
 
+int
+subpartition_get_pfs(const struct subpartition *sp)
+{
+       return(sp->pfs);
+}
+
 /*
  * Returns the name of the device node used to represent
  * the subpartition.
index 65528c4..6a12807 100644 (file)
@@ -50,6 +50,9 @@ struct disk;
 struct slice;
 struct subpartition;
 
+#define FS_HAMMER      0
+#define FS_UFS         1
+
 #ifdef NEEDS_DISKUTIL_STRUCTURE_DEFINITIONS
 
 struct storage {
@@ -101,6 +104,8 @@ struct subpartition {
        long bsize;                     /* block size */
        int is_swap;
        int mfsbacked;                  /* Memory File System Backed */
+       int type;                       /* FS type (UFS, HAMMER) */
+       int pfs;                        /* HAMMER pseudo file system */
 };
 
 #endif /* NEEDS_DISKUTIL_STRUCTURE_DEFINITIONS */
@@ -150,12 +155,14 @@ struct subpartition       *slice_subpartition_first(const struct slice *);
 
 struct subpartition    *subpartition_new(struct slice *, const char *, long,
                                          int, long, long, int);
+struct subpartition    *subpartition_new_hammer(struct slice *, const char *, long);
 int                     subpartition_count(const struct slice *);
 struct subpartition    *subpartition_find(const struct slice *, const char *, ...);
 struct subpartition    *subpartition_of(const struct slice *, const char *, ...);
 struct subpartition    *subpartition_find_capacity(const struct slice *, long);
 void                    subpartitions_free(struct slice *);
 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_raw_device_name(const struct subpartition *);
index 73a35c8..8d3bdcf 100644 (file)
@@ -10,7 +10,7 @@ CONTRIBDIR=${BSDINS_SRC}/backend/installer
 PROG=  dfuibe_installer
 NOMAN=
 SRCS=  flow.c fn_diagnostic.c fn_install.c fn_zonetab.c \
-        fn_configure.c fn_disk.c fn_subpart.c main.c
+        fn_configure.c fn_disk.c fn_subpart_hammer.c fn_subpart.c main.c
 
 CFLAGS+= -I${BSDINS_SRC}/lib