Deleted Added
full compact
7c7
< * $Id: label.c,v 1.19 1995/05/21 17:53:27 jkh Exp $
---
> * $Id: label.c,v 1.20 1995/05/21 18:24:33 jkh Exp $
68a69,71
> /* One MB worth of blocks */
> #define ONE_MEG 2048
>
70c73
< #define FS_MIN_SIZE 2048
---
> #define FS_MIN_SIZE ONE_MEG
73c76
< #define ROOT_MIN_SIZE 40960 /* 20MB */
---
> #define ROOT_MIN_SIZE (20 * ONE_MEG)
171a175
> ++j;
213d216
< dialog_clear(); clear();
258d260
< dialog_clear(); clear();
332c334
< label_chunk_info[i].c->name, sz, (sz / 2048));
---
> label_chunk_info[i].c->name, sz, (sz / ONE_MEG));
384c386
< label_chunk_info[i].c->size / 2048 : 0);
---
> label_chunk_info[i].c->size / ONE_MEG : 0);
429c431
< clear();
---
> dialog_clear(); clear();
430a433
> clear();
481,484c484,487
< char *val, *cp, tmpb[20];
< int size;
< struct chunk *tmp;
< u_long flags = 0;
---
> char *val, *cp, tmpb[20];
> int size;
> struct chunk *tmp;
> u_long flags = 0;
486,489c489,492
< snprintf(tmpb, 20, "%d", sz);
< val = msgGetInput(tmpb, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M).");
< if (!val || (size = strtol(val, &cp, 0)) <= 0)
< break;
---
> snprintf(tmpb, 20, "%d", sz);
> val = msgGetInput(tmpb, "Please specify the size for new FreeBSD partition in blocks, or append\na trailing `M' for megabytes (e.g. 20M).");
> if (!val || (size = strtol(val, &cp, 0)) <= 0)
> break;
491,492c494,499
< if (*cp && toupper(*cp) == 'M')
< size *= 2048;
---
> if (sz <= FS_MIN_SIZE) {
> msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG);
> break;
> }
> if (*cp && toupper(*cp) == 'M')
> size *= ONE_MEG;
494,499c501,502
< type = get_partition_type();
< if (type == PART_NONE)
< break;
<
< if (type == PART_FILESYSTEM) {
< if ((p = get_mountpoint(NULL)) == NULL)
---
> type = get_partition_type();
> if (type == PART_NONE)
501,506d503
< else if (!strcmp(p->mountpoint, "/"))
< flags |= CHUNK_IS_ROOT;
< else
< flags &= ~CHUNK_IS_ROOT;
< } else
< p = NULL;
508,511c505,523
< if ((flags & CHUNK_IS_ROOT)) {
< if (!(label_chunk_info[here].c->flags & CHUNK_BSD_COMPAT)) {
< msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a location. Please choose another location for your root\npartition and try again!");
< break;
---
> if (type == PART_FILESYSTEM) {
> if ((p = get_mountpoint(NULL)) == NULL)
> break;
> else if (!strcmp(p->mountpoint, "/"))
> flags |= CHUNK_IS_ROOT;
> else
> flags &= ~CHUNK_IS_ROOT;
> } else
> p = NULL;
>
> if ((flags & CHUNK_IS_ROOT)) {
> if (!(label_chunk_info[here].c->flags & CHUNK_BSD_COMPAT)) {
> msgConfirm("This region cannot be used for your root partition as\nthe FreeBSD boot code cannot deal with a root partition created in\nsuch a location. Please choose another location for your root\npartition and try again!");
> break;
> }
> if (size < ROOT_MIN_SIZE) {
> msgConfirm("This is too small a size for a root partition. For a variety of\nreasons, root partitions should be at least %dMB in size", ROOT_MIN_SIZE / ONE_MEG);
> break;
> }
513,514c525,531
< if (size < ROOT_MIN_SIZE) {
< msgConfirm("This is too small a size for a root partition. For a variety of\nreasons, root partitions should be at least %dMB in size", ROOT_MIN_SIZE / 2048);
---
> tmp = Create_Chunk_DWIM(label_chunk_info[here].d,
> label_chunk_info[here].c,
> size, part,
> (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS,
> flags);
> if (!tmp) {
> msgConfirm("Unable to create the partition. Too big?");
517,527c534
< }
< tmp = Create_Chunk_DWIM(label_chunk_info[here].d,
< label_chunk_info[here].c,
< size, part,
< (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS,
< flags);
< if (!tmp) {
< msgConfirm("Unable to create the partition. Too big?");
< break;
< }
< if ((flags & CHUNK_IS_ROOT) && (tmp->flags & CHUNK_PAST_1024)) {
---
> if ((flags & CHUNK_IS_ROOT) && (tmp->flags & CHUNK_PAST_1024)) {
531,532c538,539
< }
< if (type != PART_SWAP) {
---
> }
> if (type != PART_SWAP) {
536c543
< } else {
---
> } else {
538,540c545,547
< }
< tmp->private_free = safe_free;
< record_label_chunks();
---
> }
> tmp->private_free = safe_free;
> record_label_chunks();
642d648
< refresh();