Make the save_userconfig() stuff conditional and turned off by default

(for now - still a few more wrinkles here).  Add more debugging code
and some cosmetic tweaks.
This commit is contained in:
jkh 1996-10-05 16:33:05 +00:00
parent ddcbad03d0
commit 8583f8a2a2
9 changed files with 106 additions and 108 deletions

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: install.c,v 1.128 1996/10/04 14:53:50 jkh Exp $
* $Id: install.c,v 1.129 1996/10/05 10:43:47 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -51,7 +51,9 @@
#include <sys/mount.h>
static void create_termcap(void);
#ifdef SAVE_USERCONFIG
static void save_userconfig_to_kernel(char *);
#endif
#define TERMCAP_FILE "/usr/share/misc/termcap"
@ -594,10 +596,10 @@ installFixup(dialogMenuItem *self)
if (!file_readable("/kernel")) {
if (file_readable("/kernel.GENERIC")) {
#ifdef SAVE_USERCONFIG
/* Snapshot any boot -c changes back to the GENERIC kernel */
save_userconfig_to_kernel("/kernel.GENERIC");
dialog_clear();
#endif
if (vsystem("cp -p /kernel.GENERIC /kernel")) {
msgConfirm("Unable to link /kernel into place!");
return DITEM_FAILURE;
@ -680,7 +682,7 @@ installFilesystems(dialogMenuItem *self)
Boolean upgrade = FALSE;
/* If we've already done this, bail out */
if (variable_get(DISK_PREPARED))
if ((str = variable_get(DISK_LABELLED)) && !strcmp(str, "written"))
return DITEM_SUCCESS;
str = variable_get(SYSTEM_STATE);
@ -823,7 +825,6 @@ installFilesystems(dialogMenuItem *self)
command_sort();
command_execute();
variable_set2(DISK_PREPARED, "yes");
return DITEM_SUCCESS;
}
@ -901,49 +902,48 @@ create_termcap(void)
}
}
static char *isa_list[] = {
"device",
"ioport",
"irq",
"drq",
"iomem",
"iosize",
"flags",
"alive",
"enabled",
};
static void
save_userconfig_to_kernel(char *kern)
{
struct kernel *core, *boot;
struct list *c_isa, *c_dev, *b_dev;
struct list *c_isa, *b_isa, *c_dev, *b_dev;
int i, d;
if ((core = uc_open("-incore")) == NULL) {
msgDebug("Can't read in-core information for kernel.\n");
msgDebug("save_userconf: Can't read in-core information for kernel.\n");
return;
}
if ((boot = uc_open(kern)) == NULL) {
msgDebug("Can't read device information for kernel image %s\n", kern);
msgDebug("save_userconf: Can't read device information for kernel image %s\n", kern);
return;
}
msgNotify("Saving any boot -c changes to new kernel...");
c_isa = uc_getdev(core, "-isa");
b_isa = uc_getdev(boot, "-isa");
if (isDebug())
msgDebug("save_userconf: got %d ISA device entries from core, %d from boot.\n", c_isa->ac, b_isa->ac);
for (d = 0; d < c_isa->ac; d++) {
if (isDebug())
msgDebug("Outer loop, c_isa->av[%d] = %s\n", d, c_isa->av[d]);
if (strcmp(c_isa->av[d], "npx0")) { /* special case npx0, which
mucks with its id_irq member */
msgDebug("save_userconf: ISA device loop, c_isa->av[%d] = %s\n", d, c_isa->av[d]);
if (strcmp(c_isa->av[d], "npx0")) { /* special case npx0, which mucks with its id_irq member */
c_dev = uc_getdev(core, c_isa->av[d]);
b_dev = uc_getdev(boot, c_isa->av[d]);
b_dev = uc_getdev(boot, b_isa->av[d]);
if (!c_dev || !b_dev) {
msgDebug("save_userconf: c_dev: %x b_dev: %x\n", c_dev, b_dev);
continue;
}
if (isDebug())
msgDebug("save_userconf: ISA device %s: %d config parameters (core), %d (boot)\n",
c_isa->av[d], c_dev->ac, b_dev->ac);
for (i = 0; i < c_dev->ac; i++) {
if (isDebug())
msgDebug("Inner loop, c_dev->av[%d] = %s\n", i, c_dev->av[i]);
msgDebug("save_userconf: c_dev->av[%d] = %s, b_dev->av[%d] = %s\n", i, c_dev->av[i], i, b_dev->av[i]);
if (strcmp(c_dev->av[i], b_dev->av[i])) {
if (isDebug())
msgDebug("%s %s changed: %s (boot) -> %s (core)\n",
c_dev->av[0], isa_list[i], b_dev->av[i], c_dev->av[i]);
msgDebug("save_userconf: %s (boot) -> %s (core)\n",
c_dev->av[i], b_dev->av[i]);
isa_setdev(boot, c_dev);
}
}

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: sysinstall.h,v 1.79 1996/10/01 12:13:25 jkh Exp $
* $Id: sysinstall.h,v 1.80 1996/10/04 13:33:44 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -74,7 +74,6 @@
#define DISK_PARTITIONED "_diskPartitioned"
#define DISK_LABELLED "_diskLabelled"
#define DISK_SELECTED "_diskSelected"
#define DISK_PREPARED "_diskPrepared"
#define SYSTEM_STATE "_systemState"
#define RUNNING_ON_ROOT "_runningOnRoot"
#define TCP_CONFIGURED "_tcpConfigured"

View File

@ -1,5 +1,5 @@
/*
* $Id: tcpip.c,v 1.46 1996/09/01 08:17:14 jkh Exp $
* $Id: tcpip.c,v 1.47 1996/10/05 12:16:49 jkh Exp $
*
* Copyright (c) 1995
* Gary J Palmer. All rights reserved.
@ -249,8 +249,7 @@ tcpOpenDialog(Device *devp)
msgFatal("Cannot open TCP/IP dialog window!!");
/* Say where our help comes from */
systemHelpFile(TCP_HELPFILE, help);
use_helpfile(help);
use_helpfile(systemHelpFile(TCP_HELPFILE, help));
/* Setup a nice screen for us to splat stuff onto */
draw_box(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X, TCP_DIALOG_HEIGHT, TCP_DIALOG_WIDTH, dialog_attr, border_attr);

View File

@ -24,7 +24,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* library functions for userconfig library
*
* $Id: uc_main.c,v 1.8 1996/10/05 11:56:50 jkh Exp $
* $Id: uc_main.c,v 1.9 1996/10/05 13:30:43 jkh Exp $
*/
#include <sys/types.h>
@ -79,10 +79,9 @@ uc_open(char *name){
strncpy(kname, getbootfile(), 79);
else
strncpy(kname, name, 79);
if (isDebug())
msgDebug("uc_open: kernel name is %s, incore = %d\n", kname, incore);
kern = (struct kernel *)malloc(sizeof(struct kernel));
#ifdef KERN_NO_SYMBOLS
@ -103,23 +102,29 @@ uc_open(char *name){
nl = (struct nlist *)malloc((size + 1) * sizeof(struct nlist));
for (i = 0; i < size; i++) {
char name[255];
int c1;
unsigned int uc1;
short d1;
unsigned long v1;
if (fgets(name, 255, fp) == NULL) {
msgDebug("Unable to read symbol name from symbol file.\n");
free(kern);
return NULL;
if (fscanf(fp, "%s %u %d %hd %ld\n", name, &uc1, &c1, &d1, &v1) == 5) {
nl[i].n_name = strdup(name);
nl[i].n_type = (unsigned char)uc1;
nl[i].n_other = (char)c1;
nl[i].n_desc = d1;
nl[i].n_value = v1;
if (isDebug())
msgDebug("Entry %d, decoded: \"%s\", %d %d %hd %ld\n", i, nl[i].n_name, nl[i].n_type, nl[i].n_other, nl[i].n_desc, nl[i].n_value);
}
if (name[0] == '\n')
name[0] = '\0';
nl[i].n_name = strdup(name);
if (fscanf(fp, "%d %d %d %ld\n",
&(nl[i].n_type), &(nl[i].n_other), &(nl[i].n_desc), &(nl[i].n_value)) != 4) {
else {
nl[i].n_name = "";
nl[i].n_type = 0;
nl[i].n_other = 0;
nl[i].n_desc = 0;
nl[i].n_value = 0;
}
}
nl[i].n_name = NULL;
fclose(fp);
kern->nl = nl;
i = 0;
@ -148,7 +153,6 @@ uc_open(char *name){
msgDebug("uc_open: Unable to open /dev/kmem.\n");
return kern;
}
kern->core = (caddr_t)NULL;
kern->incore = 1;
kern->size = 0;
@ -194,9 +198,8 @@ uc_open(char *name){
return kern;
}
}
kern->fd = kd;
if (isDebug())
msgDebug("uc_open: getting isa information\n");
get_isa_info(kern);

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: install.c,v 1.128 1996/10/04 14:53:50 jkh Exp $
* $Id: install.c,v 1.129 1996/10/05 10:43:47 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -51,7 +51,9 @@
#include <sys/mount.h>
static void create_termcap(void);
#ifdef SAVE_USERCONFIG
static void save_userconfig_to_kernel(char *);
#endif
#define TERMCAP_FILE "/usr/share/misc/termcap"
@ -594,10 +596,10 @@ installFixup(dialogMenuItem *self)
if (!file_readable("/kernel")) {
if (file_readable("/kernel.GENERIC")) {
#ifdef SAVE_USERCONFIG
/* Snapshot any boot -c changes back to the GENERIC kernel */
save_userconfig_to_kernel("/kernel.GENERIC");
dialog_clear();
#endif
if (vsystem("cp -p /kernel.GENERIC /kernel")) {
msgConfirm("Unable to link /kernel into place!");
return DITEM_FAILURE;
@ -680,7 +682,7 @@ installFilesystems(dialogMenuItem *self)
Boolean upgrade = FALSE;
/* If we've already done this, bail out */
if (variable_get(DISK_PREPARED))
if ((str = variable_get(DISK_LABELLED)) && !strcmp(str, "written"))
return DITEM_SUCCESS;
str = variable_get(SYSTEM_STATE);
@ -823,7 +825,6 @@ installFilesystems(dialogMenuItem *self)
command_sort();
command_execute();
variable_set2(DISK_PREPARED, "yes");
return DITEM_SUCCESS;
}
@ -901,49 +902,48 @@ create_termcap(void)
}
}
static char *isa_list[] = {
"device",
"ioport",
"irq",
"drq",
"iomem",
"iosize",
"flags",
"alive",
"enabled",
};
static void
save_userconfig_to_kernel(char *kern)
{
struct kernel *core, *boot;
struct list *c_isa, *c_dev, *b_dev;
struct list *c_isa, *b_isa, *c_dev, *b_dev;
int i, d;
if ((core = uc_open("-incore")) == NULL) {
msgDebug("Can't read in-core information for kernel.\n");
msgDebug("save_userconf: Can't read in-core information for kernel.\n");
return;
}
if ((boot = uc_open(kern)) == NULL) {
msgDebug("Can't read device information for kernel image %s\n", kern);
msgDebug("save_userconf: Can't read device information for kernel image %s\n", kern);
return;
}
msgNotify("Saving any boot -c changes to new kernel...");
c_isa = uc_getdev(core, "-isa");
b_isa = uc_getdev(boot, "-isa");
if (isDebug())
msgDebug("save_userconf: got %d ISA device entries from core, %d from boot.\n", c_isa->ac, b_isa->ac);
for (d = 0; d < c_isa->ac; d++) {
if (isDebug())
msgDebug("Outer loop, c_isa->av[%d] = %s\n", d, c_isa->av[d]);
if (strcmp(c_isa->av[d], "npx0")) { /* special case npx0, which
mucks with its id_irq member */
msgDebug("save_userconf: ISA device loop, c_isa->av[%d] = %s\n", d, c_isa->av[d]);
if (strcmp(c_isa->av[d], "npx0")) { /* special case npx0, which mucks with its id_irq member */
c_dev = uc_getdev(core, c_isa->av[d]);
b_dev = uc_getdev(boot, c_isa->av[d]);
b_dev = uc_getdev(boot, b_isa->av[d]);
if (!c_dev || !b_dev) {
msgDebug("save_userconf: c_dev: %x b_dev: %x\n", c_dev, b_dev);
continue;
}
if (isDebug())
msgDebug("save_userconf: ISA device %s: %d config parameters (core), %d (boot)\n",
c_isa->av[d], c_dev->ac, b_dev->ac);
for (i = 0; i < c_dev->ac; i++) {
if (isDebug())
msgDebug("Inner loop, c_dev->av[%d] = %s\n", i, c_dev->av[i]);
msgDebug("save_userconf: c_dev->av[%d] = %s, b_dev->av[%d] = %s\n", i, c_dev->av[i], i, b_dev->av[i]);
if (strcmp(c_dev->av[i], b_dev->av[i])) {
if (isDebug())
msgDebug("%s %s changed: %s (boot) -> %s (core)\n",
c_dev->av[0], isa_list[i], b_dev->av[i], c_dev->av[i]);
msgDebug("save_userconf: %s (boot) -> %s (core)\n",
c_dev->av[i], b_dev->av[i]);
isa_setdev(boot, c_dev);
}
}

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: sysinstall.h,v 1.79 1996/10/01 12:13:25 jkh Exp $
* $Id: sysinstall.h,v 1.80 1996/10/04 13:33:44 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -74,7 +74,6 @@
#define DISK_PARTITIONED "_diskPartitioned"
#define DISK_LABELLED "_diskLabelled"
#define DISK_SELECTED "_diskSelected"
#define DISK_PREPARED "_diskPrepared"
#define SYSTEM_STATE "_systemState"
#define RUNNING_ON_ROOT "_runningOnRoot"
#define TCP_CONFIGURED "_tcpConfigured"

View File

@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
* $Id: install.c,v 1.128 1996/10/04 14:53:50 jkh Exp $
* $Id: install.c,v 1.129 1996/10/05 10:43:47 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -51,7 +51,9 @@
#include <sys/mount.h>
static void create_termcap(void);
#ifdef SAVE_USERCONFIG
static void save_userconfig_to_kernel(char *);
#endif
#define TERMCAP_FILE "/usr/share/misc/termcap"
@ -594,10 +596,10 @@ installFixup(dialogMenuItem *self)
if (!file_readable("/kernel")) {
if (file_readable("/kernel.GENERIC")) {
#ifdef SAVE_USERCONFIG
/* Snapshot any boot -c changes back to the GENERIC kernel */
save_userconfig_to_kernel("/kernel.GENERIC");
dialog_clear();
#endif
if (vsystem("cp -p /kernel.GENERIC /kernel")) {
msgConfirm("Unable to link /kernel into place!");
return DITEM_FAILURE;
@ -680,7 +682,7 @@ installFilesystems(dialogMenuItem *self)
Boolean upgrade = FALSE;
/* If we've already done this, bail out */
if (variable_get(DISK_PREPARED))
if ((str = variable_get(DISK_LABELLED)) && !strcmp(str, "written"))
return DITEM_SUCCESS;
str = variable_get(SYSTEM_STATE);
@ -823,7 +825,6 @@ installFilesystems(dialogMenuItem *self)
command_sort();
command_execute();
variable_set2(DISK_PREPARED, "yes");
return DITEM_SUCCESS;
}
@ -901,49 +902,48 @@ create_termcap(void)
}
}
static char *isa_list[] = {
"device",
"ioport",
"irq",
"drq",
"iomem",
"iosize",
"flags",
"alive",
"enabled",
};
static void
save_userconfig_to_kernel(char *kern)
{
struct kernel *core, *boot;
struct list *c_isa, *c_dev, *b_dev;
struct list *c_isa, *b_isa, *c_dev, *b_dev;
int i, d;
if ((core = uc_open("-incore")) == NULL) {
msgDebug("Can't read in-core information for kernel.\n");
msgDebug("save_userconf: Can't read in-core information for kernel.\n");
return;
}
if ((boot = uc_open(kern)) == NULL) {
msgDebug("Can't read device information for kernel image %s\n", kern);
msgDebug("save_userconf: Can't read device information for kernel image %s\n", kern);
return;
}
msgNotify("Saving any boot -c changes to new kernel...");
c_isa = uc_getdev(core, "-isa");
b_isa = uc_getdev(boot, "-isa");
if (isDebug())
msgDebug("save_userconf: got %d ISA device entries from core, %d from boot.\n", c_isa->ac, b_isa->ac);
for (d = 0; d < c_isa->ac; d++) {
if (isDebug())
msgDebug("Outer loop, c_isa->av[%d] = %s\n", d, c_isa->av[d]);
if (strcmp(c_isa->av[d], "npx0")) { /* special case npx0, which
mucks with its id_irq member */
msgDebug("save_userconf: ISA device loop, c_isa->av[%d] = %s\n", d, c_isa->av[d]);
if (strcmp(c_isa->av[d], "npx0")) { /* special case npx0, which mucks with its id_irq member */
c_dev = uc_getdev(core, c_isa->av[d]);
b_dev = uc_getdev(boot, c_isa->av[d]);
b_dev = uc_getdev(boot, b_isa->av[d]);
if (!c_dev || !b_dev) {
msgDebug("save_userconf: c_dev: %x b_dev: %x\n", c_dev, b_dev);
continue;
}
if (isDebug())
msgDebug("save_userconf: ISA device %s: %d config parameters (core), %d (boot)\n",
c_isa->av[d], c_dev->ac, b_dev->ac);
for (i = 0; i < c_dev->ac; i++) {
if (isDebug())
msgDebug("Inner loop, c_dev->av[%d] = %s\n", i, c_dev->av[i]);
msgDebug("save_userconf: c_dev->av[%d] = %s, b_dev->av[%d] = %s\n", i, c_dev->av[i], i, b_dev->av[i]);
if (strcmp(c_dev->av[i], b_dev->av[i])) {
if (isDebug())
msgDebug("%s %s changed: %s (boot) -> %s (core)\n",
c_dev->av[0], isa_list[i], b_dev->av[i], c_dev->av[i]);
msgDebug("save_userconf: %s (boot) -> %s (core)\n",
c_dev->av[i], b_dev->av[i]);
isa_setdev(boot, c_dev);
}
}

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: sysinstall.h,v 1.79 1996/10/01 12:13:25 jkh Exp $
* $Id: sysinstall.h,v 1.80 1996/10/04 13:33:44 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -74,7 +74,6 @@
#define DISK_PARTITIONED "_diskPartitioned"
#define DISK_LABELLED "_diskLabelled"
#define DISK_SELECTED "_diskSelected"
#define DISK_PREPARED "_diskPrepared"
#define SYSTEM_STATE "_systemState"
#define RUNNING_ON_ROOT "_runningOnRoot"
#define TCP_CONFIGURED "_tcpConfigured"

View File

@ -1,5 +1,5 @@
/*
* $Id: tcpip.c,v 1.46 1996/09/01 08:17:14 jkh Exp $
* $Id: tcpip.c,v 1.47 1996/10/05 12:16:49 jkh Exp $
*
* Copyright (c) 1995
* Gary J Palmer. All rights reserved.
@ -249,8 +249,7 @@ tcpOpenDialog(Device *devp)
msgFatal("Cannot open TCP/IP dialog window!!");
/* Say where our help comes from */
systemHelpFile(TCP_HELPFILE, help);
use_helpfile(help);
use_helpfile(systemHelpFile(TCP_HELPFILE, help));
/* Setup a nice screen for us to splat stuff onto */
draw_box(ds_win, TCP_DIALOG_Y, TCP_DIALOG_X, TCP_DIALOG_HEIGHT, TCP_DIALOG_WIDTH, dialog_attr, border_attr);