From: Sascha Wildner Date: Sat, 27 Jun 2009 17:31:54 +0000 (+0200) Subject: installer: Raise the absolute minimum disk size to 2GB. X-Git-Tag: v2.3.2~72 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/6cd7259ed48155277fb9dcb238c5e0d4af664b76 installer: Raise the absolute minimum disk size to 2GB. Also adjust some minimum partition sizes and size suggestions. While here, eliminate some dead code. --- diff --git a/usr.sbin/installer/dfuibe_installer/flow.h b/usr.sbin/installer/dfuibe_installer/flow.h index 1215147382..83cc7d81bb 100644 --- a/usr.sbin/installer/dfuibe_installer/flow.h +++ b/usr.sbin/installer/dfuibe_installer/flow.h @@ -39,7 +39,7 @@ #ifndef __FLOW_H_ #define __FLOW_H_ -#define DISK_MIN 340 +#define DISK_MIN 2048 #define HAMMER_MIN 50000 #define MTPT_ROOT 0 diff --git a/usr.sbin/installer/dfuibe_installer/fn_subpart_hammer.c b/usr.sbin/installer/dfuibe_installer/fn_subpart_hammer.c index 4f6cb35e88..ed6da3d570 100644 --- a/usr.sbin/installer/dfuibe_installer/fn_subpart_hammer.c +++ b/usr.sbin/installer/dfuibe_installer/fn_subpart_hammer.c @@ -75,7 +75,7 @@ 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 *); -static const char *def_mountpt[7] = {"/", "swap", "/var", "/tmp", "/usr", "/home", NULL}; +static const char *def_mountpt[] = {"/", "swap", "/var", "/tmp", "/usr", "/home", NULL}; static int expert = 0; /* @@ -220,15 +220,14 @@ default_capacity(struct storage *s, int mtpt) { unsigned long swap; unsigned long capacity; -#if 0 - if (mtpt == MTPT_HOME) - return(-1); -#endif + unsigned long mem; + capacity = slice_get_capacity(storage_get_selected_slice(s)); - swap = 2 * storage_get_memsize(s); - if (storage_get_memsize(s) > (capacity / 2) || capacity < 4096) - swap = storage_get_memsize(s); - if (storage_get_memsize(s) > capacity) + mem = storage_get_memsize(s); + swap = 2 * mem; + if (mem > (capacity / 2) || capacity < 4096) + swap = mem; + if (mem > capacity) swap = capacity / 2; if (swap > 8192) swap = 8192; @@ -239,21 +238,10 @@ default_capacity(struct storage *s, int mtpt) * can't be done. Sorry. */ return(-1); - } else if (capacity < 1024) { - switch (mtpt) { - case MTPT_ROOT: return(-1); - case MTPT_SWAP: return(swap); - case MTPT_VAR: return(256); - case MTPT_TMP: return(256); - case MTPT_USR: return(3072); - } } else { switch (mtpt) { case MTPT_ROOT: return(-1); case MTPT_SWAP: return(swap); - case MTPT_VAR: return(256); - case MTPT_TMP: return(256); - case MTPT_USR: return(8192); } } /* shouldn't ever happen */ @@ -264,7 +252,7 @@ static int check_capacity(struct i_fn_args *a) { struct subpartition *sp; - unsigned long min_capacity[7] = {128, 128,0, 8, 0, 174, 0}; + unsigned long min_capacity[] = {DISK_MIN, 0, 0, 0, 0, 0, 0}; unsigned long total_capacity = 0; int mtpt; @@ -465,7 +453,7 @@ populate_create_subpartitions_form(struct dfui_form *f, struct i_fn_args *a) * total physical memory (for swap.) */ for (mtpt = 0; def_mountpt[mtpt] != NULL; mtpt++) { - /* XXX matthias. skip them for now */ + /* XXX skip all except / and swap for now */ if (mtpt != MTPT_ROOT && mtpt != MTPT_SWAP) continue; capacity = default_capacity(a->s, mtpt); @@ -483,57 +471,8 @@ static int warn_subpartition_selections(struct i_fn_args *a) { int valid = 0; - struct aura_buffer *omit, *consequences; - - omit = aura_buffer_new(2048); - consequences = aura_buffer_new(2048); valid = check_capacity(a); - /* XXX matthias - * - * Should we add an information here, that we created /usr, /var, /home - * and /tmp as PFS? - */ -#if 0 - if (subpartition_find(storage_get_selected_slice(a->s), "/var") == NULL) { - aura_buffer_cat(omit, "/var "); - aura_buffer_cat(consequences, _("/var will be a plain dir in /\n")); - } - if (subpartition_find(storage_get_selected_slice(a->s), "/usr") == NULL) { - aura_buffer_cat(omit, "/usr "); - aura_buffer_cat(consequences, _("/usr will be a plain dir in /\n")); - } - if (subpartition_find(storage_get_selected_slice(a->s), "/tmp") == NULL) { - aura_buffer_cat(omit, "/tmp "); - aura_buffer_cat(consequences, _("/tmp will be symlinked to /var/tmp\n")); - } - if (subpartition_find(storage_get_selected_slice(a->s), "/home") == NULL) { - aura_buffer_cat(omit, "/home "); - aura_buffer_cat(consequences, _("/home will be symlinked to /usr/home\n")); - } - - if (valid && aura_buffer_len(omit) > 0) { - switch (dfui_be_present_dialog(a->c, _("Really omit?"), - _("Omit Subpartition(s)|Return to Create Subpartitions"), - _("You have elected to not have the following " - "subpartition(s):\n\n%s\n\n" - "The ramifications of these subpartition(s) being " - "missing will be:\n\n%s\n" - "Is this really what you want to do?"), - aura_buffer_buf(omit), aura_buffer_buf(consequences))) { - case 1: - valid = 1; - break; - case 2: - valid = 0; - break; - default: - abort_backend(); - } - } -#endif - aura_buffer_free(omit); - aura_buffer_free(consequences); return(!valid); } diff --git a/usr.sbin/installer/dfuibe_installer/fn_subpart_ufs.c b/usr.sbin/installer/dfuibe_installer/fn_subpart_ufs.c index 93fa750d8e..0735b810b5 100644 --- a/usr.sbin/installer/dfuibe_installer/fn_subpart_ufs.c +++ b/usr.sbin/installer/dfuibe_installer/fn_subpart_ufs.c @@ -76,7 +76,7 @@ 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 *); -static const char *def_mountpt[7] = {"/", "swap", "/var", "/tmp", "/usr", "/home", NULL}; +static const char *def_mountpt[] = {"/", "swap", "/var", "/tmp", "/usr", "/home", NULL}; static int expert = 0; /* @@ -242,35 +242,22 @@ create_subpartitions(struct i_fn_args *a) return(result); } -/* - * +-------+------------+--------------+-----------------+-----------------+ - * | Mtpt | Matt says | FreeBSD says | I got away with | A tiny system | - * +-------+------------+--------------+-----------------+-----------------+ - * | / | 256M | 100M | 256M | 64M | - * | swap | 1G | 2 or 3 * mem | (4 * mem) 256M | (1 * mem) 64M | - * | /var | 256M | 50M | 256M | 12M | - * | /tmp | 256M | --- | 256M | --- | - * | /usr | [4G to] 8G | (>160M) rest | 5G | 160M | - * | /home | rest | --- | 3.5G | --- | - * +-------+------------+--------------+-----------------+-----------------+ - * | total | 10G+ | ~430M+ | 9.5G | 300M | - * +-------+------------+--------------+-----------------+-----------------+ - */ - static long default_capacity(struct storage *s, int mtpt) { unsigned long swap; unsigned long capacity; + unsigned long mem; if (mtpt == MTPT_HOME) return(-1); capacity = slice_get_capacity(storage_get_selected_slice(s)); - swap = 2 * storage_get_memsize(s); - if (storage_get_memsize(s) > (capacity / 2) || capacity < 4096) - swap = storage_get_memsize(s); - if (storage_get_memsize(s) > capacity) + mem = storage_get_memsize(s); + swap = 2 * mem; + if (mem > (capacity / 2) || capacity < 4096) + swap = mem; + if (mem > capacity) swap = capacity / 2; if (swap > 8192) swap = 8192; @@ -281,29 +268,13 @@ default_capacity(struct storage *s, int mtpt) * can't be done. Sorry. */ return(-1); - } else if (capacity < 523) { - switch (mtpt) { - case MTPT_ROOT: return(70); - case MTPT_SWAP: return(swap); - case MTPT_VAR: return(32); - case MTPT_TMP: return(32); - case MTPT_USR: return(174); - } - } else if (capacity < 1024) { - switch (mtpt) { - case MTPT_ROOT: return(96); - case MTPT_SWAP: return(swap); - case MTPT_VAR: return(64); - case MTPT_TMP: return(64); - case MTPT_USR: return(256); - } } else if (capacity < 4096) { switch (mtpt) { - case MTPT_ROOT: return(128); + case MTPT_ROOT: return(256); case MTPT_SWAP: return(swap); case MTPT_VAR: return(128); case MTPT_TMP: return(128); - case MTPT_USR: return(512); + case MTPT_USR: return(1536); } } else if (capacity < 10240) { switch (mtpt) { @@ -330,7 +301,7 @@ static int check_capacity(struct i_fn_args *a) { struct subpartition *sp; - unsigned long min_capacity[7] = {70, 0, 8, 0, 174, 0, 0}; + unsigned long min_capacity[] = {256, 0, 16, 0, 1536, 0, 0}; unsigned long total_capacity = 0; int mtpt;