Deleted Added
full compact
disks.c (54473) disks.c (54587)
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last program in the `sysinstall' line - the next
5 * generation being essentially a complete rewrite.
6 *
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last program in the `sysinstall' line - the next
5 * generation being essentially a complete rewrite.
6 *
7 * $FreeBSD: head/usr.sbin/sysinstall/disks.c 54473 1999-12-12 04:58:02Z jkh $
7 * $FreeBSD: head/usr.sbin/sysinstall/disks.c 54587 1999-12-14 04:25:29Z jkh $
8 *
9 * Copyright (c) 1995
10 * Jordan Hubbard. All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright

--- 337 unchanged lines hidden (view full) ---

353
354 case 'T':
355 if (chunk_info[current_chunk]->type == unused)
356 msg = "Slice is currently unused (use create instead)";
357 else {
358 char *val, tmp[20];
359 int subtype;
360 chunk_e partitiontype;
8 *
9 * Copyright (c) 1995
10 * Jordan Hubbard. All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright

--- 337 unchanged lines hidden (view full) ---

353
354 case 'T':
355 if (chunk_info[current_chunk]->type == unused)
356 msg = "Slice is currently unused (use create instead)";
357 else {
358 char *val, tmp[20];
359 int subtype;
360 chunk_e partitiontype;
361 WINDOW *save = savescr();
362
363 strcpy(tmp, "165");
364 val = msgGetInput(tmp, "New partition type:\n\n"
365 "Pressing Enter will choose the default, a native FreeBSD\n"
366 "slice (type 165). Other popular values are 6 for\n"
367 "DOS FAT partition, 131 for a Linux ext2fs partition or\n"
368 "130 for a Linux swap partition.\n\n"
369 "Note: If you choose a non-FreeBSD partition type, it will not\n"

--- 5 unchanged lines hidden (view full) ---

375 partitiontype = freebsd;
376 else if (subtype == 6)
377 partitiontype = fat;
378 else
379 partitiontype = unknown;
380 chunk_info[current_chunk]->type = partitiontype;
381 chunk_info[current_chunk]->subtype = subtype;
382 }
361
362 strcpy(tmp, "165");
363 val = msgGetInput(tmp, "New partition type:\n\n"
364 "Pressing Enter will choose the default, a native FreeBSD\n"
365 "slice (type 165). Other popular values are 6 for\n"
366 "DOS FAT partition, 131 for a Linux ext2fs partition or\n"
367 "130 for a Linux swap partition.\n\n"
368 "Note: If you choose a non-FreeBSD partition type, it will not\n"

--- 5 unchanged lines hidden (view full) ---

374 partitiontype = freebsd;
375 else if (subtype == 6)
376 partitiontype = fat;
377 else
378 partitiontype = unknown;
379 chunk_info[current_chunk]->type = partitiontype;
380 chunk_info[current_chunk]->subtype = subtype;
381 }
383 restorescr(save);
384 }
385 break;
386
387 case 'G':
388 snprintf(geometry, 80, "%lu/%lu/%lu", d->bios_cyl, d->bios_hd, d->bios_sect);
389 val = msgGetInput(geometry, "Please specify the new geometry in cyl/hd/sect format.\n"
390 "Don't forget to use the two slash (/) separator characters!\n"
391 "It's not possible to parse the field without them.");

--- 107 unchanged lines hidden (view full) ---

499 msg = "Type F1 or ? for help";
500 break;
501 }
502 }
503 p = CheckRules(d);
504 if (p) {
505 char buf[FILENAME_MAX];
506
382 }
383 break;
384
385 case 'G':
386 snprintf(geometry, 80, "%lu/%lu/%lu", d->bios_cyl, d->bios_hd, d->bios_sect);
387 val = msgGetInput(geometry, "Please specify the new geometry in cyl/hd/sect format.\n"
388 "Don't forget to use the two slash (/) separator characters!\n"
389 "It's not possible to parse the field without them.");

--- 107 unchanged lines hidden (view full) ---

497 msg = "Type F1 or ? for help";
498 break;
499 }
500 }
501 p = CheckRules(d);
502 if (p) {
503 char buf[FILENAME_MAX];
504
507 dialog_clear_norefresh();
508 use_helpline("Press F1 to read more about disk slices.");
509 use_helpfile(systemHelpFile("partition", buf));
510 if (!variable_get(VAR_NO_WARN))
511 dialog_mesgbox("Disk slicing warning:", p, -1, -1);
512 free(p);
513 }
514 restorescr(w);
515}

--- 41 unchanged lines hidden (view full) ---

557 }
558 /* Toggle enabled status? */
559 if (!devs[0]->enabled) {
560 devs[0]->enabled = TRUE;
561 diskPartition(devs[0]);
562 }
563 else
564 devs[0]->enabled = FALSE;
505 use_helpline("Press F1 to read more about disk slices.");
506 use_helpfile(systemHelpFile("partition", buf));
507 if (!variable_get(VAR_NO_WARN))
508 dialog_mesgbox("Disk slicing warning:", p, -1, -1);
509 free(p);
510 }
511 restorescr(w);
512}

--- 41 unchanged lines hidden (view full) ---

554 }
555 /* Toggle enabled status? */
556 if (!devs[0]->enabled) {
557 devs[0]->enabled = TRUE;
558 diskPartition(devs[0]);
559 }
560 else
561 devs[0]->enabled = FALSE;
565 return DITEM_SUCCESS | DITEM_RESTORE;
562 return DITEM_SUCCESS;
566}
567
568static int
569partitionCheck(dialogMenuItem *selected)
570{
571 Device **devs = NULL;
572
573 devs = deviceFind(selected->prompt, DEVICE_TYPE_DISK);

--- 47 unchanged lines hidden (view full) ---

621 "[Scroll Lock] key and using the Arrow keys to move back to\n"
622 "the boot messages. Press [Scroll Lock] again to return.");
623 return DITEM_FAILURE;
624 }
625 else {
626 i = dmenuOpenSimple(menu, FALSE) ? DITEM_SUCCESS : DITEM_FAILURE;
627 free(menu);
628 }
563}
564
565static int
566partitionCheck(dialogMenuItem *selected)
567{
568 Device **devs = NULL;
569
570 devs = deviceFind(selected->prompt, DEVICE_TYPE_DISK);

--- 47 unchanged lines hidden (view full) ---

618 "[Scroll Lock] key and using the Arrow keys to move back to\n"
619 "the boot messages. Press [Scroll Lock] again to return.");
620 return DITEM_FAILURE;
621 }
622 else {
623 i = dmenuOpenSimple(menu, FALSE) ? DITEM_SUCCESS : DITEM_FAILURE;
624 free(menu);
625 }
629 return i | DITEM_RESTORE;
626 return i;
630 }
631 }
632 return DITEM_SUCCESS;
633}
634
635int
636diskPartitionWrite(dialogMenuItem *self)
637{

--- 73 unchanged lines hidden (view full) ---

711 if (chunk_info[i]->type == unused && chunk_info[i]->size > (10 * ONE_MEG)) {
712 Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size, freebsd, 3,
713 (chunk_info[i]->flags & CHUNK_ALIGN));
714 variable_set2(DISK_PARTITIONED, "yes", 0);
715 break;
716 }
717 }
718 if (!chunk_info[i]) {
627 }
628 }
629 return DITEM_SUCCESS;
630}
631
632int
633diskPartitionWrite(dialogMenuItem *self)
634{

--- 73 unchanged lines hidden (view full) ---

708 if (chunk_info[i]->type == unused && chunk_info[i]->size > (10 * ONE_MEG)) {
709 Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size, freebsd, 3,
710 (chunk_info[i]->flags & CHUNK_ALIGN));
711 variable_set2(DISK_PARTITIONED, "yes", 0);
712 break;
713 }
714 }
715 if (!chunk_info[i]) {
719 dialog_clear();
720 msgConfirm("Unable to find any free space on this disk!");
721 return;
722 }
723 }
724 else if (!strcmp(cp, "all")) {
725 /* Do all disk space case */
726 msgDebug("Warning: Devoting all of disk %s to FreeBSD.\n", d->name);
727

--- 13 unchanged lines hidden (view full) ---

741 /* If a chunk is at least sz MB, use it. */
742 if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) {
743 Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3, (chunk_info[i]->flags & CHUNK_ALIGN));
744 variable_set2(DISK_PARTITIONED, "yes", 0);
745 break;
746 }
747 }
748 if (!chunk_info[i]) {
716 msgConfirm("Unable to find any free space on this disk!");
717 return;
718 }
719 }
720 else if (!strcmp(cp, "all")) {
721 /* Do all disk space case */
722 msgDebug("Warning: Devoting all of disk %s to FreeBSD.\n", d->name);
723

--- 13 unchanged lines hidden (view full) ---

737 /* If a chunk is at least sz MB, use it. */
738 if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) {
739 Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3, (chunk_info[i]->flags & CHUNK_ALIGN));
740 variable_set2(DISK_PARTITIONED, "yes", 0);
741 break;
742 }
743 }
744 if (!chunk_info[i]) {
749 dialog_clear();
750 msgConfirm("Unable to find %d free blocks on this disk!", sz);
751 return;
752 }
753 }
754 else if (!strcmp(cp, "existing")) {
755 /* Do existing FreeBSD case */
756 for (i = 0; chunk_info[i]; i++) {
757 if (chunk_info[i]->type == freebsd)
758 break;
759 }
760 if (!chunk_info[i]) {
745 msgConfirm("Unable to find %d free blocks on this disk!", sz);
746 return;
747 }
748 }
749 else if (!strcmp(cp, "existing")) {
750 /* Do existing FreeBSD case */
751 for (i = 0; chunk_info[i]; i++) {
752 if (chunk_info[i]->type == freebsd)
753 break;
754 }
755 if (!chunk_info[i]) {
761 dialog_clear();
762 msgConfirm("Unable to find any existing FreeBSD partitions on this disk!");
763 return;
764 }
765 }
766 else {
756 msgConfirm("Unable to find any existing FreeBSD partitions on this disk!");
757 return;
758 }
759 }
760 else {
767 dialog_clear();
768 msgConfirm("`%s' is an invalid value for %s - is config file valid?", cp, VAR_PARTITION);
769 return;
770 }
771 if (!all_disk) {
772 mbrContents = getBootMgr(d->name);
773 Set_Boot_Mgr(d, mbrContents);
774 }
775 variable_set2(DISK_PARTITIONED, "yes", 0);
776 }
777}
761 msgConfirm("`%s' is an invalid value for %s - is config file valid?", cp, VAR_PARTITION);
762 return;
763 }
764 if (!all_disk) {
765 mbrContents = getBootMgr(d->name);
766 Set_Boot_Mgr(d, mbrContents);
767 }
768 variable_set2(DISK_PARTITIONED, "yes", 0);
769 }
770}