diff --git a/usr.sbin/installer/dfuibe_installer/flow.c b/usr.sbin/installer/dfuibe_installer/flow.c index eec878e..a1f54be 100644 --- a/usr.sbin/installer/dfuibe_installer/flow.c +++ b/usr.sbin/installer/dfuibe_installer/flow.c @@ -397,11 +397,11 @@ state_configure_menu(struct i_fn_args *a) { case 1: /* HAMMER */ - use_hammer = 1; + a->flags |= I_FS_HAMMER; break; case 2: /* UFS */ - use_hammer = 0; + a->flags |= I_FS_UFS; break; case 3: state = state_welcome; @@ -982,8 +982,6 @@ 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" @@ -993,10 +991,11 @@ state_ask_fs(struct i_fn_args *a) { case 1: /* HAMMER */ - use_hammer = 1; + a->flags |= I_FS_HAMMER; break; case 2: /* UFS */ + a->flags |= I_FS_UFS; break; case 3: state = state_select_disk; @@ -1162,9 +1161,9 @@ state_create_subpartitions(struct i_fn_args *a) commands_execute(a, cmds); commands_free(cmds); - if (use_hammer) + if (installer_use_hammer(a)) fn_create_subpartitions_hammer(a); - else + else if (installer_use_ufs(a)) fn_create_subpartitions_ufs(a); if (a->result) { diff --git a/usr.sbin/installer/dfuibe_installer/fn_configure.c b/usr.sbin/installer/dfuibe_installer/fn_configure.c index 616de96..225d655 100644 --- a/usr.sbin/installer/dfuibe_installer/fn_configure.c +++ b/usr.sbin/installer/dfuibe_installer/fn_configure.c @@ -1365,7 +1365,7 @@ mount_target_system(struct i_fn_args *a) /* * Mount the target's / and read its /etc/fstab. */ - if (use_hammer == 0) { + if (installer_use_ufs(a)) { command_add(cmds, "%s%s /dev/%s %s%s", a->os_root, cmd_name(a, "MOUNT"), subpartition_get_device_name(a_subpart), @@ -1377,7 +1377,7 @@ mount_target_system(struct i_fn_args *a) a->os_root, cmd_name(a, "GREP"), a->os_root, a->cfg_root, a->tmp); command_set_failure_mode(cmd, COMMAND_FAILURE_IGNORE); - } else { + } else if (installer_use_hammer(a)) { command_add(cmds, "%s%s /dev/%s %sboot", a->os_root, cmd_name(a, "MOUNT"), subpartition_get_device_name(a_subpart), @@ -1397,7 +1397,7 @@ mount_target_system(struct i_fn_args *a) commands_free(cmds); cmds = commands_new(); - if (use_hammer) { + if (installer_use_hammer(a)) { struct stat sb = { .st_size = 0 }; stat("/tmp/t2", &sb); if (sb.st_size > 0) { @@ -1453,7 +1453,7 @@ mount_target_system(struct i_fn_args *a) crypttab = fopen(filename, "r"); free(filename); if (crypttab != NULL) { - if (!use_hammer) + if (installer_use_ufs(a)) fn_get_passphrase(a); while (fgets(line, 256, crypttab) != NULL) { /* @@ -1554,14 +1554,14 @@ mount_target_system(struct i_fn_args *a) cvtoptions, a->os_root, a->cfg_root, mtpt); free(cvtoptions); } else { - if (use_hammer == 0) { + if (installer_use_ufs(a)) { command_add(cmds, "%s%s -o %s %s%s %s%s%s", a->os_root, cmd_name(a, "MOUNT"), options, a->os_root, device, a->os_root, a->cfg_root, mtpt); - } else { + } else if (installer_use_hammer(a)) { command_add(cmds, "%s%s -o %s %s%s%s %s%s%s", a->os_root, cmd_name(a, "MOUNT_NULL"), diff --git a/usr.sbin/installer/dfuibe_installer/fn_install.c b/usr.sbin/installer/dfuibe_installer/fn_install.c index e1d4c4d..bf5c61c 100644 --- a/usr.sbin/installer/dfuibe_installer/fn_install.c +++ b/usr.sbin/installer/dfuibe_installer/fn_install.c @@ -186,14 +186,14 @@ 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) { - if (use_hammer == 1) { + if (installer_use_hammer(a)) { command_add(cmds, "%s%s /dev/%s %smnt%s", a->os_root, cmd_name(a, "MOUNT_HAMMER"), subpartition_is_encrypted(sp) ? "mapper/root" : subpartition_get_device_name(sp), a->os_root, subpartition_get_mountpoint(sp)); - } else { + } else if (installer_use_ufs(a)) { command_add(cmds, "%s%s /dev/%s %smnt%s", a->os_root, cmd_name(a, "MOUNT"), subpartition_get_device_name(sp), @@ -225,7 +225,7 @@ fn_install_os(struct i_fn_args *a) continue; } - if (use_hammer == 0) { + if (!installer_use_hammer(a)) { /* / is already mounted */ if (strcmp(subpartition_get_mountpoint(sp), "/") != 0) { command_add(cmds, "%s%s -p %smnt%s", @@ -265,7 +265,7 @@ fn_install_os(struct i_fn_args *a) /* * Take care of HAMMER PFS. */ - if (use_hammer == 1) + if (installer_use_hammer(a)) handle_pfs(a, cmds); /* @@ -539,7 +539,7 @@ fn_install_os(struct i_fn_args *a) subpartition_get_device_name(sp), a->os_root); } - } else if (use_hammer == 0) { + } else if (installer_use_ufs(a)) { 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"), @@ -570,7 +570,7 @@ fn_install_os(struct i_fn_args *a) subpartition_get_mountpoint(sp), a->os_root); } - } else { + } else if (installer_use_hammer(a)) { 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"), @@ -607,7 +607,7 @@ fn_install_os(struct i_fn_args *a) /* * Take care of HAMMER PFS null mounts. */ - if (use_hammer == 1) { + if (installer_use_hammer(a)) { for (j = 0; pfs_mountpt[j] != NULL; j++) { if (rindex(pfs_mountpt[j]+1, '/') != NULL) command_add(cmds, "%s%s '/pfs%s.%s\t%s\t\tnull\trw\t\t0\t0' >>%smnt/etc/fstab", @@ -661,7 +661,7 @@ fn_install_os(struct i_fn_args *a) "%s%s 'dm_target_crypt_load=\"yes\"' >>%smnt/boot/loader.conf", a->os_root, cmd_name(a, "ECHO"), a->os_root); - if (use_hammer) { + if (installer_use_hammer(a)) { command_add(cmds, "%s%s 'initrd.img_load=\"YES\"' >>%smnt/boot/loader.conf", a->os_root, cmd_name(a, "ECHO"), diff --git a/usr.sbin/installer/libinstaller/functions.c b/usr.sbin/installer/libinstaller/functions.c index 034f2f6..66e8e4c 100644 --- a/usr.sbin/installer/libinstaller/functions.c +++ b/usr.sbin/installer/libinstaller/functions.c @@ -273,6 +273,18 @@ string_to_capacity(const char *string, long *capacity) return(1); } +int +installer_use_hammer(struct i_fn_args *a) +{ + return (a->flags & I_FS_HAMMER); +} + +int +installer_use_ufs(struct i_fn_args *a) +{ + return (a->flags & I_FS_UFS); +} + /* * Round a number up to the nearest power of two. */ diff --git a/usr.sbin/installer/libinstaller/functions.h b/usr.sbin/installer/libinstaller/functions.h index e704365..55cb86e 100644 --- a/usr.sbin/installer/libinstaller/functions.h +++ b/usr.sbin/installer/libinstaller/functions.h @@ -51,8 +51,11 @@ struct storage; /* * Function argument flags */ -#define I_BOOTED_LIVECD 0x1 -#define I_UPGRADE_TOOGLE 0x2 +#define I_BOOTED_LIVECD 0x0001 +#define I_UPGRADE_TOOGLE 0x0002 +#define I_FS_HAMMER 0x0004 +#define I_FS_UFS 0x0008 +#define I_FS_HAMMER2 0x0010 /* * Installer function arguments. @@ -94,6 +97,8 @@ const char *capacity_to_string(long); int string_to_capacity(const char *, long *); unsigned long next_power_of_two(unsigned long); char *filename_noext(const char *); +int installer_use_hammer(struct i_fn_args *); +int installer_use_ufs(struct i_fn_args *); /* Temp Files */