installer: Allow for tmpfs (instead of mfs) partition creation.
authorSascha Wildner <saw@online.de>
Sun, 19 Sep 2010 09:05:22 +0000 (11:05 +0200)
committerSascha Wildner <saw@online.de>
Sun, 19 Sep 2010 09:14:22 +0000 (11:14 +0200)
The installer allowed (though only in UFS "expert mode") to add mfs-backed
partitions. Change all this to tmpfs as well.

share/installer/cmdnames.conf
usr.sbin/installer/dfuibe_installer/fn_configure.c
usr.sbin/installer/dfuibe_installer/fn_install.c
usr.sbin/installer/dfuibe_installer/fn_subpart_hammer.c
usr.sbin/installer/dfuibe_installer/fn_subpart_ufs.c
usr.sbin/installer/dfuibe_installer/pathnames.h
usr.sbin/installer/libinstaller/diskutil.c
usr.sbin/installer/libinstaller/diskutil.h

index 4ba15bc..21337ce 100644 (file)
@@ -34,8 +34,8 @@ IFCONFIG=sbin/ifconfig
 MOUNT=sbin/mount
 MOUNTD=sbin/mountd
 MOUNT_HAMMER=sbin/mount_hammer
-MOUNT_MFS=sbin/mount_mfs
 MOUNT_NULL=sbin/mount_null
+MOUNT_TMPFS=sbin/mount_tmpfs
 NEWFS=sbin/newfs
 NEWFS_HAMMER=sbin/newfs_hammer
 NEWFS_MSDOS=sbin/newfs_msdos
index 39aa517..172798a 100644 (file)
@@ -76,7 +76,7 @@
 #include "pathnames.h"
 
 static const char      *yes_to_y(const char *);
-static char            *convert_swap_options(char *);
+static char            *convert_tmpfs_options(char *);
 
 /** CONFIGURE FUNCTIONS **/
 
@@ -1179,13 +1179,13 @@ fn_select_services(struct i_fn_args *a)
        dfui_response_free(r);
 }
 
-/*** NON-fn_ FUnCTIONS ***/
+/*** NON-fn_ FUNCTIONS ***/
 
 /*
  * Caller is responsible for deallocation.
  */
 static char *
-convert_swap_options(char *line)
+convert_tmpfs_options(char *line)
 {
        char *result, *word;
        int i;
@@ -1347,21 +1347,21 @@ mount_target_system(struct i_fn_args *a)
 
                                /*
                                 * Don't mount it if device doesn't start
-                                * with /dev/ or /pfs and it isn't 'swap'.
+                                * with /dev/ or /pfs and it isn't 'tmpfs'.
                                 */
                                if (strstr(device, "/dev/") != NULL &&
                                     strstr(device, "/pfs/") != NULL &&
-                                    strcmp(device, "swap") != 0)
+                                    strcmp(device, "tmpfs") != 0)
                                        continue;
 
                                /*
-                                * If the device is 'swap', mount_mfs it instead.
+                                * If the device is 'tmpfs', mount_tmpfs it instead.
                                 */
-                               if (strcmp(device, "swap") == 0) {
-                                       cvtoptions = convert_swap_options(options);
+                               if (strcmp(device, "tmpfs") == 0) {
+                                       cvtoptions = convert_tmpfs_options(options);
                                        command_add(cmds,
-                                           "%s%s %s swap %s%s%s",
-                                           a->os_root, cmd_name(a, "MOUNT_MFS"),
+                                           "%s%s %s tmpfs %s%s%s",
+                                           a->os_root, cmd_name(a, "MOUNT_TMPFS"),
                                            cvtoptions, a->os_root, a->cfg_root, mtpt);
                                        free(cvtoptions);
                                } else {
index 77b2220..ad37126 100644 (file)
@@ -255,8 +255,8 @@ fn_install_os(struct i_fn_args *a)
                                    a->os_root, cmd_name(a, "MKDIR"),
                                    a->os_root,
                                    subpartition_get_mountpoint(sp));
-                               /* Don't mount it if it's MFS-backed. */
-                               if (subpartition_is_mfsbacked(sp))
+                               /* Don't mount it if it's TMPFS-backed. */
+                               if (subpartition_is_tmpfsbacked(sp))
                                        continue;
                                command_add(cmds, "%s%s %sdev/%s %smnt%s",
                                    a->os_root, cmd_name(a, "MOUNT"),
@@ -295,12 +295,12 @@ fn_install_os(struct i_fn_args *a)
                dest = cp_src[i];
 
                /*
-                * If dest would be on an MFS-backed
+                * If dest would be on an TMPFS-backed
                 * mountpoint, don't bother copying it.
                 */
                sp = subpartition_of(storage_get_selected_slice(a->s),
                                     "%s%s", a->os_root, &dest[1]);
-               if (sp != NULL && subpartition_is_mfsbacked(sp)) {
+               if (sp != NULL && subpartition_is_tmpfsbacked(sp)) {
                        continue;
                }
 
@@ -351,10 +351,10 @@ fn_install_os(struct i_fn_args *a)
             sp != NULL; sp = subpartition_next(sp)) {
                /*
                 * If the subpartition is a swap subpartition or an
-                * MFS-backed mountpoint, don't try to copy anything
+                * TMPFS-backed mountpoint, don't try to copy anything
                 * into it.
                 */
-               if (subpartition_is_swap(sp) || subpartition_is_mfsbacked(sp))
+               if (subpartition_is_swap(sp) || subpartition_is_tmpfsbacked(sp))
                        continue;
 
                /*
@@ -549,13 +549,11 @@ fn_install_os(struct i_fn_args *a)
                                    subpartition_get_device_name(sp),
                                    subpartition_get_mountpoint(sp),
                                    a->os_root);
-                       } else if (subpartition_is_mfsbacked(sp)) {
-                               command_add(cmds, "%s%s 'swap\t\t%s\t\t\tmfs\trw,-s%lu,-b%lu,-f%lu\t\t1\t1' >>%smnt/etc/fstab",
+                       } else if (subpartition_is_tmpfsbacked(sp)) {
+                               command_add(cmds, "%s%s 'tmpfs\t\t\t%s\t\ttmpfs\trw,-s%luM\t1\t1' >>%smnt/etc/fstab",
                                        a->os_root, cmd_name(a, "ECHO"),
                                        subpartition_get_mountpoint(sp),
-                                       subpartition_get_capacity(sp) * 2048,
-                                       subpartition_get_bsize(sp),
-                                       subpartition_get_fsize(sp),
+                                       subpartition_get_capacity(sp),
                                        a->os_root);
                        } else {
                                command_add(cmds, "%s%s '/dev/%s\t\t%s\t\tufs\trw\t\t2\t2' >>%smnt/etc/fstab",
index a117a8b..fcd71d7 100644 (file)
@@ -150,7 +150,7 @@ create_subpartitions(struct i_fn_args *a)
         */
        for (sp = slice_subpartition_first(storage_get_selected_slice(a->s));
             sp != NULL; sp = subpartition_next(sp)) {
-               if (subpartition_is_mfsbacked(sp)) {
+               if (subpartition_is_tmpfsbacked(sp)) {
                        continue;
                }
                if (subpartition_is_swap(sp)) {
@@ -196,7 +196,7 @@ create_subpartitions(struct i_fn_args *a)
         */
        for (sp = slice_subpartition_first(storage_get_selected_slice(a->s));
             sp != NULL; sp = subpartition_next(sp)) {
-               if (subpartition_is_swap(sp) || subpartition_is_mfsbacked(sp))
+               if (subpartition_is_swap(sp) || subpartition_is_tmpfsbacked(sp))
                        continue;
 
                if (strcmp(subpartition_get_mountpoint(sp), "/boot") == 0) {
@@ -568,8 +568,8 @@ make_create_subpartitions_form(struct i_fn_args *a)
                    dfui_info_new(_("Softupdates"), "", ""));
                dfui_field_property_set(fi, "control", "checkbox");
 
-               fi = dfui_form_field_add(f, "mfsbacked",
-                   dfui_info_new(_("MFS"), "", ""));
+               fi = dfui_form_field_add(f, "tmpfsbacked",
+                   dfui_info_new(_("TMPFS"), "", ""));
                dfui_field_property_set(fi, "control", "checkbox");
 
                fi = dfui_form_field_add(f, "fsize",
index 719cf62..af96982 100644 (file)
@@ -151,7 +151,7 @@ create_subpartitions(struct i_fn_args *a)
         */
        for (sp = slice_subpartition_first(storage_get_selected_slice(a->s));
             sp != NULL; sp = subpartition_next(sp)) {
-               if (subpartition_is_mfsbacked(sp)) {
+               if (subpartition_is_tmpfsbacked(sp)) {
                        continue;
                }
                if (subpartition_is_swap(sp)) {
@@ -192,7 +192,7 @@ create_subpartitions(struct i_fn_args *a)
         */
        for (sp = slice_subpartition_first(storage_get_selected_slice(a->s));
             sp != NULL; sp = subpartition_next(sp)) {
-               if (subpartition_is_swap(sp) || subpartition_is_mfsbacked(sp))
+               if (subpartition_is_swap(sp) || subpartition_is_tmpfsbacked(sp))
                        continue;
 
                command_add(cmds, "%s%s%s -b %ld -f %ld %sdev/%s",
@@ -317,7 +317,7 @@ check_subpartition_selections(struct dfui_response *r, struct i_fn_args *a)
        long capacity = 0;
        long bsize, fsize;
        int found_root = 0;
-       int softupdates, mfsbacked;
+       int softupdates, tmpfsbacked;
        int valid = 1;
 
        d = aura_dict_new(1, AURA_DICT_LIST);
@@ -340,10 +340,10 @@ check_subpartition_selections(struct dfui_response *r, struct i_fn_args *a)
                            (strcmp(dfui_dataset_get_value(ds, "softupdates"), "Y") == 0);
                        fsize = atol(dfui_dataset_get_value(ds, "fsize"));
                        bsize = atol(dfui_dataset_get_value(ds, "bsize"));
-                       mfsbacked = (strcmp(dfui_dataset_get_value(ds, "mfsbacked"), "Y") == 0);
+                       tmpfsbacked = (strcmp(dfui_dataset_get_value(ds, "tmpfsbacked"), "Y") == 0);
                } else {
                        softupdates = (strcmp(mountpoint, "/") == 0 ? 0 : 1);
-                       mfsbacked = (strcmp(mountpoint, "/tmp") == 0 ? 0 : 1);
+                       tmpfsbacked = (strcmp(mountpoint, "/tmp") == 0 ? 0 : 1);
                        fsize = -1;
                        bsize = -1;
                }
@@ -429,7 +429,7 @@ static void
 save_subpartition_selections(struct dfui_response *r, struct i_fn_args *a)
 {
        struct dfui_dataset *ds;
-       char mfsbacked;
+       char tmpfsbacked;
        const char *mountpoint, *capstring;
        long capacity;
        long bsize, fsize;
@@ -448,17 +448,17 @@ save_subpartition_selections(struct dfui_response *r, struct i_fn_args *a)
                            (strcmp(dfui_dataset_get_value(ds, "softupdates"), "Y") == 0);
                        fsize = atol(dfui_dataset_get_value(ds, "fsize"));
                        bsize = atol(dfui_dataset_get_value(ds, "bsize"));
-                       mfsbacked = (strcmp(dfui_dataset_get_value(ds, "mfsbacked"), "Y") == 0);
+                       tmpfsbacked = (strcmp(dfui_dataset_get_value(ds, "tmpfsbacked"), "Y") == 0);
                } else {
                        softupdates = (strcmp(mountpoint, "/") == 0 ? 0 : 1);
-                       mfsbacked = 0;
+                       tmpfsbacked = 0;
                        fsize = -1;
                        bsize = -1;
                }
 
                if (string_to_capacity(capstring, &capacity)) {
                        subpartition_new(storage_get_selected_slice(a->s), mountpoint, capacity,
-                           softupdates, fsize, bsize, mfsbacked);
+                           softupdates, fsize, bsize, tmpfsbacked);
                }
        }
 }
@@ -487,8 +487,8 @@ populate_create_subpartitions_form(struct dfui_form *f, struct i_fn_args *a)
                        if (expert) {
                                dfui_dataset_celldata_add(ds, "softupdates",
                                    subpartition_is_softupdated(sp) ? "Y" : "N");
-                               dfui_dataset_celldata_add(ds, "mfsbacked",
-                                   subpartition_is_mfsbacked(sp) ? "Y" : "N");
+                               dfui_dataset_celldata_add(ds, "tmpfsbacked",
+                                   subpartition_is_tmpfsbacked(sp) ? "Y" : "N");
                                snprintf(temp, 32, "%ld", subpartition_get_fsize(sp));
                                dfui_dataset_celldata_add(ds, "fsize",
                                    temp);
@@ -515,7 +515,7 @@ populate_create_subpartitions_form(struct dfui_form *f, struct i_fn_args *a)
                        if (expert) {
                                dfui_dataset_celldata_add(ds, "softupdates",
                                    strcmp(def_mountpt[mtpt], "/") != 0 ? "Y" : "N");
-                               dfui_dataset_celldata_add(ds, "mfsbacked",
+                               dfui_dataset_celldata_add(ds, "tmpfsbacked",
                                    "N");
                                dfui_dataset_celldata_add(ds, "fsize",
                                    capacity < 1024 ? "1024" : "2048");
@@ -633,8 +633,8 @@ make_create_subpartitions_form(struct i_fn_args *a)
                    dfui_info_new(_("Softupdates"), "", ""));
                dfui_field_property_set(fi, "control", "checkbox");
 
-               fi = dfui_form_field_add(f, "mfsbacked",
-                   dfui_info_new(_("MFS"), "", ""));
+               fi = dfui_form_field_add(f, "tmpfsbacked",
+                   dfui_info_new(_("TMPFS"), "", ""));
                dfui_field_property_set(fi, "control", "checkbox");
 
                fi = dfui_form_field_add(f, "fsize",
index 509f55d..de4b906 100644 (file)
@@ -20,7 +20,7 @@
 
 /*
  * Default directory in which temporary files are placed.
- * /tmp/ is generally MFS mounted when booting from a live CD,
+ * /tmp/ is generally TMPFS mounted when booting from a live CD,
  * so we can use it both in development and in production.
  * Note that this must include the trailing slash.
  * Note that this is NOT relative to the source file root dir.
index 7158e30..64f5fac 100644 (file)
@@ -79,14 +79,14 @@ storage_new(void)
 }
 
 int
-storage_get_mfs_status(const char *mountpoint, struct storage *s)
+storage_get_tmpfs_status(const char *mountpoint, struct storage *s)
 {
        struct subpartition *sp;
        sp = NULL;
        for (sp = slice_subpartition_first(s->selected_slice);
                sp != NULL; sp = subpartition_next(sp)) {
                if(strcmp(subpartition_get_mountpoint(sp), mountpoint) == 0) {
-                       if(subpartition_is_mfsbacked(sp) == 1) {
+                       if(subpartition_is_tmpfsbacked(sp) == 1) {
                                return 1;
                        } else {
                                return 0;
@@ -567,7 +567,7 @@ subpartition_new_hammer(struct slice *s, const char *mountpoint, long capacity)
  */
 struct subpartition *
 subpartition_new(struct slice *s, const char *mountpoint, long capacity,
-                int softupdates, long fsize, long bsize, int mfsbacked)
+                int softupdates, long fsize, long bsize, int tmpfsbacked)
 {
        struct subpartition *sp, *sptmp;
        int letter='d';
@@ -607,7 +607,7 @@ subpartition_new(struct slice *s, const char *mountpoint, long capacity,
                sp->softupdates = softupdates;
        }
 
-       sp->mfsbacked = mfsbacked;
+       sp->tmpfsbacked = tmpfsbacked;
 
        sp->is_swap = 0;
        if (strcasecmp(mountpoint, "swap") == 0)
@@ -639,7 +639,7 @@ subpartition_new(struct slice *s, const char *mountpoint, long capacity,
 
        for (sptmp = s->subpartition_head; sptmp != NULL;
             sptmp = sptmp->next) {
-               if (sptmp->mfsbacked)
+               if (sptmp->tmpfsbacked)
                        sptmp->letter = '@';
                else if (strcmp(sptmp->mountpoint, "/") == 0 ||
                         strcmp(sptmp->mountpoint, "/dummy") == 0)
@@ -801,9 +801,9 @@ subpartition_is_softupdated(const struct subpartition *sp)
        return(sp->softupdates);
 }
 int
-subpartition_is_mfsbacked(const struct subpartition *sp)
+subpartition_is_tmpfsbacked(const struct subpartition *sp)
 {
-       return(sp->mfsbacked);
+       return(sp->tmpfsbacked);
 }
 
 int
index acb7aca..1a86dec 100644 (file)
@@ -105,7 +105,7 @@ struct subpartition {
        long fsize;                     /* fragment size */
        long bsize;                     /* block size */
        int is_swap;
-       int mfsbacked;                  /* Memory File System Backed */
+       int tmpfsbacked;                /* TMPFS Backed */
        int type;                       /* FS type (UFS, HAMMER) */
        int pfs;                        /* HAMMER pseudo file system */
 };
@@ -123,7 +123,7 @@ void                         storage_set_selected_disk(struct storage *, struct disk *);
 struct disk            *storage_get_selected_disk(const struct storage *);
 void                    storage_set_selected_slice(struct storage *, struct slice *);
 struct slice           *storage_get_selected_slice(const struct storage *);
-int                     storage_get_mfs_status(const char *, struct storage *);
+int                     storage_get_tmpfs_status(const char *, struct storage *);
 
 struct disk            *disk_new(struct storage *, const char *);
 struct disk            *disk_find(const struct storage *, const char *);
@@ -175,7 +175,7 @@ unsigned long                subpartition_get_bsize(const struct subpartition *);
 unsigned long           subpartition_get_capacity(const struct subpartition *);
 int                     subpartition_is_swap(const struct subpartition *);
 int                     subpartition_is_softupdated(const struct subpartition *);
-int                     subpartition_is_mfsbacked(const struct subpartition *);
+int                     subpartition_is_tmpfsbacked(const struct subpartition *);
 
 long                    measure_activated_swap(const struct i_fn_args *);
 long                    measure_activated_swap_from_slice(const struct i_fn_args *,