From eec2e4bdded25406022b702bd7ef410d01b7cdb5 Mon Sep 17 00:00:00 2001 From: "David E. O'Brien" Date: Fri, 11 Oct 2002 22:30:09 +0000 Subject: [PATCH] * Negative #if's are harder to read as they don't tell exactly what arch something applies to. So change #ifndef to an explicit list of defines. * Treate sparc64 and ia64 as 64-bit platforms, which means larger roots. * sparc64 should halt back to the firmware, not reset. * sparc64 doesn't need to play MS-DOS/BIOS partition crap games. Reviewed by: jake --- usr.sbin/sade/disks.c | 14 +++++++------- usr.sbin/sade/install.c | 14 +++++++------- usr.sbin/sade/label.c | 10 +++++----- usr.sbin/sade/main.c | 2 +- usr.sbin/sade/menus.c | 13 ++++++++----- usr.sbin/sade/system.c | 2 +- usr.sbin/sysinstall/cdrom.c | 2 ++ usr.sbin/sysinstall/disks.c | 14 +++++++------- usr.sbin/sysinstall/install.c | 14 +++++++------- usr.sbin/sysinstall/label.c | 10 +++++----- usr.sbin/sysinstall/main.c | 2 +- usr.sbin/sysinstall/menus.c | 13 ++++++++----- usr.sbin/sysinstall/system.c | 2 +- 13 files changed, 60 insertions(+), 52 deletions(-) diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c index 59f2ad2917e..992512b203c 100644 --- a/usr.sbin/sade/disks.c +++ b/usr.sbin/sade/disks.c @@ -368,7 +368,7 @@ diskPartition(Device *dev) case 'A': case 'F': /* Undocumented magic Dangerously Dedicated mode */ -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) rv = 1; #else /* The rest is only relevant on x86 */ cp = variable_get(VAR_DEDICATE_DISK); @@ -442,7 +442,7 @@ diskPartition(Device *dev) partitiontype = fat; else partitiontype = unknown; -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) if (partitiontype == freebsd && size == chunk_info[current_chunk]->size) All_FreeBSD(d, 1); else @@ -816,20 +816,20 @@ diskPartitionWrite(dialogMenuItem *self) for (i = 0; devs[i]; i++) { Disk *d = (Disk *)devs[i]->private; static u_char *boot1; -#ifndef __alpha__ +#if defined(__i386__) || defined(__ia64__) static u_char *boot2; #endif if (!devs[i]->enabled) continue; -#ifdef __alpha__ - if (!boot1) boot1 = bootalloc("boot1", NULL); - Set_Boot_Blocks(d, boot1, NULL); -#else +#if defined(__i386__) || defined(__ia64__) if (!boot1) boot1 = bootalloc("boot1", NULL); if (!boot2) boot2 = bootalloc("boot2", NULL); Set_Boot_Blocks(d, boot1, boot2); +#else + if (!boot1) boot1 = bootalloc("boot1", NULL); + Set_Boot_Blocks(d, boot1, NULL); #endif msgNotify("Writing partition information to drive %s", d->name); diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index 9ab38a4ec00..8cfc9552d03 100644 --- a/usr.sbin/sade/install.c +++ b/usr.sbin/sade/install.c @@ -518,7 +518,7 @@ installExpress(dialogMenuItem *self) dialog_clear_norefresh(); variable_set2(SYSTEM_STATE, "express", 0); -#ifndef __alpha__ +#if defined(__i386__) || defined(__ia64__) if (DITEM_STATUS((i = diskPartitionEditor(self))) == DITEM_FAILURE) return i; #endif @@ -546,7 +546,7 @@ installStandard(dialogMenuItem *self) variable_set2(SYSTEM_STATE, "standard", 0); dialog_clear_norefresh(); -#ifndef __alpha__ +#if defined(__i386__) || defined(__ia64__) msgConfirm("In the next menu, you will need to set up a DOS-style (\"fdisk\") partitioning\n" "scheme for your hard disk. If you simply wish to devote all disk space\n" "to FreeBSD (overwriting anything else that might be on the disk(s) selected)\n" @@ -566,16 +566,16 @@ nodisks: } #endif -#ifdef __alpha__ - msgConfirm("Now you need to create BSD partitions on the disk which you are\n" - "installing to. If you have a reasonable amount of disk space (200MB or more)\n" +#if defined(__i386__) || defined(__ia64__) + msgConfirm("Now you need to create BSD partitions inside of the fdisk partition(s)\n" + "just created. If you have a reasonable amount of disk space (200MB or more)\n" "and don't have any special requirements, simply use the (A)uto command to\n" "allocate space automatically. If you have more specific needs or just don't\n" "care for the layout chosen by (A)uto, press F1 for more information on\n" "manual layout."); #else - msgConfirm("Now you need to create BSD partitions inside of the fdisk partition(s)\n" - "just created. If you have a reasonable amount of disk space (200MB or more)\n" + msgConfirm("Now you need to create BSD partitions on the disk which you are\n" + "installing to. If you have a reasonable amount of disk space (200MB or more)\n" "and don't have any special requirements, simply use the (A)uto command to\n" "allocate space automatically. If you have more specific needs or just don't\n" "care for the layout chosen by (A)uto, press F1 for more information on\n" diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c index f40f3aef3c6..bf4518dcbf2 100644 --- a/usr.sbin/sade/label.c +++ b/usr.sbin/sade/label.c @@ -59,7 +59,7 @@ /* * Minimum partition sizes */ -#ifdef __alpha__ +#if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__) #define ROOT_MIN_SIZE 40 #else #define ROOT_MIN_SIZE 30 @@ -679,7 +679,7 @@ clear_wins(void) print_label_chunks(); } -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) /* * If there isn't a freebsd chunk already (i.e. there is no label), @@ -712,7 +712,7 @@ diskLabel(Device *dev) PartInfo *p, *oldp; PartType type; Device **devs; -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) int i; #endif WINDOW *w = savescr(); @@ -729,7 +729,7 @@ diskLabel(Device *dev) } labeling = TRUE; keypad(stdscr, TRUE); -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) for (i = 0; devs[i]; i++) { maybe_dedicate((Disk*) devs[i]->private); } @@ -1381,7 +1381,7 @@ diskLabelNonInteractive(Device *dev) d = dev->private; else d = devs[0]->private; -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) maybe_dedicate(d); #endif record_label_chunks(devs, dev); diff --git a/usr.sbin/sade/main.c b/usr.sbin/sade/main.c index 144a61735de..b9ac365793b 100644 --- a/usr.sbin/sade/main.c +++ b/usr.sbin/sade/main.c @@ -162,7 +162,7 @@ main(int argc, char **argv) choice = scroll = curr = max = 0; dmenuOpen(&MenuInitial, &choice, &scroll, &curr, &max, TRUE); if (getpid() != 1 -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) || !msgNoYes("Are you sure you wish to exit? The system will halt.") #else || !msgNoYes("Are you sure you wish to exit? The system will reboot\n" diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c index 6bd7d9fb4ab..7b5bd1561d6 100644 --- a/usr.sbin/sade/menus.c +++ b/usr.sbin/sade/menus.c @@ -1182,7 +1182,7 @@ DMenu MenuInstallCustom = { "INSTALL", { { "X Exit", "Exit this menu (returning to previous)", NULL, dmenuExit }, { "2 Options", "View/Set various installation options", NULL, optionsEditor }, -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) { "3 Label", "Label disk partitions", NULL, diskLabelEditor }, { "4 Distributions", "Select distribution(s) to extract", NULL, dmenuSubmenu, NULL, &MenuDistributions }, { "5 Media", "Choose the installation media type", NULL, dmenuSubmenu, NULL, &MenuMedia }, @@ -1320,14 +1320,17 @@ DMenu MenuStartup = { dmenuVarCheck, dmenuToggleVariable, NULL, "accounting_enable=YES" }, { " lpd", "This host has a printer and wants to run lpd.", dmenuVarCheck, dmenuToggleVariable, NULL, "lpd_enable=YES" }, -#ifdef __i386__ { " linux", "This host wants to be able to run linux binaries.", dmenuVarCheck, configLinux, NULL, VAR_LINUX_ENABLE "=YES" }, - { " SVR4", "This host wants to be able to run SVR4 binaries.", - dmenuVarCheck, dmenuToggleVariable, NULL, "svr4_enable=YES" }, +#ifdef __i386__ { " SCO", "This host wants to be able to run IBCS2 binaries.", dmenuVarCheck, dmenuToggleVariable, NULL, "ibcs2_enable=YES" }, -#elif __alpha__ +#endif +#if defined(__i386__) || defined(__sparc64__) + { " SVR4", "This host wants to be able to run SVR4 binaries.", + dmenuVarCheck, dmenuToggleVariable, NULL, "svr4_enable=YES" }, +#endif +#ifdef __alpha__ { " OSF/1", "This host wants to be able to run DEC OSF/1 binaries.", dmenuVarCheck, dmenuToggleVariable, NULL, "osf1_enable=YES" }, #endif diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c index 07fc2b0adf2..25ab8b1f613 100644 --- a/usr.sbin/sade/system.c +++ b/usr.sbin/sade/system.c @@ -253,7 +253,7 @@ systemShutdown(int status) if (RunningAsInit) { /* Put the console back */ ioctl(0, VT_ACTIVATE, 2); -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) reboot(RB_HALT); #else reboot(0); diff --git a/usr.sbin/sysinstall/cdrom.c b/usr.sbin/sysinstall/cdrom.c index 3b55be7b2ab..d6fd7b88de5 100644 --- a/usr.sbin/sysinstall/cdrom.c +++ b/usr.sbin/sysinstall/cdrom.c @@ -155,6 +155,8 @@ mediaInitCDROM(Device *dev) if (strcmp(cp, "any") && #ifdef __alpha__ strcmp(cp, "alpha")) { +#elif defined(__sparc64__) + strcmp(cp, "sparc64")) { #else strcmp(cp, "x86")) { #endif diff --git a/usr.sbin/sysinstall/disks.c b/usr.sbin/sysinstall/disks.c index 59f2ad2917e..992512b203c 100644 --- a/usr.sbin/sysinstall/disks.c +++ b/usr.sbin/sysinstall/disks.c @@ -368,7 +368,7 @@ diskPartition(Device *dev) case 'A': case 'F': /* Undocumented magic Dangerously Dedicated mode */ -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) rv = 1; #else /* The rest is only relevant on x86 */ cp = variable_get(VAR_DEDICATE_DISK); @@ -442,7 +442,7 @@ diskPartition(Device *dev) partitiontype = fat; else partitiontype = unknown; -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) if (partitiontype == freebsd && size == chunk_info[current_chunk]->size) All_FreeBSD(d, 1); else @@ -816,20 +816,20 @@ diskPartitionWrite(dialogMenuItem *self) for (i = 0; devs[i]; i++) { Disk *d = (Disk *)devs[i]->private; static u_char *boot1; -#ifndef __alpha__ +#if defined(__i386__) || defined(__ia64__) static u_char *boot2; #endif if (!devs[i]->enabled) continue; -#ifdef __alpha__ - if (!boot1) boot1 = bootalloc("boot1", NULL); - Set_Boot_Blocks(d, boot1, NULL); -#else +#if defined(__i386__) || defined(__ia64__) if (!boot1) boot1 = bootalloc("boot1", NULL); if (!boot2) boot2 = bootalloc("boot2", NULL); Set_Boot_Blocks(d, boot1, boot2); +#else + if (!boot1) boot1 = bootalloc("boot1", NULL); + Set_Boot_Blocks(d, boot1, NULL); #endif msgNotify("Writing partition information to drive %s", d->name); diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c index 9ab38a4ec00..8cfc9552d03 100644 --- a/usr.sbin/sysinstall/install.c +++ b/usr.sbin/sysinstall/install.c @@ -518,7 +518,7 @@ installExpress(dialogMenuItem *self) dialog_clear_norefresh(); variable_set2(SYSTEM_STATE, "express", 0); -#ifndef __alpha__ +#if defined(__i386__) || defined(__ia64__) if (DITEM_STATUS((i = diskPartitionEditor(self))) == DITEM_FAILURE) return i; #endif @@ -546,7 +546,7 @@ installStandard(dialogMenuItem *self) variable_set2(SYSTEM_STATE, "standard", 0); dialog_clear_norefresh(); -#ifndef __alpha__ +#if defined(__i386__) || defined(__ia64__) msgConfirm("In the next menu, you will need to set up a DOS-style (\"fdisk\") partitioning\n" "scheme for your hard disk. If you simply wish to devote all disk space\n" "to FreeBSD (overwriting anything else that might be on the disk(s) selected)\n" @@ -566,16 +566,16 @@ nodisks: } #endif -#ifdef __alpha__ - msgConfirm("Now you need to create BSD partitions on the disk which you are\n" - "installing to. If you have a reasonable amount of disk space (200MB or more)\n" +#if defined(__i386__) || defined(__ia64__) + msgConfirm("Now you need to create BSD partitions inside of the fdisk partition(s)\n" + "just created. If you have a reasonable amount of disk space (200MB or more)\n" "and don't have any special requirements, simply use the (A)uto command to\n" "allocate space automatically. If you have more specific needs or just don't\n" "care for the layout chosen by (A)uto, press F1 for more information on\n" "manual layout."); #else - msgConfirm("Now you need to create BSD partitions inside of the fdisk partition(s)\n" - "just created. If you have a reasonable amount of disk space (200MB or more)\n" + msgConfirm("Now you need to create BSD partitions on the disk which you are\n" + "installing to. If you have a reasonable amount of disk space (200MB or more)\n" "and don't have any special requirements, simply use the (A)uto command to\n" "allocate space automatically. If you have more specific needs or just don't\n" "care for the layout chosen by (A)uto, press F1 for more information on\n" diff --git a/usr.sbin/sysinstall/label.c b/usr.sbin/sysinstall/label.c index f40f3aef3c6..bf4518dcbf2 100644 --- a/usr.sbin/sysinstall/label.c +++ b/usr.sbin/sysinstall/label.c @@ -59,7 +59,7 @@ /* * Minimum partition sizes */ -#ifdef __alpha__ +#if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__) #define ROOT_MIN_SIZE 40 #else #define ROOT_MIN_SIZE 30 @@ -679,7 +679,7 @@ clear_wins(void) print_label_chunks(); } -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) /* * If there isn't a freebsd chunk already (i.e. there is no label), @@ -712,7 +712,7 @@ diskLabel(Device *dev) PartInfo *p, *oldp; PartType type; Device **devs; -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) int i; #endif WINDOW *w = savescr(); @@ -729,7 +729,7 @@ diskLabel(Device *dev) } labeling = TRUE; keypad(stdscr, TRUE); -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) for (i = 0; devs[i]; i++) { maybe_dedicate((Disk*) devs[i]->private); } @@ -1381,7 +1381,7 @@ diskLabelNonInteractive(Device *dev) d = dev->private; else d = devs[0]->private; -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) maybe_dedicate(d); #endif record_label_chunks(devs, dev); diff --git a/usr.sbin/sysinstall/main.c b/usr.sbin/sysinstall/main.c index 144a61735de..b9ac365793b 100644 --- a/usr.sbin/sysinstall/main.c +++ b/usr.sbin/sysinstall/main.c @@ -162,7 +162,7 @@ main(int argc, char **argv) choice = scroll = curr = max = 0; dmenuOpen(&MenuInitial, &choice, &scroll, &curr, &max, TRUE); if (getpid() != 1 -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) || !msgNoYes("Are you sure you wish to exit? The system will halt.") #else || !msgNoYes("Are you sure you wish to exit? The system will reboot\n" diff --git a/usr.sbin/sysinstall/menus.c b/usr.sbin/sysinstall/menus.c index 6bd7d9fb4ab..7b5bd1561d6 100644 --- a/usr.sbin/sysinstall/menus.c +++ b/usr.sbin/sysinstall/menus.c @@ -1182,7 +1182,7 @@ DMenu MenuInstallCustom = { "INSTALL", { { "X Exit", "Exit this menu (returning to previous)", NULL, dmenuExit }, { "2 Options", "View/Set various installation options", NULL, optionsEditor }, -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) { "3 Label", "Label disk partitions", NULL, diskLabelEditor }, { "4 Distributions", "Select distribution(s) to extract", NULL, dmenuSubmenu, NULL, &MenuDistributions }, { "5 Media", "Choose the installation media type", NULL, dmenuSubmenu, NULL, &MenuMedia }, @@ -1320,14 +1320,17 @@ DMenu MenuStartup = { dmenuVarCheck, dmenuToggleVariable, NULL, "accounting_enable=YES" }, { " lpd", "This host has a printer and wants to run lpd.", dmenuVarCheck, dmenuToggleVariable, NULL, "lpd_enable=YES" }, -#ifdef __i386__ { " linux", "This host wants to be able to run linux binaries.", dmenuVarCheck, configLinux, NULL, VAR_LINUX_ENABLE "=YES" }, - { " SVR4", "This host wants to be able to run SVR4 binaries.", - dmenuVarCheck, dmenuToggleVariable, NULL, "svr4_enable=YES" }, +#ifdef __i386__ { " SCO", "This host wants to be able to run IBCS2 binaries.", dmenuVarCheck, dmenuToggleVariable, NULL, "ibcs2_enable=YES" }, -#elif __alpha__ +#endif +#if defined(__i386__) || defined(__sparc64__) + { " SVR4", "This host wants to be able to run SVR4 binaries.", + dmenuVarCheck, dmenuToggleVariable, NULL, "svr4_enable=YES" }, +#endif +#ifdef __alpha__ { " OSF/1", "This host wants to be able to run DEC OSF/1 binaries.", dmenuVarCheck, dmenuToggleVariable, NULL, "osf1_enable=YES" }, #endif diff --git a/usr.sbin/sysinstall/system.c b/usr.sbin/sysinstall/system.c index 07fc2b0adf2..25ab8b1f613 100644 --- a/usr.sbin/sysinstall/system.c +++ b/usr.sbin/sysinstall/system.c @@ -253,7 +253,7 @@ systemShutdown(int status) if (RunningAsInit) { /* Put the console back */ ioctl(0, VT_ACTIVATE, 2); -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc64__) reboot(RB_HALT); #else reboot(0);