summaryrefslogtreecommitdiffstats
path: root/loader2
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2005-08-13 00:52:40 +0000
committerChris Lumens <clumens@redhat.com>2005-08-13 00:52:40 +0000
commit26091625f3cf24dc0ba5bf655a83a868c5b20e89 (patch)
treea492c91713966c8050f0cee47cad79e87d15dbea /loader2
parenta96d25d6bdae5703ff8d9ee5993d9942f2a6a48d (diff)
downloadanaconda-26091625f3cf24dc0ba5bf655a83a868c5b20e89.tar.gz
anaconda-26091625f3cf24dc0ba5bf655a83a868c5b20e89.tar.xz
anaconda-26091625f3cf24dc0ba5bf655a83a868c5b20e89.zip
Support logging levels in the loader just like in the python parts of the
installer. Also make the output look the same. This isn't going to be nearly as sophisticated as the python logging module, but it will at least behave similarly with command line options.
Diffstat (limited to 'loader2')
-rw-r--r--loader2/cdinstall.c21
-rw-r--r--loader2/driverdisk.c38
-rw-r--r--loader2/driverselect.c6
-rw-r--r--loader2/firewire.c15
-rw-r--r--loader2/getparts.c2
-rw-r--r--loader2/hardware.c59
-rw-r--r--loader2/hdinstall.c63
-rw-r--r--loader2/kbd.c8
-rw-r--r--loader2/kickstart.c10
-rw-r--r--loader2/lang.c10
-rw-r--r--loader2/loader.c53
-rw-r--r--loader2/loadermisc.c12
-rw-r--r--loader2/log.c51
-rw-r--r--loader2/log.h11
-rw-r--r--loader2/mediacheck.c22
-rw-r--r--loader2/method.c63
-rw-r--r--loader2/modstubs.c8
-rw-r--r--loader2/modules.c48
-rw-r--r--loader2/net.c97
-rw-r--r--loader2/nfsinstall.c42
-rw-r--r--loader2/pcmcia.c18
-rw-r--r--loader2/selinux.c8
-rw-r--r--loader2/telnet.c3
-rw-r--r--loader2/telnetd.c10
-rw-r--r--loader2/urlinstall.c22
-rw-r--r--loader2/urls.c8
-rw-r--r--loader2/usb.c18
27 files changed, 389 insertions, 337 deletions
diff --git a/loader2/cdinstall.c b/loader2/cdinstall.c
index 9fd4bef71..41429a512 100644
--- a/loader2/cdinstall.c
+++ b/loader2/cdinstall.c
@@ -48,13 +48,13 @@ static int getISOStatusFromFD(int isofd, char *mediasum);
void ejectCdrom(void) {
int ejectfd;
- logMessage("ejecting /tmp/cdrom...");
+ logMessage(INFO, "ejecting /tmp/cdrom...");
if ((ejectfd = open("/tmp/cdrom", O_RDONLY | O_NONBLOCK, 0)) >= 0) {
if (ioctl(ejectfd, CDROMEJECT, 0))
- logMessage("eject failed %d ", errno);
+ logMessage(ERROR, "eject failed %d ", errno);
close(ejectfd);
} else {
- logMessage("eject failed %d ", errno);
+ logMessage(ERROR, "eject failed %d ", errno);
}
}
@@ -182,7 +182,7 @@ static int getISOStatusFromCDROM(char *cddriver, char *mediasum) {
devMakeInode(cddriver, "/tmp/cdrom");
isofd = open("/tmp/cdrom", O_RDONLY);
if (isofd < 0) {
- logMessage("Could not check iso status: %s", strerror(errno));
+ logMessage(WARNING, "Could not check iso status: %s", strerror(errno));
unlink("/tmp/cdrom");
return 0;
}
@@ -209,7 +209,7 @@ static int getISOStatusFromFD(int isofd, char *mediasum) {
fragmentsums[0] = '\0';
if ((pvd_offset = parsepvd(isofd, tmpsum, &skipsectors, &isosize, &isostatus, fragmentsums, &fragmentcount)) < 0) {
- logMessage("Could not parse pvd");
+ logMessage(ERROR, "Could not parse pvd");
return 0;
}
@@ -304,7 +304,7 @@ char * setupCdrom(char * location,
devices = probeDevices(CLASS_CDROM, BUS_UNSPEC, 0);
if (!devices) {
- logMessage("got to setupCdrom without a CD device");
+ logMessage(ERROR, "got to setupCdrom without a CD device");
return NULL;
}
@@ -312,7 +312,7 @@ char * setupCdrom(char * location,
do {
for (i = 0; devices[i]; i++) {
if (!devices[i]->device) continue;
- logMessage("trying to mount CD device %s", devices[i]->device);
+ logMessage(INFO, "trying to mount CD device %s", devices[i]->device);
devMakeInode(devices[i]->device, "/tmp/cdrom");
if (!doPwMount("/tmp/cdrom", "/mnt/source", "iso9660", 1, 0,
NULL, NULL, 0, 0)) {
@@ -418,8 +418,7 @@ char * mountCdromImage(struct installMethod * method,
void setKickstartCD(struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr) {
- logMessage("kickstartFromCD");
-
+ logMessage(INFO, "kickstartFromCD");
loaderData->method = strdup("cdrom");
}
@@ -428,11 +427,11 @@ int kickstartFromCD(char *kssrc, int flags) {
char *p, *kspath;
struct device ** devices;
- logMessage("getting kickstart file from first CDROM");
+ logMessage(INFO, "getting kickstart file from first CDROM");
devices = probeDevices(CLASS_CDROM, BUS_UNSPEC, 0);
if (!devices) {
- logMessage("No CDROM devices found!");
+ logMessage(ERROR, "No CDROM devices found!");
return 1;
}
diff --git a/loader2/driverdisk.c b/loader2/driverdisk.c
index 5e380b1b2..e8016183d 100644
--- a/loader2/driverdisk.c
+++ b/loader2/driverdisk.c
@@ -59,7 +59,7 @@ static int verifyDriverDisk(char *mntpt, int flags) {
for (fnPtr = driverDiskFiles; *fnPtr; fnPtr++) {
sprintf(file, "%s/%s", mntpt, *fnPtr);
if (access(file, R_OK)) {
- logMessage("cannot find %s, bad driver disk", file);
+ logMessage(ERROR, "cannot find %s, bad driver disk", file);
return LOADER_BACK;
}
}
@@ -67,10 +67,10 @@ static int verifyDriverDisk(char *mntpt, int flags) {
/* check for both versions */
sprintf(file, "%s/rhdd", mntpt);
if (access(file, R_OK)) {
- logMessage("not a new format driver disk, checking for old");
+ logMessage(WARNING, "not a new format driver disk, checking for old");
sprintf(file, "%s/rhdd-6.1", mntpt);
if (access(file, R_OK)) {
- logMessage("can't find either driver disk identifier, bad "
+ logMessage(ERROR, "can't find either driver disk identifier, bad "
"driver disk");
}
}
@@ -184,7 +184,7 @@ int getRemovableDevices(char *** devNames) {
/* JKFIXME: better error handling */
if (!numDevices) {
- logMessage("no devices found to load drivers from");
+ logMessage(ERROR, "no devices found to load drivers from");
return numDevices;
}
@@ -208,7 +208,7 @@ int getRemovableDevices(char *** devNames) {
numDevices = i;
for (i = 0; devices[i]; i++) {
- logMessage("devices[%d] is %s", i, devices[i]->device);
+ logMessage(INFO, "devices[%d] is %s", i, devices[i]->device);
}
*devNames = malloc((numDevices + 1) * sizeof(*devNames));
@@ -218,7 +218,7 @@ int getRemovableDevices(char *** devNames) {
(*devNames)[i] = NULL;
if (i != numDevices)
- logMessage("somehow numDevices != len(devices)");
+ logMessage(WARNING, "somehow numDevices != len(devices)");
return numDevices;
}
@@ -314,19 +314,19 @@ int loadDriverFromMedia(int class, moduleList modLoaded,
case DEV_CHOOSEFILE: {
if (part == NULL) {
- logMessage("somehow got to choosing file with a NULL part, going back");
+ logMessage(ERROR, "somehow got to choosing file with a NULL part, going back");
stage = DEV_PART;
break;
}
/* make sure nothing is mounted when we get here */
num = umount("/tmp/dpart");
if (num == -1) {
- logMessage("error unmounting: %s", strerror(errno));
+ logMessage(ERROR, "error unmounting: %s", strerror(errno));
if ((errno != EINVAL) && (errno != ENOENT))
exit(1);
}
- logMessage("trying to mount %s as partition", part);
+ logMessage(INFO, "trying to mount %s as partition", part);
devMakeInode(part + 5, "/tmp/ddpart");
if (doPwMount("/tmp/ddpart", "/tmp/dpart", "vfat", 1, 0, NULL, NULL, 0, 0)) {
if (doPwMount("/tmp/ddpart", "/tmp/dpart", "ext2", 1, 0, NULL, NULL, 0, 0)) {
@@ -357,7 +357,7 @@ int loadDriverFromMedia(int class, moduleList modLoaded,
case DEV_LOADFILE: {
if(ddfile == NULL) {
- logMessage("trying to load dd from NULL");
+ logMessage(INFO, "trying to load dd from NULL");
stage = DEV_CHOOSEFILE;
break;
}
@@ -393,7 +393,7 @@ int loadDriverFromMedia(int class, moduleList modLoaded,
dir = 1;
devMakeInode(device, "/tmp/dddev");
- logMessage("trying to mount %s", device);
+ logMessage(INFO, "trying to mount %s", device);
if (doPwMount("/tmp/dddev", "/tmp/drivers", "vfat", 1, 0, NULL, NULL, 0, 0)) {
if (doPwMount("/tmp/dddev", "/tmp/drivers", "ext2", 1, 0, NULL, NULL, 0, 0)) {
if (doPwMount("/tmp/dddev", "/tmp/drivers", "iso9660", 1, 0, NULL, NULL, 0, 0)) {
@@ -537,7 +537,7 @@ int loadDriverDisks(int class, moduleList modLoaded,
static void loadFromLocation(struct loaderData_s * loaderData,
char * dir, int flags) {
if (verifyDriverDisk(dir, flags) == LOADER_BACK) {
- logMessage("not a valid driver disk");
+ logMessage(ERROR, "not a valid driver disk");
return;
}
@@ -556,13 +556,13 @@ void getDDFromSource(struct loaderData_s * loaderData,
unlinkf = 1;
if (getFileFromNfs(src + 4, "/tmp/dd.img", loaderData,
flags)) {
- logMessage("unable to retrieve driver disk: %s", src);
+ logMessage(ERROR, "unable to retrieve driver disk: %s", src);
return;
}
} else if (!strncmp(src, "ftp://", 6) || !strncmp(src, "http://", 7)) {
unlinkf = 1;
if (getFileFromUrl(src, "/tmp/dd.img", loaderData, flags)) {
- logMessage("unable to retrieve driver disk: %s", src);
+ logMessage(ERROR, "unable to retrieve driver disk: %s", src);
return;
}
/* FIXME: this is a hack so that you can load a driver disk from, eg,
@@ -625,21 +625,21 @@ void useKickstartDD(struct loaderData_s * loaderData,
dev = (char *) poptGetArg(optCon);
if (!dev && !src) {
- logMessage("bad arguments to kickstart driver disk command");
+ logMessage(ERROR, "bad arguments to kickstart driver disk command");
return;
}
if (usebiosdev != 0) {
p = strchr(dev,'p');
if (!p){
- logMessage("Bad argument for biospart");
+ logMessage(ERROR, "Bad argument for biospart");
return;
}
*p = '\0';
biospart = getBiosDisk(dev);
if (biospart == NULL) {
- logMessage("Unable to locate BIOS dev %s",dev);
+ logMessage(ERROR, "Unable to locate BIOS dev %s",dev);
return;
}
dev = malloc(strlen(biospart) + strlen(p + 1) + 2);
@@ -659,13 +659,13 @@ static void getDDFromDev(struct loaderData_s * loaderData, char * dev,
if (fstype) {
if (doPwMount("/tmp/dddev", "/tmp/drivers", fstype, 1, 0,
NULL, NULL, 0, 0)) {
- logMessage("unable to mount %s as %s", dev, fstype);
+ logMessage(ERROR, "unable to mount %s as %s", dev, fstype);
return;
}
} else if (doPwMount("/tmp/dddev", "/tmp/drivers", "vfat", 1, 0, NULL, NULL, 0, 0)) {
if (doPwMount("/tmp/dddev", "/tmp/drivers", "ext2", 1, 0, NULL, NULL, 0, 0)) {
if (doPwMount("/tmp/dddev", "/tmp/drivers", "iso9660", 1, 0, NULL, NULL, 0, 0)) {
- logMessage("unable to mount driver disk %s", dev);
+ logMessage(ERROR, "unable to mount driver disk %s", dev);
return;
}
}
diff --git a/loader2/driverselect.c b/loader2/driverselect.c
index 2d19ad82f..9f0977b3f 100644
--- a/loader2/driverselect.c
+++ b/loader2/driverselect.c
@@ -89,7 +89,7 @@ static int getManualModuleArgs(struct moduleInfo * mod, char *** moduleArgs) {
if (es.reason == NEWT_EXIT_COMPONENT && es.u.co == back) {
done = -1;
} else if (es.reason == NEWT_EXIT_HOTKEY && es.u.key == NEWT_KEY_F1) {
- logMessage("need to pop up 'help' with module options here");
+ logMessage(WARNING, "need to pop up 'help' with module options here");
/* JKFIXME: ^^^ */
} else {
done = 1;
@@ -104,7 +104,7 @@ static int getManualModuleArgs(struct moduleInfo * mod, char *** moduleArgs) {
return LOADER_BACK;
}
- logMessage("specified args of %s for %s", argsEntry, mod->moduleName);
+ logMessage(INFO, "specified args of %s for %s", argsEntry, mod->moduleName);
if (strlen(argsEntry) > 0) {
int numAlloced = 5;
@@ -164,7 +164,7 @@ int chooseManualDriver(int class, moduleList modLoaded,
else if (class == CLASS_UNSPEC)
type = DRIVER_ANY;
else {
- logMessage("unknown device class %d specified; aborting manual "
+ logMessage(ERROR, "unknown device class %d specified; aborting manual "
"selection", class);
return LOADER_ERROR;
}
diff --git a/loader2/firewire.c b/loader2/firewire.c
index 86f3febac..6fb404846 100644
--- a/loader2/firewire.c
+++ b/loader2/firewire.c
@@ -36,7 +36,7 @@ int firewireInitialize(moduleList modLoaded, moduleDeps modDeps,
devices = probeDevices(CLASS_FIREWIRE, BUS_PCI, 0);
if (!devices) {
- logMessage("no firewire controller found");
+ logMessage(WARNING, "no firewire controller found");
return 0;
}
@@ -45,16 +45,16 @@ int firewireInitialize(moduleList modLoaded, moduleDeps modDeps,
/* JKFIXME: if we looked for all of them, we could batch this up and it
* would be faster */
for (i=0; devices[i]; i++) {
- logMessage("found firewire controller %s", devices[i]->driver);
+ logMessage(INFO, "found firewire controller %s", devices[i]->driver);
winStatus(40, 3, _("Loading"), _("Loading %s driver..."),
devices[0]->driver);
if (mlLoadModuleSet(devices[i]->driver, modLoaded, modDeps,
modInfo, flags)) {
- logMessage("failed to insert firewire module");
+ logMessage(ERROR, "failed to insert firewire module");
} else {
- found++;
+ found++;
}
}
@@ -65,18 +65,19 @@ int firewireInitialize(moduleList modLoaded, moduleDeps modDeps,
sleep(3);
- logMessage("probing for firewire scsi devices");
+ logMessage(INFO, "probing for firewire scsi devices");
devices = probeDevices(CLASS_SCSI, BUS_FIREWIRE, 0);
if (!devices) {
- logMessage("no firewire scsi devices found");
+ logMessage(WARNING, "no firewire scsi devices found");
newtPopWindow();
return 0;
}
for (i=0;devices[i];i++) {
if ((devices[i]->detached == 0) && (devices[i]->driver != NULL)) {
- logMessage("found firewire device using %s", devices[i]->device);
+ logMessage(INFO, "found firewire device using %s",
+ devices[i]->device);
mlLoadModuleSet(devices[i]->driver, modLoaded, modDeps,
modInfo, flags);
}
diff --git a/loader2/getparts.c b/loader2/getparts.c
index 12686fb30..719216c17 100644
--- a/loader2/getparts.c
+++ b/loader2/getparts.c
@@ -53,7 +53,7 @@ char **getPartitionsList(char * disk) {
f = fopen("/proc/partitions", "r");
if (!f) {
- logMessage("getPartitionsList: could not open /proc/partitions");
+ logMessage(ERROR, "getPartitionsList: could not open /proc/partitions");
return NULL;
}
diff --git a/loader2/hardware.c b/loader2/hardware.c
index 2f3d79d8a..6af8c437c 100644
--- a/loader2/hardware.c
+++ b/loader2/hardware.c
@@ -66,14 +66,14 @@ static int detectHardware(moduleInfoSet modInfo,
int numMods;
char *driver;
- logMessage("probing buses");
+ logMessage(INFO, "probing buses");
devices = probeDevices(CLASS_UNSPEC,
BUS_PCI | BUS_SBUS | BUS_VIO | BUS_MACIO |
((has_pcmcia() >= 0) ? BUS_PCMCIA : 0),
PROBE_ALL);
- logMessage("finished bus probing");
+ logMessage(INFO, "finished bus probing");
if (devices == NULL) {
*modules = NULL;
@@ -96,23 +96,23 @@ static int detectHardware(moduleInfoSet modInfo,
/* this is kind of icky and verbose. there are better and more
* general ways to do it but this is simple and obvious */
if (FL_NOPCMCIA(flags) && ((*device)->type == CLASS_SOCKET)) {
- logMessage("ignoring pcmcia device %s (%s)", (*device)->desc,
- (*device)->driver);
+ logMessage(WARNING, "ignoring pcmcia device %s (%s)",
+ (*device)->desc, (*device)->driver);
} else if (FL_NOIEEE1394(flags) && ((*device)->type == CLASS_FIREWIRE)) {
- logMessage("ignoring firewire device %s (%s)", (*device)->desc,
- (*device)->driver);
+ logMessage(WARNING, "ignoring firewire device %s (%s)",
+ (*device)->desc, (*device)->driver);
} else if (FL_NOUSB(flags) && ((*device)->type == CLASS_USB)) {
- logMessage("ignoring usb device %s (%s)", (*device)->desc,
+ logMessage(WARNING, "ignoring usb device %s (%s)", (*device)->desc,
(*device)->driver);
} else if (FL_NOSTORAGE(flags) &&
(((*device)->type == CLASS_SCSI) ||
((*device)->type == CLASS_IDE) ||
((*device)->type == CLASS_RAID))) {
- logMessage("ignoring storage device %s (%s)", (*device)->desc,
- (*device)->driver);
+ logMessage(WARNING, "ignoring storage device %s (%s)",
+ (*device)->desc, (*device)->driver);
} else if (FL_NONET(flags) && ((*device)->type == CLASS_NETWORK)) {
- logMessage("ignoring network device %s (%s)", (*device)->desc,
- (*device)->driver);
+ logMessage(WARNING, "ignoring network device %s (%s)",
+ (*device)->desc, (*device)->driver);
} else if (strcmp (driver, "ignore") && strcmp (driver, "unknown")
&& strcmp (driver, "disabled")) {
modList[numMods++] = strdup(driver);
@@ -136,31 +136,31 @@ int agpgartInitialize(moduleList modLoaded, moduleDeps modDeps,
if (FL_TESTING(flags)) return 0;
- logMessage("looking for video cards requiring agpgart module");
+ logMessage(INFO, "looking for video cards requiring agpgart module");
devices = probeDevices(CLASS_VIDEO, BUS_UNSPEC, 0);
if (!devices) {
- logMessage("no video cards found");
+ logMessage(WARNING, "no video cards found");
return 0;
}
/* loop thru cards, see if we need agpgart */
for (i=0; devices[i]; i++) {
p = devices[i];
- logMessage("found video card controller %s", p->driver);
+ logMessage(INFO, "found video card controller %s", p->driver);
/* HACK - need to have list of cards which match!! */
/* JKFIXME: verify this is really still needed */
if (!strcmp(p->driver, "Card:Intel 810") ||
!strcmp(p->driver, "Card:Intel 815")) {
- logMessage("found %s card requiring agpgart, loading module",
+ logMessage(INFO, "found %s card requiring agpgart, loading module",
p->driver+5);
if (mlLoadModuleSetLocation("agpgart", modLoaded, modDeps,
modInfo, flags,
secondStageModuleLocation)) {
- logMessage("failed to insert agpgart module");
+ logMessage(ERROR, "failed to insert agpgart module");
return 1;
} else {
/* only load it once! */
@@ -178,21 +178,21 @@ int scsiTapeInitialize(moduleList modLoaded, moduleDeps modDeps,
if (FL_TESTING(flags)) return 0;
- logMessage("looking for scsi tape devices");
+ logMessage(INFO, "looking for scsi tape devices");
devices = probeDevices(CLASS_TAPE, BUS_SCSI, 0);
if (!devices) {
- logMessage("no scsi tape devices found");
+ logMessage(WARNING, "no scsi tape devices found");
return 0;
}
- logMessage("scsi tape device(s) found, loading st.ko");
+ logMessage(INFO, "scsi tape device(s) found, loading st.ko");
if (mlLoadModuleSetLocation("st", modLoaded, modDeps,
modInfo, flags,
secondStageModuleLocation)) {
- logMessage("failed to insert st module");
+ logMessage(ERROR, "failed to insert st module");
return 1;
}
@@ -210,11 +210,11 @@ void initializeParallelPort(moduleList modLoaded, moduleDeps modDeps,
#endif
if (FL_NOPARPORT(flags)) return;
- logMessage("loading parallel port drivers...");
+ logMessage(INFO, "loading parallel port drivers...");
if (mlLoadModuleSetLocation("parport_pc", modLoaded, modDeps,
modInfo, flags,
secondStageModuleLocation)) {
- logMessage("failed to load parport_pc module");
+ logMessage(ERROR, "failed to load parport_pc module");
return;
}
}
@@ -260,7 +260,7 @@ int earlyModuleLoad(moduleInfoSet modInfo, moduleList modLoaded,
for (i=0; i < argc; i++) {
if (!strncasecmp(argv[i], "driverload=", 11)) {
- logMessage("loading %s early", argv[i] + 11);
+ logMessage(INFO, "loading %s early", argv[i] + 11);
mlLoadModuleSet(argv[i] + 11, modLoaded, modDeps, modInfo, flags);
}
}
@@ -283,7 +283,7 @@ int busProbe(moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps,
if (canProbeDevices()) {
/* autodetect whatever we can */
if (detectHardware(modInfo, &modList, flags)) {
- logMessage("failed to scan pci bus!");
+ logMessage(ERROR, "failed to scan pci bus!");
return 0;
} else if (modList && justProbe) {
for (i = 0; modList[i]; i++)
@@ -300,7 +300,7 @@ int busProbe(moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps,
startPcmciaDevices(modLoaded, flags);
} else
- logMessage("found nothing");
+ logMessage(INFO, "found nothing");
}
return 0;
@@ -343,15 +343,16 @@ void ideSetup(moduleList modLoaded, moduleDeps modDeps,
devMakeInode(devices[i]->device, "/tmp/cdrom");
fd = open("/tmp/cdrom", O_RDONLY|O_NONBLOCK);
if (fd == -1) {
- logMessage("failed to open /tmp/cdrom: %s", strerror(errno));
+ logMessage(ERROR, "failed to open /tmp/cdrom: %s", strerror(errno));
unlink("/tmp/cdrom");
continue;
}
if (ioctl(fd, HDIO_SET_DMA, 0) == -1)
- logMessage("failed to disable dma for %s: %s", devices[i]->device,
- strerror(errno));
+ logMessage(ERROR, "failed to disable dma for %s: %s",
+ devices[i]->device, strerror(errno));
else
- logMessage("disabled DMA for CD devices %s", devices[i]->device);
+ logMessage(WARNING, "disabled DMA for CD devices %s",
+ devices[i]->device);
close(fd);
unlink("/tmp/cdrom");
}
diff --git a/loader2/hdinstall.c b/loader2/hdinstall.c
index 219511f75..5b2ec9b01 100644
--- a/loader2/hdinstall.c
+++ b/loader2/hdinstall.c
@@ -62,23 +62,23 @@ static int loadHDImages(char * prefix, char * dir, int flags,
target = stg2list[idx];
sprintf(path, "%s/%s/%s/base/%s", prefix, dir ? dir : "", getProductPath(), target);
- logMessage("Looking for hd stage2 image %s", path);
+ logMessage(INFO, "Looking for hd stage2 image %s", path);
if (!access(path, F_OK))
break;
- logMessage("%s does not exist: %s, trying next target", path, strerror(errno));
+ logMessage(WARNING, "%s does not exist: %s, trying next target", path, strerror(errno));
}
if (!(*target)) {
- logMessage("failed to find hd stage 2 image%s: %s", path, strerror(errno));
+ logMessage(ERROR, "failed to find hd stage 2 image%s: %s", path, strerror(errno));
return 1;
}
- logMessage("Found hd stage2");
+ logMessage(INFO, "Found hd stage2");
- logMessage("Copying %s in RAM as stage 2", path);
+ logMessage(INFO, "Copying %s in RAM as stage 2", path);
if ((fd = open(path, O_RDONLY)) < 0) {
- logMessage("failed to open %s: %s", path, strerror(errno));
+ logMessage(ERROR, "failed to open %s: %s", path, strerror(errno));
return 1;
}
@@ -127,24 +127,24 @@ static int mountHDImages(char * prefix, char * dir, int flags,
target = stg2list[idx];
sprintf(path, "%s/%s/%s/base/%s", prefix, dir ? dir : "", getProductPath(), target);
- logMessage("Looking for hd stage2 image %s", path);
+ logMessage(INFO, "Looking for hd stage2 image %s", path);
if (!access(path, F_OK))
break;
- logMessage("%s does not exist: %s, trying next target", path, strerror(errno));
+ logMessage(WARNING, "%s does not exist: %s, trying next target", path, strerror(errno));
}
if (!(*target)) {
- logMessage("failed to find hd stage 2 image%s: %s", path, strerror(errno));
+ logMessage(ERROR, "failed to find hd stage 2 image%s: %s", path, strerror(errno));
return 1;
}
- logMessage("Found hd stage2");
+ logMessage(INFO, "Found hd stage2");
- logMessage("Mounting %s on loop %s as mntpoint %s", path, device, mntpoint);
+ logMessage(INFO, "Mounting %s on loop %s as mntpoint %s", path, device, mntpoint);
rc = mountLoopback(path, mntpoint, device);
if (rc) {
- logMessage("Unable to mount hdstage2 loopback");
+ logMessage(ERROR, "Unable to mount hdstage2 loopback");
return rc;
}
@@ -181,11 +181,11 @@ static char * setupIsoImages(char * device, char * dirName, int flags) {
char *typetry[] = {"ext2", "vfat", NULL};
char **type;
- logMessage("mounting device %s for hard drive install", device);
+ logMessage(INFO, "mounting device %s for hard drive install", device);
if (!FL_TESTING(flags)) {
if (devMakeInode(device, "/tmp/hddev"))
- logMessage("devMakeInode failed!");
+ logMessage(WARNING, "devMakeInode failed!");
/* XXX try to mount as ext2 and then vfat */
for (type=typetry; *type; type++) {
@@ -201,10 +201,10 @@ static char * setupIsoImages(char * device, char * dirName, int flags) {
if ((path = validIsoImages(filespec, 0))) {
char updpath[4096];
- logMessage("Path to valid iso is %s", path);
+ logMessage(INFO, "Path to valid iso is %s", path);
snprintf(updpath, sizeof(updpath), "%s/updates.img", filespec);
- logMessage("Looking for updates for HD in %s", updpath);
+ logMessage(INFO, "Looking for updates for HD in %s", updpath);
copyUpdatesImg(updpath);
rc = mountLoopback(path, "/tmp/loopimage", "loop0");
@@ -278,7 +278,7 @@ char * mountHardDrive(struct installMethod * method,
kspartition = ((struct hdInstallData *)loaderData->methodData)->partition;
ksdirectory = ((struct hdInstallData *)loaderData->methodData)->directory;
- logMessage("partition is %s, dir is %s", kspartition, ksdirectory);
+ logMessage(INFO, "partition is %s, dir is %s", kspartition, ksdirectory);
/* if exist, duplicate */
if (kspartition)
@@ -287,7 +287,7 @@ char * mountHardDrive(struct installMethod * method,
ksdirectory = strdup(ksdirectory);
if (!kspartition || !ksdirectory) {
- logMessage("missing partition or directory specification");
+ logMessage(ERROR, "missing partition or directory specification");
free(loaderData->method);
loaderData->method = NULL;
} else {
@@ -298,7 +298,7 @@ char * mountHardDrive(struct installMethod * method,
url = setupIsoImages(kspart, ksdirectory, flags);
if (!url) {
- logMessage("unable to find %s installation images on hd",getProductName());
+ logMessage(ERROR, "unable to find %s installation images on hd",getProductName());
free(loaderData->method);
loaderData->method = NULL;
} else {
@@ -428,7 +428,7 @@ char * mountHardDrive(struct installMethod * method,
continue;
}
- logMessage("partition %s selected", selpart);
+ logMessage(INFO, "partition %s selected", selpart);
url = setupIsoImages(selpart + 5, dir, flags);
if (!url) {
@@ -463,7 +463,7 @@ void setKickstartHD(struct loaderData_s * loaderData, int argc,
};
- logMessage("kickstartFromHD");
+ logMessage(INFO, "kickstartFromHD");
optCon = poptGetContext(NULL, argc, (const char **) argv, ksHDOptions, 0);
if ((rc = poptGetNextOpt(optCon)) < -1) {
startNewt(*flagsPtr);
@@ -480,13 +480,13 @@ void setKickstartHD(struct loaderData_s * loaderData, int argc,
p = strchr(biospart,'p');
if(!p){
- logMessage("Bad argument for --biospart");
+ logMessage(ERROR, "Bad argument for --biospart");
return;
}
*p = '\0';
dev = getBiosDisk(biospart);
if (dev == NULL) {
- logMessage("Unable to location BIOS partition %s", biospart);
+ logMessage(ERROR, "Unable to location BIOS partition %s", biospart);
return;
}
partition = malloc(strlen(dev) + strlen(p + 1) + 2);
@@ -500,14 +500,15 @@ void setKickstartHD(struct loaderData_s * loaderData, int argc,
if (dir)
((struct hdInstallData *)loaderData->methodData)->directory = dir;
- logMessage("results of hd ks, partition is %s, dir is %s", partition, dir);
+ logMessage(INFO, "results of hd ks, partition is %s, dir is %s", partition,
+ dir);
}
int kickstartFromHD(char *kssrc, int flags) {
int rc;
char *p, *q = NULL, *tmpstr, *ksdev, *kspath;
- logMessage("getting kickstart file from harddrive");
+ logMessage(INFO, "getting kickstart file from harddrive");
/* format is ks=hd:[device]:/path/to/ks.cfg */
/* split of pieces */
@@ -522,7 +523,7 @@ int kickstartFromHD(char *kssrc, int flags) {
q = strchr(p+1, '/');
if (!p || !q) {
- logMessage("Format of command line is ks=hd:[device]:/path/to/ks.cfg");
+ logMessage(WARNING, "Format of command line is ks=hd:[device]:/path/to/ks.cfg");
free(tmpstr);
return 1;
}
@@ -531,7 +532,7 @@ int kickstartFromHD(char *kssrc, int flags) {
ksdev = p+1;
kspath = q+1;
- logMessage("Loading ks from device %s on path %s", ksdev, kspath);
+ logMessage(INFO, "Loading ks from device %s on path %s", ksdev, kspath);
if ((rc=getKickstartFromBlockDevice(ksdev, kspath))) {
if (rc == 3) {
startNewt(flags);
@@ -549,7 +550,7 @@ int kickstartFromBD(char *kssrc, int flags) {
int rc;
char *p, *q = NULL, *r = NULL, *tmpstr, *ksdev, *kspath, *biosksdev;
- logMessage("getting kickstart file from biosdrive");
+ logMessage(INFO, "getting kickstart file from biosdrive");
/* format is ks=bd:[device]:/path/to/ks.cfg */
/* split of pieces */
@@ -559,7 +560,7 @@ int kickstartFromBD(char *kssrc, int flags) {
q = strchr(p+1, ':');
if (!p || !q) {
- logMessage("Format of command line is ks=bd:device:/path/to/ks.cfg");
+ logMessage(WARNING, "Format of command line is ks=bd:device:/path/to/ks.cfg");
free(tmpstr);
return 1;
}
@@ -569,7 +570,7 @@ int kickstartFromBD(char *kssrc, int flags) {
r = strchr(p+1,'p');
if(!r){
- logMessage("Format of biosdisk is 80p1");
+ logMessage(INFO, "Format of biosdisk is 80p1");
free(tmpstr);
return 1;
}
@@ -587,7 +588,7 @@ int kickstartFromBD(char *kssrc, int flags) {
ksdev = malloc(strlen(biosksdev) + 3);
sprintf(ksdev, "%s%s", biosksdev, r + 1);
- logMessage("Loading ks from device %s on path %s", ksdev, kspath);
+ logMessage(INFO, "Loading ks from device %s on path %s", ksdev, kspath);
if ((rc=getKickstartFromBlockDevice(ksdev, kspath))) {
if (rc == 3) {
startNewt(flags);
diff --git a/loader2/kbd.c b/loader2/kbd.c
index 41a006e77..bbf0f2cfd 100644
--- a/loader2/kbd.c
+++ b/loader2/kbd.c
@@ -97,7 +97,7 @@ int chooseKeyboard(char ** keymap, char ** kbdtypep, int flags) {
return LOADER_ERROR;
}
- logMessage("%d keymaps are available", hdr.numEntries);
+ logMessage(INFO, "%d keymaps are available", hdr.numEntries);
i = hdr.numEntries * sizeof(*infoTable);
infoTable = alloca(i);
@@ -135,8 +135,8 @@ int chooseKeyboard(char ** keymap, char ** kbdtypep, int flags) {
for (i = 0; i < num; i++) {
if (gunzip_read(f, buf, infoTable[i].size) != infoTable[i].size) {
- logMessage("error reading %d bytes from file: %s",
- infoTable[i].size, strerror(errno));
+ logMessage(ERROR, "error reading %d bytes from file: %s",
+ infoTable[i].size, strerror(errno));
gunzip_close(f);
rc = LOADER_ERROR;
}
@@ -165,7 +165,7 @@ int chooseKeyboard(char ** keymap, char ** kbdtypep, int flags) {
void setKickstartKeyboard(struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr) {
if (argc < 2) {
- logMessage("no argument passed to keyboard kickstart command");
+ logMessage(ERROR, "no argument passed to keyboard kickstart command");
return;
}
diff --git a/loader2/kickstart.c b/loader2/kickstart.c
index aec7f633d..69f85aca4 100644
--- a/loader2/kickstart.c
+++ b/loader2/kickstart.c
@@ -239,22 +239,22 @@ int kickstartFromFloppy(char *kssrc, int flags) {
char *p, *kspath;
int i, rc;
- logMessage("doing kickstart from floppy");
+ logMessage(INFO, "doing kickstart from floppy");
devices = probeDevices(CLASS_FLOPPY, BUS_MISC | BUS_IDE | BUS_SCSI, PROBE_LOADED);
if (!devices) {
- logMessage("no floppy devices");
+ logMessage(ERROR, "no floppy devices");
return 1;
}
for (i = 0; devices[i]; i++) {
if (devices[i]->detached == 0) {
- logMessage("first non-detached floppy is %s", devices[i]->device);
+ logMessage(INFO, "first non-detached floppy is %s", devices[i]->device);
break;
}
}
if (!devices[i] || (devices[i]->detached != 0)) {
- logMessage("no floppy devices");
+ logMessage(ERROR, "no floppy devices");
return 1;
}
@@ -434,7 +434,7 @@ void runKickstart(struct loaderData_s * loaderData,
int argc;
char ** argv;
- logMessage("setting up kickstart");
+ logMessage(INFO, "setting up kickstart");
for (cmd = ksTable; cmd->name; cmd++) {
if ((!ksGetCommand(cmd->code, NULL, &argc, &argv)) && cmd->setupData) {
cmd->setupData(loaderData, argc, argv, flagsPtr);
diff --git a/loader2/lang.c b/loader2/lang.c
index 24450fb2c..f8f5fe642 100644
--- a/loader2/lang.c
+++ b/loader2/lang.c
@@ -111,7 +111,7 @@ static void loadLanguageList(int flags) {
if (sscanf(line, "%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\t%[^\t]\n",
name, key, font, code, keyboard, timezone) != 6) {
printf("bad line %d in lang-table", lineNum);
- logMessage("bad line %d in lang-table", lineNum);
+ logMessage(WARNING, "bad line %d in lang-table", lineNum);
} else {
languages[numLanguages].lang = strdup(name);
languages[numLanguages].key = strdup(key);
@@ -213,7 +213,7 @@ static void setLangEnv (int i, int flags) {
if (!strcmp(languages[i].font, "none"))
return;
- logMessage("setting language to %s", languages[i].lc_all);
+ logMessage(INFO, "setting language to %s", languages[i].lc_all);
setenv("LANG", languages[i].lc_all, 1);
setenv("LANGKEY", languages[i].key, 1);
@@ -226,7 +226,7 @@ static int setupLanguage(int choice, int flags) {
char * buf;
int i;
- logMessage("going to set language to %s", languages[choice].lc_all);
+ logMessage(INFO, "going to set language to %s", languages[choice].lc_all);
/* load the language only if it is displayable. if they're using
* a serial console or iSeries vioconsole, we hope it's smart enough */
if ((!strcmp(languages[choice].font, "bterm") && !FL_SERIAL(flags) &&
@@ -326,7 +326,7 @@ int setLanguage (char * key, int flags) {
}
}
- logMessage("unable to set to requested language %s", key);
+ logMessage(ERROR, "unable to set to requested language %s", key);
return -1;
}
@@ -397,7 +397,7 @@ int chooseLanguage(char ** lang, int flags) {
void setKickstartLanguage(struct loaderData_s * loaderData, int argc,
char ** argv, int * flagsPtr) {
if (argc < 2) {
- logMessage("no argument passed to lang kickstart command");
+ logMessage(ERROR, "no argument passed to lang kickstart command");
return;
}
diff --git a/loader2/loader.c b/loader2/loader.c
index 36672f169..e3e851b5a 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -228,7 +228,7 @@ static void initializeTtys(void) {
ioctl(fd, VT_WAITACTIVE, n);
close(fd);
} else
- logMessage("failed to initialize %s", dev);
+ logMessage(ERROR, "failed to initialize %s", dev);
}
}
@@ -236,10 +236,10 @@ static void spawnShell(int flags) {
pid_t pid;
if (FL_SERIAL(flags) || FL_NOSHELL(flags)) {
- logMessage("not spawning a shell");
+ logMessage(ERROR, "not spawning a shell");
return;
} else if (access("/bin/sh", X_OK)) {
- logMessage("cannot open shell - /bin/sh doesn't exist");
+ logMessage(ERROR, "cannot open shell - /bin/sh doesn't exist");
return;
}
@@ -248,7 +248,7 @@ static void spawnShell(int flags) {
fd = open("/dev/tty2", O_RDWR|O_NOCTTY);
if (fd < 0) {
- logMessage("cannot open /dev/tty2 -- no shell will be provided");
+ logMessage(ERROR, "cannot open /dev/tty2 -- no shell will be provided");
return;
}
@@ -265,7 +265,7 @@ static void spawnShell(int flags) {
isysLoadFont();
if (ioctl(0, TIOCSCTTY, NULL)) {
- logMessage("could not set new controlling tty");
+ logMessage(ERROR, "could not set new controlling tty");
}
signal(SIGINT, SIG_DFL);
@@ -275,7 +275,7 @@ static void spawnShell(int flags) {
setenv("LANG", "C", 1);
execl("/bin/sh", "-/bin/sh", NULL);
- logMessage("exec of /bin/sh failed: %s", strerror(errno));
+ logMessage(CRITICAL, "exec of /bin/sh failed: %s", strerror(errno));
exit(1);
}
@@ -322,7 +322,7 @@ void loadUpdates(int flags) {
if (rc == 2)
return;
- logMessage("UPDATES device is %s", device);
+ logMessage(INFO, "UPDATES device is %s", device);
devMakeInode(device, "/tmp/upd.disk");
if (doPwMount("/tmp/upd.disk", "/tmp/update-disk", "ext2", 1, 0,
@@ -355,7 +355,7 @@ static void checkForHardDrives(int * flagsPtr) {
/* If they're using kickstart, assume they might know what they're doing.
* Worst case is we fail later */
if (FL_KICKSTART(flags)) {
- logMessage("no hard drives found, but in kickstart so continuing anyway");
+ logMessage(WARNING, "no hard drives found, but in kickstart so continuing anyway");
return;
}
@@ -518,7 +518,7 @@ static int parseCmdLineFlags(int flags, struct loaderData_s * loaderData,
for (i=0; i < argc; i++) {
if (!strcasecmp(argv[i], "expert")) {
flags |= LOADER_FLAGS_EXPERT;
- logMessage("expert got used, ignoring");
+ logMessage(INFO, "expert got used, ignoring");
/* flags |= (LOADER_FLAGS_EXPERT | LOADER_FLAGS_MODDISK |
LOADER_FLAGS_ASKMETHOD);*/
} else if (!strcasecmp(argv[i], "askmethod"))
@@ -645,8 +645,9 @@ static int parseCmdLineFlags(int flags, struct loaderData_s * loaderData,
numExtraArgs = numExtraArgs + 1;
if (numExtraArgs > (MAX_EXTRA_ARGS - 2)) {
- logMessage("Too many command line arguments (max allowed is %d), "
- "rest will be dropped.", MAX_EXTRA_ARGS);
+ logMessage(WARNING, "Too many command line arguments (max "
+ "allowed is %d), rest will be dropped.",
+ MAX_EXTRA_ARGS);
}
}
}
@@ -800,7 +801,7 @@ static char *doLoaderMain(char * location,
/* JKFIXME: this is broken -- we should tell of the
* failure; best by pulling code out in kbd.c to use */
if (isysLoadKeymap(loaderData->kbd)) {
- logMessage("requested keymap %s is not valid, asking", loaderData->kbd);
+ logMessage(WARNING, "requested keymap %s is not valid, asking", loaderData->kbd);
loaderData->kbd = NULL;
loaderData->kbd_set = 0;
break;
@@ -944,7 +945,7 @@ static char *doLoaderMain(char * location,
step = STEP_DRIVER;
break;
}
- logMessage("need to set up networking");
+ logMessage(INFO, "need to set up networking");
initLoopback();
memset(&netDev, 0, sizeof(netDev));
@@ -952,7 +953,7 @@ static char *doLoaderMain(char * location,
/* fall through to interface selection */
case STEP_IFACE:
- logMessage("going to pick interface");
+ logMessage(INFO, "going to pick interface");
rc = chooseNetworkInterface(loaderData, flags);
if ((rc == LOADER_BACK) || (rc == LOADER_ERROR) ||
((dir == -1) && (rc == LOADER_NOOP))) {
@@ -971,7 +972,7 @@ static char *doLoaderMain(char * location,
break;
}
- logMessage("going to do getNetConfig");
+ logMessage(INFO, "going to do getNetConfig");
/* populate netDev based on any kickstart data */
setupNetworkDeviceConfig(&netDev, loaderData, flags);
@@ -988,7 +989,7 @@ static char *doLoaderMain(char * location,
dir = 1;
case STEP_URL:
- logMessage("starting to STEP_URL");
+ logMessage(INFO, "starting to STEP_URL");
/* if we found a CD already short circuit out */
/* we get this case when we're doing a VNC install from CD */
/* and we didnt short circuit earlier because we had to */
@@ -1004,7 +1005,7 @@ static char *doLoaderMain(char * location,
step = STEP_IP ;
dir = -1;
} else {
- logMessage("got url %s", url);
+ logMessage(INFO, "got url %s", url);
step = STEP_DONE;
dir = 1;
}
@@ -1279,7 +1280,7 @@ int main(int argc, char ** argv) {
}
if (!access("/dd.img", R_OK)) {
- logMessage("found /dd.img, loading drivers");
+ logMessage(INFO, "found /dd.img, loading drivers");
getDDFromSource(&loaderData, "path:/dd.img", flags);
}
@@ -1311,7 +1312,7 @@ int main(int argc, char ** argv) {
* and then getKickstartFile() changes it and sets FL_KICKSTART.
* kind of weird. */
if (loaderData.ksFile || ksFile) {
- logMessage("getting kickstart file");
+ logMessage(INFO, "getting kickstart file");
if (!ksFile)
getKickstartFile(&loaderData, &flags);
@@ -1342,7 +1343,7 @@ int main(int argc, char ** argv) {
* (if we're using SELinux) */
if (FL_SELINUX(flags)) {
if (mount("/selinux", "/selinux", "selinuxfs", 0, NULL)) {
- logMessage("failed to mount /selinux: %s", strerror(errno));
+ logMessage(ERROR, "failed to mount /selinux: %s", strerror(errno));
} else {
/* FIXME: this is a bad hack for libselinux assuming things
* about paths */
@@ -1351,13 +1352,13 @@ int main(int argc, char ** argv) {
if (loadpolicy() == 0) {
setexeccon(ANACONDA_CONTEXT);
} else {
- logMessage("failed to load policy, disabling SELinux");
+ logMessage(ERROR, "failed to load policy, disabling SELinux");
flags &= ~LOADER_FLAGS_SELINUX;
}
}
}
- logMessage("getting ready to spawn shell now");
+ logMessage(INFO, "getting ready to spawn shell now");
spawnShell(flags); /* we can attach gdb now :-) */
@@ -1412,7 +1413,7 @@ int main(int argc, char ** argv) {
/* we only want to use RHupdates on nfs installs. otherwise, we'll
* use files on the first iso image and not be able to umount it */
if (!strncmp(url, "nfs:", 4)) {
- logMessage("NFS install method detected, will use RHupdates/");
+ logMessage(INFO, "NFS install method detected, will use RHupdates/");
useRHupdates = 1;
} else {
useRHupdates = 0;
@@ -1449,7 +1450,7 @@ int main(int argc, char ** argv) {
if (access("/tmp/updates", F_OK))
mkdirChain("/tmp/updates");
- logMessage("Running anaconda script %s", *(argptr-1));
+ logMessage(INFO, "Running anaconda script %s", *(argptr-1));
*argptr++ = "-m";
if (strncmp(url, "ftp:", 4)) {
@@ -1469,7 +1470,7 @@ int main(int argc, char ** argv) {
while (*tmparg) {
char *idx;
- logMessage("adding extraArg %s", *tmparg);
+ logMessage(INFO, "adding extraArg %s", *tmparg);
idx = strchr(*tmparg, '=');
if (idx && ((idx-*tmparg) < strlen(*tmparg))) {
*idx = '\0';
@@ -1584,7 +1585,7 @@ int main(int argc, char ** argv) {
FILE * f;
f = fopen("/var/run/init.pid", "r");
if (!f) {
- logMessage("can't find init.pid, guessing that init is pid 1");
+ logMessage(WARNING, "can't find init.pid, guessing that init is pid 1");
pid = 1;
} else {
char * buf = malloc(256);
diff --git a/loader2/loadermisc.c b/loader2/loadermisc.c
index eab3dbb70..d73305b26 100644
--- a/loader2/loadermisc.c
+++ b/loader2/loadermisc.c
@@ -37,7 +37,7 @@ int copyFileFd(int infd, char * dest) {
outfd = open(dest, O_CREAT | O_RDWR, 0666);
if (outfd < 0) {
- logMessage("failed to open %s: %s", dest, strerror(errno));
+ logMessage(ERROR, "failed to open %s: %s", dest, strerror(errno));
return 1;
}
@@ -60,7 +60,7 @@ int copyFile(char * source, char * dest) {
infd = open(source, O_RDONLY);
if (infd < 0) {
- logMessage("failed to open %s: %s", source, strerror(errno));
+ logMessage(ERROR, "failed to open %s: %s", source, strerror(errno));
return 1;
}
@@ -224,13 +224,13 @@ int totalMemory(void) {
fd = open("/proc/meminfo", O_RDONLY);
if (fd < 0) {
- logMessage("failed to open /proc/meminfo: %s", strerror(errno));
+ logMessage(ERROR, "failed to open /proc/meminfo: %s", strerror(errno));
return 0;
}
bytesRead = read(fd, buf, sizeof(buf) - 1);
if (bytesRead < 0) {
- logMessage("failed to read from /proc/meminfo: %s", strerror(errno));
+ logMessage(ERROR, "failed to read from /proc/meminfo: %s", strerror(errno));
close(fd);
return 0;
}
@@ -252,7 +252,7 @@ int totalMemory(void) {
while (!isdigit(*start) && *start) start++;
if (!*start) {
- logMessage("no number appears after MemTotal tag");
+ logMessage(WARNING, "no number appears after MemTotal tag");
return 0;
}
@@ -263,7 +263,7 @@ int totalMemory(void) {
}
}
- logMessage("%d kB are available", total);
+ logMessage(INFO, "%d kB are available", total);
return total;
}
diff --git a/loader2/log.c b/loader2/log.c
index 7c2dacd17..2a4c012e3 100644
--- a/loader2/log.c
+++ b/loader2/log.c
@@ -20,25 +20,57 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <time.h>
#include <unistd.h>
#include "log.h"
static FILE * logfile = NULL;
static FILE * logfile2 = NULL;
-static int loglevel = 10;
-
-void logMessage(const char * s, ...) {
- /* JKFIXME: need to make this debugMessage and handle a level param */
- /* if (level > loglevel)
- return;*/
+static int minLevel = 10;
+
+static void printLogHeader(int level, FILE *outfile) {
+ time_t current_time = time(NULL);
+ struct tm *t = gmtime (&current_time);
+
+ switch (level) {
+ case DEBUGLVL:
+ fprintf (outfile, "%02d:%02d:%02d DEBUG : ", t->tm_hour,
+ t->tm_min, t->tm_sec);
+ break;
+
+ case INFO:
+ fprintf (outfile, "%02d:%02d:%02d INFO : ", t->tm_hour,
+ t->tm_min, t->tm_sec);
+ break;
+
+ case WARNING:
+ fprintf (outfile, "%02d:%02d:%02d WARNING : ", t->tm_hour,
+ t->tm_min, t->tm_sec);
+ break;
+
+ case ERROR:
+ fprintf (outfile, "%02d:%02d:%02d ERROR : ", t->tm_hour,
+ t->tm_min, t->tm_sec);
+ break;
+
+ case CRITICAL:
+ fprintf (outfile, "%02d:%02d:%02d CRITICAL: ", t->tm_hour,
+ t->tm_min, t->tm_sec);
+ break;
+ }
+}
+void logMessage(int level, const char * s, ...) {
va_list args;
+ if (level < minLevel)
+ return;
+
if (logfile) {
va_start(args, s);
- fprintf(logfile, "* ");
+ printLogHeader(level, logfile);
vfprintf(logfile, s, args);
fprintf(logfile, "\n");
fflush(logfile);
@@ -49,7 +81,7 @@ void logMessage(const char * s, ...) {
if (logfile2) {
va_start(args, s);
- fprintf(logfile2, "* ");
+ printLogHeader(level, logfile2);
vfprintf(logfile2, s, args);
fprintf(logfile2, "\n");
fflush(logfile2);
@@ -59,6 +91,7 @@ void logMessage(const char * s, ...) {
return;
}
+
void openLog(int useLocal) {
int flags, fd;
@@ -92,5 +125,5 @@ void closeLog(void) {
/* set the level. higher means you see more verbosity */
void setLogLevel(int level) {
- loglevel = level;
+ minLevel = level;
}
diff --git a/loader2/log.h b/loader2/log.h
index 4a6876f35..71cafba1c 100644
--- a/loader2/log.h
+++ b/loader2/log.h
@@ -3,9 +3,16 @@
#include <stdio.h>
-void logMessage(const char * s, ...) __attribute__ ((format (printf, 1, 2)));;
+#define DEBUGLVL 10
+#define INFO 20
+#define WARNING 30
+#define ERROR 40
+#define CRITICAL 50
+
+void logMessage(int level, const char * s, ...)
+ __attribute__ ((format (printf, 2, 3)));
void openLog(int useLocal);
void closeLog(void);
-void setLogLevel(int level);
+void setLogLevel(int minLevel);
#endif /* _LOG_H_ */
diff --git a/loader2/mediacheck.c b/loader2/mediacheck.c
index 65daaccd3..1c74049c6 100644
--- a/loader2/mediacheck.c
+++ b/loader2/mediacheck.c
@@ -92,7 +92,7 @@ int parsepvd(int isofd, char *mediasum, int *skipsectors, long long *isosize, in
mediasum[32] = '\0';
md5fnd = 1;
- logMessage("MD5SUM -> %s", mediasum);
+ logMessage(INFO, "MD5SUM -> %s", mediasum);
loc += 45;
for (p=buf2+loc; *p != ';' && loc < 512; p++, loc++);
@@ -109,14 +109,14 @@ int parsepvd(int isofd, char *mediasum, int *skipsectors, long long *isosize, in
*p = '\0';
- /* logMessage("SKIPSECTORS -> |%s|", tmpbuf); */
+ /* logMessage(DEBUGLVL, "SKIPSECTORS -> |%s|", tmpbuf); */
*skipsectors = strtol(tmpbuf, &errptr, 10);
if (errptr && *errptr) {
- logMessage("Could not parse |%s|", errptr);
+ logMessage(ERROR, "Could not parse |%s|", errptr);
return -1;
} else {
- logMessage("skipsectors = %d", *skipsectors);
+ logMessage(INFO, "skipsectors = %d", *skipsectors);
skipfnd = 1;
}
@@ -124,12 +124,12 @@ int parsepvd(int isofd, char *mediasum, int *skipsectors, long long *isosize, in
} else if (!strncmp(buf2 + loc, "RHLISOSTATUS=1", 14)) {
*supported = 1;
supportedfnd = 1;
- logMessage("supported = 1");
+ logMessage(INFO, "supported = 1");
for (p=buf2+loc; *p != ';' && loc < 512; p++, loc++);
} else if (!strncmp(buf2 + loc, "RHLISOSTATUS=0", 14)) {
*supported = 0;
supportedfnd = 1;
- logMessage("supported = 0");
+ logMessage(INFO, "supported = 0");
for (p=buf2+loc; *p != ';' && loc < 512; p++, loc++);
} else if (!strncmp(buf2 + loc, "FRAGMENT SUMS = ", 16)) {
/* make sure we dont walk off end */
@@ -401,15 +401,15 @@ int mediaCheckFile(char *file, char *descr) {
"and try again. If this test continues to fail you "
"should not continue the install.");
- logMessage("mediacheck: %s (%s) FAILED", file, descr);
- logMessage("value of supported iso flag is %d", supported);
+ logMessage(ERROR, "mediacheck: %s (%s) FAILED", file, descr);
+ logMessage(ERROR, "value of supported iso flag is %d", supported);
} else if (rc > 0) {
result = _("PASS.\n\nIt is OK to install from this media.");
- logMessage("mediacheck: %s (%s) PASSED", file, descr);
- logMessage("value of supported iso flag is %d", supported);
+ logMessage(INFO, "mediacheck: %s (%s) PASSED", file, descr);
+ logMessage(INFO, "value of supported iso flag is %d", supported);
} else {
result = _("NA.\n\nNo checksum information available, unable to verify media.");
- logMessage("mediacheck: %s (%s) has no checksum info", file, descr);
+ logMessage(WARNING, "mediacheck: %s (%s) has no checksum info", file, descr);
}
newtCenteredWindow(60, 20, _("Media Check Result"));
diff --git a/loader2/method.c b/loader2/method.c
index 69ba63860..f6978923c 100644
--- a/loader2/method.c
+++ b/loader2/method.c
@@ -52,14 +52,14 @@ int umountLoopback(char * mntpoint, char * device) {
umount(mntpoint);
- logMessage("umounting loopback %s %s", mntpoint, device);
+ logMessage(INFO, "umounting loopback %s %s", mntpoint, device);
devMakeInode(device, "/tmp/loop");
loopfd = open("/tmp/loop", O_RDONLY);
if (ioctl(loopfd, LOOP_CLR_FD, 0) == -1)
- logMessage("LOOP_CLR_FD failed for %s %s (%s)", mntpoint, device,
- strerror(errno));
+ logMessage(ERROR, "LOOP_CLR_FD failed for %s %s (%s)", mntpoint,
+ device, strerror(errno));
close(loopfd);
@@ -84,7 +84,7 @@ int mountLoopback(char * fsystem, char * mntpoint, char * device) {
#endif
targfd = open(fsystem, O_RDONLY);
if (targfd == -1) {
- logMessage("open file to loop mount %s failed", fsystem);
+ logMessage(ERROR, "open file to loop mount %s failed", fsystem);
return LOADER_ERROR;
}
#ifdef O_DIRECT
@@ -94,14 +94,14 @@ int mountLoopback(char * fsystem, char * mntpoint, char * device) {
devMakeInode(device, filename);
loopfd = open(filename, O_RDONLY);
if (loopfd == -1) {
- logMessage("unable to open loop device %s", filename);
+ logMessage(ERROR, "unable to open loop device %s", filename);
return LOADER_ERROR;
}
- logMessage("mntloop %s on %s as %s fd is %d",
+ logMessage(INFO, "mntloop %s on %s as %s fd is %d",
device, mntpoint, fsystem, loopfd);
if (ioctl(loopfd, LOOP_SET_FD, targfd)) {
- logMessage("LOOP_SET_FD failed: %s", strerror(errno));
+ logMessage(ERROR, "LOOP_SET_FD failed: %s", strerror(errno));
ioctl(loopfd, LOOP_CLR_FD, 0);
close(targfd);
close(loopfd);
@@ -114,7 +114,7 @@ int mountLoopback(char * fsystem, char * mntpoint, char * device) {
strncpy(loopInfo.lo_name, basename(fsystem), 63);
if (ioctl(loopfd, LOOP_SET_STATUS, &loopInfo)) {
- logMessage("LOOP_SET_STATUS failed: %s", strerror(errno));
+ logMessage(ERROR, "LOOP_SET_STATUS failed: %s", strerror(errno));
close(loopfd);
return LOADER_ERROR;
}
@@ -131,8 +131,7 @@ int mountLoopback(char * fsystem, char * mntpoint, char * device) {
0, NULL, NULL, 0, 0)) {
if (doPwMount(filename, mntpoint, "vfat", 1,
0, NULL, NULL, 0, 0)) {
- logMessage("failed to mount loop: %s",
- strerror(errno));
+ logMessage(ERROR, "failed to mount loop: %s", strerror(errno));
loopfd = open(filename, O_RDONLY);
ioctl(loopfd, LOOP_CLR_FD, 0);
close(loopfd);
@@ -170,7 +169,7 @@ char * validIsoImages(char * dirName, int *foundinvalid) {
}
if (mountLoopback(isoImage, "/tmp/loopimage", "loop7")) {
- logMessage("failed to mount %s", isoImage);
+ logMessage(ERROR, "failed to mount %s", isoImage);
errno = 0;
continue;
}
@@ -184,7 +183,7 @@ char * validIsoImages(char * dirName, int *foundinvalid) {
umountLoopback("/tmp/loopimage", "loop7");
break;
}
- logMessage("disc %s is not the right image", isoImage);
+ logMessage(ERROR, "disc %s is not the right image", isoImage);
umountLoopback("/mnt/runtime", "loop0");
if (foundinvalid) *foundinvalid = 1;
}
@@ -219,17 +218,20 @@ int readStampFileFromIso(char *file, char **timestamp, char **releasedescr) {
filetype = 1;
if (doPwMount(file, "/tmp/testmnt",
"iso9660", 1, 0, NULL, NULL, 0, 0)) {
- logMessage("Failed to mount device %s to get description", file);
+ logMessage(ERROR, "Failed to mount device %s to get description",
+ file);
return -1;
}
} else if (S_ISREG(sb.st_mode)) {
filetype = 2;
if (mountLoopback(file, "/tmp/testmnt", "loop6")) {
- logMessage("Failed to mount iso %s to get description", file);
+ logMessage(ERROR, "Failed to mount iso %s to get description",
+ file);
return -1;
}
} else {
- logMessage("Unknown type of file %s to get description", file);
+ logMessage(ERROR, "Unknown type of file %s to get description",
+ file);
return -1;
}
@@ -365,9 +367,9 @@ void queryIsoMediaCheck(char *isoFile, int flags) {
isoDir = strdup(dirname(tmpstr));
free(tmpstr);
- logMessage("isoFile = %s", isoFile);
- logMessage("isoDir = %s", isoDir);
- logMessage("Master Timestemp = %s", master_timestamp);
+ logMessage(INFO, "isoFile = %s", isoFile);
+ logMessage(INFO, "isoDir = %s", isoDir);
+ logMessage(INFO, "Master Timestemp = %s", master_timestamp);
if (!(dir = opendir(isoDir))) {
newtWinMessage(_("Error"), _("OK"),
@@ -421,7 +423,7 @@ void queryIsoMediaCheck(char *isoFile, int flags) {
tmpmessage);
if (rc == 2) {
- logMessage("mediacheck: skipped checking of %s", isoImage);
+ logMessage(INFO, "mediacheck: skipped checking of %s", isoImage);
if (tdescr)
free(tdescr);
continue;
@@ -472,25 +474,25 @@ int copyDirectory(char * from, char * to) {
lstat(filespec, &sb);
if (S_ISDIR(sb.st_mode)) {
- logMessage("recursively copying %s", filespec);
+ logMessage(INFO, "recursively copying %s", filespec);
if (copyDirectory(filespec, filespec2)) return 1;
} else if (S_ISLNK(sb.st_mode)) {
i = readlink(filespec, link, sizeof(link) - 1);
link[i] = '\0';
if (symlink(link, filespec2)) {
- logMessage("failed to symlink %s to %s: %s",
+ logMessage(ERROR, "failed to symlink %s to %s: %s",
filespec2, link, strerror(errno));
}
} else {
fd = open(filespec, O_RDONLY);
if (fd == -1) {
- logMessage("failed to open %s: %s", filespec,
+ logMessage(ERROR, "failed to open %s: %s", filespec,
strerror(errno));
return 1;
}
outfd = open(filespec2, O_RDWR | O_TRUNC | O_CREAT, 0644);
if (outfd == -1) {
- logMessage("failed to create %s: %s", filespec2,
+ logMessage(ERROR, "failed to create %s: %s", filespec2,
strerror(errno));
} else {
fchmod(outfd, sb.st_mode & 07777);
@@ -621,7 +623,7 @@ int copyFileAndLoopbackMount(int fd, char * dest, int flags,
rc = copyFileFd(fd, dest);
stat(dest, &sb);
- logMessage("copied %" PRId64 " bytes to %s (%s)", sb.st_size, dest,
+ logMessage(INFO, "copied %" PRId64 " bytes to %s (%s)", sb.st_size, dest,
((rc) ? " incomplete" : "complete"));
if (rc) {
@@ -632,8 +634,8 @@ int copyFileAndLoopbackMount(int fd, char * dest, int flags,
if (mountLoopback(dest, mntpoint, device)) {
/* JKFIXME: this used to be fatal, but that seems unfriendly */
- logMessage("Error mounting /dev/%s on %s (%s)", device, mntpoint,
- strerror(errno));
+ logMessage(ERROR, "Error mounting /dev/%s on %s (%s)", device,
+ mntpoint, strerror(errno));
unlink(dest);
return 1;
}
@@ -651,7 +653,7 @@ int getFileFromBlockDevice(char *device, char *path, char * dest) {
int rc;
char file[4096];
- logMessage("getFileFromBlockDevice(%s, %s)", device, path);
+ logMessage(INFO, "getFileFromBlockDevice(%s, %s)", device, path);
if (devMakeInode(device, "/tmp/srcdev"))
return 1;
@@ -659,19 +661,20 @@ int getFileFromBlockDevice(char *device, char *path, char * dest) {
if ((doPwMount("/tmp/srcdev", "/tmp/mnt", "vfat", 1, 0, NULL, NULL, 0, 0)) &&
doPwMount("/tmp/srcdev", "/tmp/mnt", "ext2", 1, 0, NULL, NULL, 0, 0) &&
doPwMount("/tmp/srcdev", "/tmp/mnt", "iso9660", 1, 0, NULL, NULL, 0, 0)) {
- logMessage("failed to mount /dev/%s: %s", device, strerror(errno));
+ logMessage(ERROR, "failed to mount /dev/%s: %s", device,
+ strerror(errno));
return 2;
}
snprintf(file, sizeof(file), "/tmp/mnt/%s", path);
- logMessage("Searching for file on path %s", file);
+ logMessage(INFO, "Searching for file on path %s", file);
if (access(file, R_OK)) {
rc = 3;
} else {
copyFile(file, dest);
rc = 0;
- logMessage("file copied to %s", dest);
+ logMessage(INFO, "file copied to %s", dest);
}
umount("/tmp/mnt");
diff --git a/loader2/modstubs.c b/loader2/modstubs.c
index f27999585..f4a345411 100644
--- a/loader2/modstubs.c
+++ b/loader2/modstubs.c
@@ -114,19 +114,19 @@ int ourInsmodCommand(int argc, char ** argv) {
free(ballPath);
if (stat(file, &sb) == -1) {
- logMessage("unable to stat file %s: %s", file, strerror(errno));
+ logMessage(ERROR, "unable to stat file %s: %s", file, strerror(errno));
return 1;
}
fd = open(file, O_RDONLY);
if (fd < 0) {
- logMessage("unable to open file %s: %s", file, strerror(errno));
+ logMessage(ERROR, "unable to open file %s: %s", file, strerror(errno));
return 1;
}
modbuf = mmap(0, sb.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
if (modbuf == NULL) {
- logMessage("error reading file %s: %s", file, strerror(errno));
+ logMessage(ERROR, "error reading file %s: %s", file, strerror(errno));
return 1;
}
@@ -137,7 +137,7 @@ int ourInsmodCommand(int argc, char ** argv) {
rc = init_module(modbuf, sb.st_size, "");
}
if (rc != 0)
- logMessage("failed to insert module (%d)", errno);
+ logMessage(ERROR, "failed to insert module (%d)", errno);
return rc;
}
diff --git a/loader2/modules.c b/loader2/modules.c
index d190b153a..d86070631 100644
--- a/loader2/modules.c
+++ b/loader2/modules.c
@@ -284,7 +284,7 @@ static int loadModule(const char * modName, struct extractedModule * path,
}
if (FL_TESTING(flags)) {
- logMessage("would have insmod %s (%s)", path->path, fileName);
+ logMessage(INFO, "would have insmod %s (%s)", path->path, fileName);
rc = 0;
} else {
if (!(child = fork())) {
@@ -339,12 +339,12 @@ static int loadModule(const char * modName, struct extractedModule * path,
if (!strcmp(modName, "usb-storage") && usbWasLoaded == 0) {
int slp;
usbWasLoaded++;
- logMessage("sleeping for usb-storage stabilize...");
+ logMessage(INFO, "sleeping for usb-storage stabilize...");
for (slp = 0; slp < 10; slp++) {
if (scsiDiskCount() > 0) break;
sleep(2);
}
- logMessage("slept %d seconds", slp * 2);
+ logMessage(INFO, "slept %d seconds", slp * 2);
}
modLoaded->mods[num].firstDevNum = deviceCount;
modLoaded->mods[num].lastDevNum = scsiDiskCount();
@@ -480,7 +480,7 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded,
list = tsortModules(modLoaded, modDeps, initialList, 0, NULL, NULL);
if (!list) {
- logMessage("ERROR: loop in module dependencies; not inserting");
+ logMessage(ERROR, "loop in module dependencies; not inserting");
return 1;
}
list = lateModuleSort(list, i);
@@ -490,7 +490,7 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded,
strcat(items, list[i]);
}
- logMessage("modules to insert%s", items);
+ logMessage(INFO, "modules to insert%s", items);
paths = NULL;
reloadUsbStorage = 0;
@@ -518,7 +518,7 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded,
i = 0;
if (!paths) {
- logMessage("no modules found -- aborting insertion");
+ logMessage(ERROR, "no modules found -- aborting insertion");
return i;
}
@@ -531,7 +531,7 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded,
}
}
- if (*items) logMessage("module(s) %s not found", items);
+ if (*items) logMessage(WARNING, "module(s) %s not found", items);
if (reloadUsbStorage) {
mod = getLoadedModuleInfo(modLoaded, "usb-storage");
@@ -542,7 +542,7 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded,
}
if (mod->lastDevNum != scsiDiskCount()) {
- logMessage("usb-storage isn't claiming the last scsi dev (%d vs %d)", modLoaded->mods[i].lastDevNum, scsiDiskCount());
+ logMessage(WARNING, "usb-storage isn't claiming the last scsi dev (%d vs %d)", modLoaded->mods[i].lastDevNum, scsiDiskCount());
/* JKFIXME: return? or not, because of firewire */
}
@@ -567,9 +567,9 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded,
if (loadModule(*l, p, modLoaded,
(argModule && !strcmp(argModule, *l)) ? args : NULL,
modInfo, flags)) {
- logMessage("failed to insert %s", p->path);
+ logMessage(ERROR, "failed to insert %s", p->path);
} else {
- logMessage("inserted %s", p->path);
+ logMessage(INFO, "inserted %s", p->path);
}
}
@@ -585,7 +585,7 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded,
fd = open("/tmp/modprobe.conf", O_WRONLY | O_CREAT | O_APPEND, 0666);
if (fd == -1) {
- logMessage("error appending to /tmp/modprobe.conf: %s\n",
+ logMessage(ERROR, "error appending to /tmp/modprobe.conf: %s\n",
strerror(errno));
} else {
writeModulesConf(modLoaded, fd);
@@ -602,7 +602,7 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded,
free(paths);
free(list);
- logMessage("load module set done");
+ logMessage(INFO, "load module set done");
return i;
}
@@ -684,7 +684,7 @@ static int writeModulesConf(moduleList list, int fd) {
tmp = "tr";
break;
default:
- logMessage("WARNING: got net driver that's not ethernet or tr");
+ logMessage(WARNING, "got net driver that's not ethernet or tr");
tmp = "";
}
@@ -740,7 +740,7 @@ void writeScsiDisks(moduleList list) {
if (!list) return;
if ((fd = open("/tmp/scsidisks", O_WRONLY | O_CREAT, 0666)) == -1) {
- logMessage("error opening /tmp/scsidisks: %s", strerror(errno));
+ logMessage(ERROR, "error opening /tmp/scsidisks: %s", strerror(errno));
return;
}
@@ -790,8 +790,8 @@ char * getModuleLocation(int version) {
arch[sb.st_size] = '\0';
close(fd);
} else if (!arch) {
- logMessage("can't find arch file %s, defaulting to %s", archfile,
- u.machine);
+ logMessage(WARNING, "can't find arch file %s, defaulting to %s",
+ archfile, u.machine);
arch = strdup(u.machine);
}
@@ -832,7 +832,7 @@ static struct extractedModule * extractModules (char * const * modNames,
fd = gunzip_open(ballPath);
if (!fd) {
- logMessage("failed to open %s", ballPath);
+ logMessage(ERROR, "failed to open %s", ballPath);
free(ballPath);
return NULL;
}
@@ -881,12 +881,12 @@ static struct extractedModule * extractModules (char * const * modNames,
if (location && location->path) {
oldPaths[i].location = strdup(location->path);
if (location->title)
- logMessage("module %s found on driver disk %s",
+ logMessage(INFO, "module %s found on driver disk %s",
modNames[i], location->title);
- logMessage("loaded %s from %s", modNames[i],
+ logMessage(INFO, "loaded %s from %s", modNames[i],
location->path);
} else
- logMessage("loaded %s from /modules/modules.cgz", modNames[i]);
+ logMessage(INFO, "loaded %s from /modules/modules.cgz", modNames[i]);
}
numMaps++;
}
@@ -918,10 +918,10 @@ int removeLoadedModule(const char * modName, moduleList modLoaded,
mod->lastDevNum = 0;
if (FL_TESTING(flags)) {
- logMessage("would have rmmod %s", modName);
+ logMessage(INFO, "would have rmmod %s", modName);
rc = 0;
} else {
- logMessage("going to rmmod %s", modName);
+ logMessage(INFO, "going to rmmod %s", modName);
if (!(child = fork())) {
int fd = open("/dev/tty3", O_RDWR);
@@ -991,8 +991,8 @@ void loadKickstartModule(struct loaderData_s * loaderData, int argc,
module = (char *) poptGetArg(optCon);
if (!type || !module) {
- logMessage("type and module should be specified for kickstart device "
- "command");
+ logMessage(WARNING, "type and module should be specified for kickstart "
+ "device command");
}
if (opts) {
diff --git a/loader2/net.c b/loader2/net.c
index cc4b5a2a5..a9e48bd23 100644
--- a/loader2/net.c
+++ b/loader2/net.c
@@ -128,14 +128,14 @@ static int waitForLink(char * dev) {
/* try to wait for a valid link -- if the status is unknown or
* up continue, else sleep for 1 second and try again for up
* to five times */
- logMessage("waiting for link...");
+ logMessage(INFO, "waiting for link...");
while (tries < num_link_checks) {
if (get_link_status(dev) != 0)
break;
sleep(1);
tries++;
}
- logMessage("%d seconds.", tries);
+ logMessage(INFO, "%d seconds.", tries);
if (tries < num_link_checks)
return 0;
return 1;
@@ -159,7 +159,7 @@ static void parseEthtoolSettings(struct loaderData_s * loaderData) {
else if (!strncmp(option + 7, "half", 4))
duplex = ETHTOOL_DUPLEX_HALF;
else
- logMessage("Unknown duplex setting: %s", option + 7);
+ logMessage(WARNING, "Unknown duplex setting: %s", option + 7);
option = strtok(NULL, " ");
} else if (!strncmp("speed", option, 5)) {
if (!strncmp(option + 6, "1000", 4))
@@ -169,10 +169,10 @@ static void parseEthtoolSettings(struct loaderData_s * loaderData) {
else if (!strncmp(option + 6, "10", 2))
speed = ETHTOOL_SPEED_10;
else
- logMessage("Unknown speed setting: %s", option + 6);
+ logMessage(WARNING, "Unknown speed setting: %s", option + 6);
option = strtok(NULL, " ");
} else {
- logMessage("Unknown ethtool setting: %s", option);
+ logMessage(WARNING, "Unknown ethtool setting: %s", option);
}
option = strtok(NULL, " ");
}
@@ -285,17 +285,17 @@ static int getDnsServers(struct networkDeviceConfig * cfg) {
}
void printLoaderDataIPINFO(struct loaderData_s *loaderData) {
- logMessage("loaderData->ipinfo_set = %d", loaderData->ipinfo_set);
- logMessage("loaderData->ip = %s", loaderData->ip);
- logMessage("loaderData->netmask = %s", loaderData->netmask);
- logMessage("loaderData->gateway = %s", loaderData->gateway);
- logMessage("loaderData->dns = %s", loaderData->dns);
- logMessage("loaderData->hostname = %s", loaderData->hostname);
- logMessage("loaderData->noDns = %d", loaderData->noDns);
- logMessage("loaderData->netDev_set = %d", loaderData->netDev_set);
- logMessage("loaderData->netDev = %s", loaderData->netDev);
- logMessage("loaderData->netCls_set = %d", loaderData->netCls_set);
- logMessage("loaderData->netCls = %s", loaderData->netCls);
+ logMessage(DEBUGLVL, "loaderData->ipinfo_set = %d", loaderData->ipinfo_set);
+ logMessage(DEBUGLVL, "loaderData->ip = %s", loaderData->ip);
+ logMessage(DEBUGLVL, "loaderData->netmask = %s", loaderData->netmask);
+ logMessage(DEBUGLVL, "loaderData->gateway = %s", loaderData->gateway);
+ logMessage(DEBUGLVL, "loaderData->dns = %s", loaderData->dns);
+ logMessage(DEBUGLVL, "loaderData->hostname = %s", loaderData->hostname);
+ logMessage(DEBUGLVL, "loaderData->noDns = %d", loaderData->noDns);
+ logMessage(DEBUGLVL, "loaderData->netDev_set = %d", loaderData->netDev_set);
+ logMessage(DEBUGLVL, "loaderData->netDev = %s", loaderData->netDev);
+ logMessage(DEBUGLVL, "loaderData->netCls_set = %d", loaderData->netCls_set);
+ logMessage(DEBUGLVL, "loaderData->netCls = %s", loaderData->netCls);
}
/* given loader data from kickstart, populate network configuration struct */
@@ -317,11 +317,12 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg,
if (loaderData->ip) {
if (is_wireless_interface(loaderData->netDev)) {
if (loaderData->essid) {
- logMessage("setting specified essid of %s", loaderData->essid);
+ logMessage(INFO, "setting specified essid of %s",
+ loaderData->essid);
cfg->essid = strdup(loaderData->essid);
}
if (loaderData->wepkey) {
- logMessage("setting specified wepkey");
+ logMessage(INFO, "setting specified wepkey");
cfg->wepkey = strdup(loaderData->wepkey);
}
/* go ahead and set up the wireless interface in case
@@ -335,7 +336,8 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg,
/* JKFIXME: this soooo doesn't belong here. and it needs to
* be broken out into a function too */
- logMessage("sending dhcp request through device %s", loaderData->netDev);
+ logMessage(INFO, "sending dhcp request through device %s",
+ loaderData->netDev);
if (!FL_CMDLINE(flags)) {
startNewt(flags);
@@ -358,7 +360,7 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg,
newtPopWindow();
if (chptr) {
- logMessage("pump told us: %s", chptr);
+ logMessage(INFO, "pump told us: %s", chptr);
return;
}
@@ -395,16 +397,17 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg,
(inet_aton(c,&addr))) {
cfg->dev.dnsServers[cfg->dev.numDns] = addr;
cfg->dev.numDns++;
- logMessage("adding %s", inet_ntoa(addr));
+ logMessage(INFO, "adding %s", inet_ntoa(addr));
c = strtok(NULL, ",");
}
- logMessage("dnsservers is %s", loaderData->dns);
+ logMessage(INFO, "dnsservers is %s", loaderData->dns);
if (cfg->dev.numDns)
cfg->dev.set |= PUMP_NETINFO_HAS_DNS;
}
if (loaderData->hostname) {
- logMessage("setting specified hostname of %s", loaderData->hostname);
+ logMessage(INFO, "setting specified hostname of %s",
+ loaderData->hostname);
cfg->dev.hostname = strdup(loaderData->hostname);
cfg->dev.set |= PUMP_NETINFO_HAS_HOSTNAME;
}
@@ -456,7 +459,7 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg,
/* JKFIXME: we really need a way to override this and be able to change
* our network config */
if (!FL_TESTING(flags) && cfg->preset) {
- logMessage("doing kickstart... setting it up");
+ logMessage(INFO, "doing kickstart... setting it up");
configureNetwork(cfg);
findHostAndDomain(cfg, flags);
@@ -466,7 +469,7 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg,
}
if (is_wireless_interface(device)) {
- logMessage("%s is a wireless adaptor", device);
+ logMessage(INFO, "%s is a wireless adaptor", device);
if (getWirelessConfig(cfg, device) == LOADER_BACK)
return LOADER_BACK;
/* FIXME: this is a bit of a hack */
@@ -474,7 +477,8 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg,
newCfg.essid = cfg->essid;
newCfg.wepkey = cfg->wepkey;
}
- else logMessage("%s isn't a wireless adaptor", device);
+ else
+ logMessage(INFO, "%s isn't a wireless adaptor", device);
text = newtTextboxReflowed(-1, -1,
_("Please enter the IP configuration for this machine. Each "
@@ -606,14 +610,14 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg,
if (!chptr) {
newCfg.isDynamic = 1;
if (!(newCfg.dev.set & PUMP_NETINFO_HAS_DNS)) {
- logMessage("pump worked, but didn't return a DNS server");
+ logMessage(WARNING, "pump worked, but didn't return a DNS server");
i = getDnsServers(&newCfg);
i = i ? 0 : 2;
} else {
i = 2;
}
} else {
- logMessage("pump told us: %s", chptr);
+ logMessage(INFO, "pump told us: %s", chptr);
i = 0;
}
}
@@ -657,14 +661,15 @@ static int setupWireless(struct networkDeviceConfig *dev) {
return 0;
if (dev->essid) {
- logMessage("setting essid for %s to %s", dev->dev.device, dev->essid);
+ logMessage(INFO, "setting essid for %s to %s", dev->dev.device,
+ dev->essid);
if (set_essid(dev->dev.device, dev->essid) < 0) {
- logMessage("failed to set essid: %s", strerror(errno));
+ logMessage(ERROR, "failed to set essid: %s", strerror(errno));
}
if (dev->wepkey) {
- logMessage("setting encryption key for %s", dev->dev.device);
+ logMessage(INFO, "setting encryption key for %s", dev->dev.device);
if (set_wep_key(dev->dev.device, dev->wepkey) < 0) {
- logMessage("failed to set wep key: %s", strerror(errno));
+ logMessage(ERROR, "failed to set wep key: %s", strerror(errno));
}
}
@@ -681,7 +686,7 @@ char * setupInterface(struct networkDeviceConfig *dev) {
char * doDhcp(char * ifname,
struct networkDeviceConfig *dev, char * dhcpclass) {
setupWireless(dev);
- logMessage("running dhcp for %s", ifname);
+ logMessage(INFO, "running dhcp for %s", ifname);
return pumpDhcpClassRun(ifname, 0, 0, NULL,
dhcpclass ? dhcpclass : "anaconda",
&dev->dev, NULL);
@@ -694,7 +699,7 @@ int configureNetwork(struct networkDeviceConfig * dev) {
rc = setupInterface(dev);
if (rc)
- logMessage("result of pumpSetupInterface is %s", rc);
+ logMessage(INFO, "result of pumpSetupInterface is %s", rc);
if (dev->dev.set & PUMP_NETINFO_HAS_GATEWAY)
pumpSetupDefaultGateway(&dev->dev.gateway);
@@ -776,7 +781,7 @@ int writeResolvConf(struct networkDeviceConfig * net) {
f = fopen(filename, "w");
if (!f) {
- logMessage("Cannot create %s: %s\n", filename, strerror(errno));
+ logMessage(ERROR, "Cannot create %s: %s\n", filename, strerror(errno));
return LOADER_ERROR;
}
@@ -801,7 +806,7 @@ int findHostAndDomain(struct networkDeviceConfig * dev, int flags) {
}
if (dev->dev.numDns == 0) {
- logMessage("no DNS servers, can't look up hostname");
+ logMessage(ERROR, "no DNS servers, can't look up hostname");
return 1;
}
@@ -818,11 +823,11 @@ int findHostAndDomain(struct networkDeviceConfig * dev, int flags) {
newtPopWindow();
if (!name) {
- logMessage("reverse name lookup failed");
+ logMessage(ERROR, "reverse name lookup failed");
return 1;
}
- logMessage("reverse name lookup worked");
+ logMessage(INFO, "reverse name lookup worked");
dev->dev.hostname = strdup(name);
dev->dev.set |= PUMP_NETINFO_HAS_HOSTNAME;
@@ -975,7 +980,7 @@ int chooseNetworkInterface(struct loaderData_s * loaderData,
devs = probeDevices(CLASS_NETWORK, BUS_UNSPEC, PROBE_LOADED);
if (!devs) {
- logMessage("no network devices in choose network device!");
+ logMessage(ERROR, "no network devices in choose network device!");
return LOADER_ERROR;
}
@@ -1028,32 +1033,32 @@ int chooseNetworkInterface(struct loaderData_s * loaderData,
/* ASSERT: we should *ALWAYS* have a network device when we get here */
if (!deviceNums) {
- logMessage("ASSERT: no network device in chooseNetworkInterface");
+ logMessage(CRITICAL, "no network device in chooseNetworkInterface");
return LOADER_ERROR;
}
/* JKFIXME: if we only have one interface and it doesn't have link,
* do we go ahead? */
if (deviceNums == 1) {
- logMessage("only have one network device: %s", devices[0]);
+ logMessage(INFO, "only have one network device: %s", devices[0]);
loaderData->netDev = devices[0];
return LOADER_NOOP;
}
if ((loaderData->netDev && (loaderData->netDev_set) == 1) &&
!strcmp(loaderData->netDev, "link")) {
- logMessage("looking for first netDev with link");
+ logMessage(INFO, "looking for first netDev with link");
for (rc = 0; rc < 5; rc++) {
for (i = 0; i < deviceNums; i++) {
if (get_link_status(devices[i]) == 1) {
loaderData->netDev = devices[i];
- logMessage("%s has link, using it", devices[i]);
+ logMessage(INFO, "%s has link, using it", devices[i]);
return LOADER_NOOP;
}
}
sleep(1);
}
- logMessage("wanted netdev with link, but none present. prompting");
+ logMessage(WARNING, "wanted netdev with link, but none present. prompting");
}
startNewt(flags);
@@ -1105,7 +1110,7 @@ int kickstartNetworkUp(struct loaderData_s * loaderData,
if (rc == LOADER_ERROR) {
/* JKFIXME: ask for a driver disk? */
- logMessage("no network drivers for doing kickstart");
+ logMessage(ERROR, "no network drivers for doing kickstart");
return -1;
} else if (rc == LOADER_BACK) {
return -1;
@@ -1134,7 +1139,7 @@ int kickstartNetworkUp(struct loaderData_s * loaderData,
rc = readNetConfig(loaderData->netDev, netCfgPtr, loaderData->netCls,
flags);
if ((rc == LOADER_BACK) || (rc == LOADER_ERROR)) {
- logMessage("unable to setup networking");
+ logMessage(ERROR, "unable to setup networking");
return -1;
}
diff --git a/loader2/nfsinstall.c b/loader2/nfsinstall.c
index 6a702d0e6..7e0f64b25 100644
--- a/loader2/nfsinstall.c
+++ b/loader2/nfsinstall.c
@@ -90,17 +90,17 @@ char * mountNfsImage(struct installMethod * method,
while (stage != NFS_STAGE_DONE) {
switch (stage) {
case NFS_STAGE_NFS:
- logMessage("going to do nfsGetSetup");
+ logMessage(INFO, "going to do nfsGetSetup");
if (loaderData->method && *loaderData->method &&
!strncmp(loaderData->method, "nfs", 3) &&
loaderData->methodData) {
host = ((struct nfsInstallData *)loaderData->methodData)->host;
directory = ((struct nfsInstallData *)loaderData->methodData)->directory;
- logMessage("host is %s, dir is %s", host, directory);
+ logMessage(INFO, "host is %s, dir is %s", host, directory);
if (!host || !directory) {
- logMessage("missing host or directory specification");
+ logMessage(ERROR, "missing host or directory specification");
free(loaderData->method);
loaderData->method = NULL;
break;
@@ -123,7 +123,7 @@ char * mountNfsImage(struct installMethod * method,
fullPath = alloca(strlen(host) + strlen(directory) + 2);
sprintf(fullPath, "%s:%s", host, directory);
- logMessage("mounting nfs path %s", fullPath);
+ logMessage(INFO, "mounting nfs path %s", fullPath);
if (FL_TESTING(flags)) {
stage = NFS_STAGE_DONE;
@@ -136,16 +136,16 @@ char * mountNfsImage(struct installMethod * method,
if (!doPwMount(fullPath, "/mnt/source", "nfs", 1, 0, NULL, NULL, 0, 0)) {
char mntPath[1024];
- logMessage("mounted %s on /mnt/source", fullPath);
+ logMessage(INFO, "mounted %s on /mnt/source", fullPath);
snprintf(mntPath, sizeof(mntPath), "/mnt/source/%s/base/stage2.img", getProductPath());
if (!access(mntPath, R_OK)) {
- logMessage("can access %s", mntPath);
+ logMessage(INFO, "can access %s", mntPath);
rc = mountStage2(mntPath);
- logMessage("after mountStage2, rc is %d", rc);
+ logMessage(INFO, "after mountStage2, rc is %d", rc);
if (rc) {
if (rc == -1) {
foundinvalid = 1;
- logMessage("not the right one");
+ logMessage(WARNING, "not the right one");
}
} else {
stage = NFS_STAGE_DONE;
@@ -153,16 +153,16 @@ char * mountNfsImage(struct installMethod * method,
break;
}
} else {
- logMessage("unable to access %s", mntPath);
+ logMessage(WARNING, "unable to access %s", mntPath);
}
if ((path = validIsoImages("/mnt/source", &foundinvalid))) {
foundinvalid = 0;
- logMessage("Path to valid iso is %s", path);
+ logMessage(INFO, "Path to valid iso is %s", path);
copyUpdatesImg("/mnt/source/updates.img");
if (mountLoopback(path, "/mnt/source2", "loop1"))
- logMessage("failed to mount iso %s loopback", path);
+ logMessage(ERROR, "failed to mount iso %s loopback", path);
else {
snprintf(mntPath, sizeof(mntPath), "/mnt/source2/%s/base/stage2.img", getProductPath());
rc = mountStage2(mntPath);
@@ -241,7 +241,7 @@ void setKickstartNfs(struct loaderData_s * loaderData, int argc,
{ 0, 0, 0, 0, 0, 0, 0 }
};
- logMessage("kickstartFromNfs");
+ logMessage(INFO, "kickstartFromNfs");
optCon = poptGetContext(NULL, argc, (const char **) argv, ksNfsOptions, 0);
if ((rc = poptGetNextOpt(optCon)) < -1) {
startNewt(*flagsPtr);
@@ -254,7 +254,7 @@ void setKickstartNfs(struct loaderData_s * loaderData, int argc,
}
if (!host || !dir) {
- logMessage("host and directory for nfs kickstart not specified");
+ logMessage(ERROR, "host and directory for nfs kickstart not specified");
return;
}
@@ -265,7 +265,7 @@ void setKickstartNfs(struct loaderData_s * loaderData, int argc,
if (dir)
((struct nfsInstallData *)loaderData->methodData)->directory = dir;
- logMessage("results of nfs, host is %s, dir is %s", host, dir);
+ logMessage(INFO, "results of nfs, host is %s, dir is %s", host, dir);
}
@@ -276,7 +276,7 @@ int getFileFromNfs(char * url, char * dest, struct loaderData_s * loaderData,
struct networkDeviceConfig netCfg;
if (kickstartNetworkUp(loaderData, &netCfg, flags)) {
- logMessage("unable to bring up network");
+ logMessage(ERROR, "unable to bring up network");
return 1;
}
@@ -285,21 +285,21 @@ int getFileFromNfs(char * url, char * dest, struct loaderData_s * loaderData,
*/
if (url == NULL) {
if (!(netCfg.dev.set & PUMP_INTFINFO_HAS_NEXTSERVER)) {
- logMessage("no bootserver was found");
+ logMessage(ERROR, "no bootserver was found");
return 1;
}
if (!(netCfg.dev.set & PUMP_INTFINFO_HAS_BOOTFILE)) {
url = sdupprintf("%s:%s", inet_ntoa(netCfg.dev.nextServer),
"/kickstart/");
- logMessage("bootp: no bootfile received");
+ logMessage(ERROR, "bootp: no bootfile received");
} else {
url = sdupprintf("%s:%s", inet_ntoa(netCfg.dev.nextServer),
netCfg.dev.bootFile);
}
}
- logMessage("url is %s", url);
+ logMessage(INFO, "url is %s", url);
getHostandPath(url, &host, &path, inet_ntoa(netCfg.dev.ip));
@@ -313,7 +313,7 @@ int getFileFromNfs(char * url, char * dest, struct loaderData_s * loaderData,
host = sdupprintf("%s/%s", host, path);
}
- logMessage("file location: nfs://%s/%s", host, file);
+ logMessage(INFO, "file location: nfs://%s/%s", host, file);
if (!doPwMount(host, "/tmp/mnt", "nfs", 1, 0, NULL, NULL, 0, 0)) {
char * buf;
@@ -321,12 +321,12 @@ int getFileFromNfs(char * url, char * dest, struct loaderData_s * loaderData,
buf = alloca(strlen(file) + 10);
sprintf(buf, "/tmp/mnt/%s", file);
if (copyFile(buf, dest)) {
- logMessage("failed to copy file to %s", dest);
+ logMessage(ERROR, "failed to copy file to %s", dest);
failed = 1;
}
} else {
- logMessage("failed to mount nfs source");
+ logMessage(ERROR, "failed to mount nfs source");
failed = 1;
}
diff --git a/loader2/pcmcia.c b/loader2/pcmcia.c
index 63e43347b..ad2e957ca 100644
--- a/loader2/pcmcia.c
+++ b/loader2/pcmcia.c
@@ -41,20 +41,20 @@ char * getPcicController() {
devices = probeDevices(CLASS_SOCKET, BUS_PCI, 0);
if (devices) {
- logMessage("found cardbus pci adapter");
+ logMessage(INFO, "found cardbus pci adapter");
pcic = "yenta_socket";
} else {
devices = probeDevices(CLASS_SOCKET, BUS_MISC, 0);
if (devices && strcmp (devices[0]->driver, "ignore") &&
strcmp(devices[0]->driver, "unknown") &&
strcmp(devices[0]->driver, "disabled")) {
- logMessage("found pcmcia adapter");
+ logMessage(INFO, "found pcmcia adapter");
pcic = strdup(devices[0]->driver);
}
}
if (!pcic) {
- logMessage("no pcic controller found");
+ logMessage(WARNING, "no pcic controller found");
}
return pcic;
} else {
@@ -149,13 +149,13 @@ int activate_pcmcia_device(struct pcmciaDevice *pdev) {
int j, ret;
if (has_pcmcia() <= 0) {
- logMessage("pcmcia not loaded, can't activate module");
+ logMessage(ERROR, "pcmcia not loaded, can't activate module");
return -1;
}
fd = open_sock(pdev->slot);
if (fd < 0) {
- logMessage("unable to open slot");
+ logMessage(ERROR, "unable to open slot");
return -1;
}
@@ -163,7 +163,7 @@ int activate_pcmcia_device(struct pcmciaDevice *pdev) {
strcpy(bind->dev_info,pdev->driver);
bind->function = pdev->function;
if (ioctl(fd, DS_BIND_REQUEST, bind) == -1) {
- logMessage("failed to activate pcmcia device");
+ logMessage(ERROR, "failed to activate pcmcia device");
return LOADER_ERROR;
}
@@ -175,7 +175,7 @@ int activate_pcmcia_device(struct pcmciaDevice *pdev) {
}
if (j >= 10) {
- logMessage("activated, but unable to get device info");
+ logMessage(ERROR, "activated, but unable to get device info");
return LOADER_ERROR;
}
@@ -192,7 +192,7 @@ void startPcmciaDevices(moduleList modLoaded, int flags) {
devices = probeDevices(CLASS_UNSPEC, BUS_PCMCIA, PROBE_LOADED);
if (!devices) {
- logMessage("no devices to activate");
+ logMessage(WARNING, "no devices to activate");
return;
}
@@ -206,7 +206,7 @@ void startPcmciaDevices(moduleList modLoaded, int flags) {
if (!mlModuleInList(devices[i]->driver, modLoaded))
continue;
- logMessage("going to activate device using %s", devices[i]->driver);
+ logMessage(INFO, "going to activate device using %s", devices[i]->driver);
activate_pcmcia_device((struct pcmciaDevice *)devices[i]);
}
}
diff --git a/loader2/selinux.c b/loader2/selinux.c
index 4cf721a0e..33a861b27 100644
--- a/loader2/selinux.c
+++ b/loader2/selinux.c
@@ -40,7 +40,7 @@ static char * getpolicyver() {
buf = malloc(32);
buf = memset(buf, 0, 32);
if ((read(fd, buf, 32)) == -1) {
- logMessage("error getting policy version: %s", strerror(errno));
+ logMessage(ERROR, "error getting policy version: %s", strerror(errno));
free(buf);
close(fd);
return NULL;
@@ -88,16 +88,16 @@ int loadpolicy() {
}
if (access(fn, R_OK) || access(bfn, R_OK)) {
- logMessage("Unable to load suitable SELinux policy");
+ logMessage(ERROR, "Unable to load suitable SELinux policy");
return -1;
}
- logMessage("Loading SELinux policy from %s", fn);
+ logMessage(INFO, "Loading SELinux policy from %s", fn);
if (!(pid = fork())) {
setenv("LD_LIBRARY_PATH", LIBPATH, 1);
execl("/usr/sbin/load_policy",
"/usr/sbin/load_policy", "-q", "-b", fn, bfn, NULL);
- logMessage("exec of load_policy failed: %s", strerror(errno));
+ logMessage(ERROR, "exec of load_policy failed: %s", strerror(errno));
exit(1);
}
diff --git a/loader2/telnet.c b/loader2/telnet.c
index 28946000d..4b8cf09aa 100644
--- a/loader2/telnet.c
+++ b/loader2/telnet.c
@@ -218,7 +218,8 @@ telnet_process_input(telnet_state * ts, char *data, int len) {
break;
default:
- logMessage("unknown telnet state %d for data element %c", *ts, *s);
+ logMessage(WARNING, "unknown telnet state %d for data element %c",
+ *ts, *s);
*ts = TS_DATA;
break;
}
diff --git a/loader2/telnetd.c b/loader2/telnetd.c
index e0abdc884..e5610e409 100644
--- a/loader2/telnetd.c
+++ b/loader2/telnetd.c
@@ -59,7 +59,7 @@ int beTelnet(int flags) {
struct winsize ws;
if ((sock = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
- logMessage("socket: %s", strerror(errno));
+ logMessage(ERROR, "socket: %s", strerror(errno));
return -1;
}
@@ -99,7 +99,7 @@ int beTelnet(int flags) {
masterFd = open("/dev/ptmx", O_RDWR);
if (masterFd < 0) {
- logMessage("cannot open /dev/ptmx");
+ logMessage(CRITICAL, "cannot open /dev/ptmx");
close(conn);
return -1;
}
@@ -188,7 +188,7 @@ int beTelnet(int flags) {
if (i < 0) {
- logMessage("poll: %s", strerror(errno));
+ logMessage(ERROR, "poll: %s", strerror(errno));
}
#ifndef DEBUG_TELNET
@@ -231,11 +231,11 @@ void startTelnetd(struct loaderData_s * loaderData,
struct networkDeviceConfig netCfg;
if (kickstartNetworkUp(loaderData, &netCfg, flags)) {
- logMessage("unable to bring up network");
+ logMessage(ERROR, "unable to bring up network");
return;
}
- logMessage("going to beTelnet for %s", inet_ntoa(netCfg.dev.ip));
+ logMessage(INFO, "going to beTelnet for %s", inet_ntoa(netCfg.dev.ip));
if (!beTelnet(flags))
flags |= LOADER_FLAGS_TEXT | LOADER_FLAGS_NOSHELL;
diff --git a/loader2/urlinstall.c b/loader2/urlinstall.c
index 701b83093..b32f4e4a2 100644
--- a/loader2/urlinstall.c
+++ b/loader2/urlinstall.c
@@ -123,8 +123,8 @@ static int loadUrlImages(struct iurlinfo * ui, int flags) {
if (FL_TEXT(flags) || totalMemory() < GUI_STAGE2_RAM) {
stage2img = "netstg2.img";
if (totalMemory() < 128000)
- logMessage("URLINSTALL falling back to non-GUI stage2 due to "
- "insufficient RAM");
+ logMessage(WARNING, "URLINSTALL falling back to non-GUI stage2 "
+ "due to insufficient RAM");
} else {
stage2img = "stage2.img";
}
@@ -222,10 +222,10 @@ char * mountUrlImage(struct installMethod * method,
url = ((struct urlInstallData *)loaderData->methodData)->url;
- logMessage("URL_STAGE_MAIN - url is %s", url);
+ logMessage(INFO, "URL_STAGE_MAIN - url is %s", url);
if (!url) {
- logMessage("missing url specification");
+ logMessage(ERROR, "missing url specification");
free(loaderData->method);
loaderData->method = NULL;
break;
@@ -273,7 +273,7 @@ char * mountUrlImage(struct installMethod * method,
if (cdurl &&
(loadSingleUrlImage(&ui, "base/hdlist", flags, NULL,
NULL, NULL, 0) == 0)) {
- logMessage("Detected stage 2 image on CD");
+ logMessage(INFO, "Detected stage 2 image on CD");
winStatus(50, 3, _("Media Detected"),
_("Local installation media detected..."), 0);
sleep(3);
@@ -344,7 +344,7 @@ int getFileFromUrl(char * url, char * dest,
char * ehdrs;
if (kickstartNetworkUp(loaderData, &netCfg, flags)) {
- logMessage("unable to bring up network");
+ logMessage(ERROR, "unable to bring up network");
return 1;
}
@@ -354,7 +354,7 @@ int getFileFromUrl(char * url, char * dest,
getHostandPath((proto == URL_METHOD_FTP ? url + 6 : url + 7),
&host, &file, inet_ntoa(netCfg.dev.ip));
- logMessage("ks location: %s://%s/%s",
+ logMessage(INFO, "ks location: %s://%s/%s",
(proto == URL_METHOD_FTP ? "ftp" : "http"), host, file);
chptr = strchr(host, '/');
@@ -403,14 +403,14 @@ int getFileFromUrl(char * url, char * dest,
fd = urlinstStartTransfer(&ui, file, ehdrs, 0, flags);
if (fd < 0) {
- logMessage("failed to retrieve http://%s/%s/%s", ui.address, ui.prefix, file);
+ logMessage(ERROR, "failed to retrieve http://%s/%s/%s", ui.address, ui.prefix, file);
return 1;
}
rc = copyFileFd(fd, dest);
if (rc) {
unlink (dest);
- logMessage("failed to copy file to %s", dest);
+ logMessage(ERROR, "failed to copy file to %s", dest);
return 1;
}
@@ -436,7 +436,7 @@ void setKickstartUrl(struct loaderData_s * loaderData, int argc,
{ 0, 0, 0, 0, 0, 0, 0 }
};
- logMessage("kickstartFromUrl");
+ logMessage(INFO, "kickstartFromUrl");
optCon = poptGetContext(NULL, argc, (const char **) argv, ksUrlOptions, 0);
if ((rc = poptGetNextOpt(optCon)) < -1) {
startNewt(*flagsPtr);
@@ -468,6 +468,6 @@ void setKickstartUrl(struct loaderData_s * loaderData, int argc,
loaderData->methodData = calloc(sizeof(struct urlInstallData *), 1);
((struct urlInstallData *)loaderData->methodData)->url = url;
- logMessage("results of url ks, url %s", url);
+ logMessage(INFO, "results of url ks, url %s", url);
}
diff --git a/loader2/urls.c b/loader2/urls.c
index be39c797f..a9bcc974f 100644
--- a/loader2/urls.c
+++ b/loader2/urls.c
@@ -69,7 +69,7 @@ int convertURLToUI(char *url, struct iurlinfo *ui) {
ui->protocol = URL_METHOD_HTTP;
url +=7;
} else {
- logMessage("unknown url protocol '%s'", url);
+ logMessage(ERROR, "unknown url protocol '%s'", url);
return -1;
}
@@ -81,8 +81,8 @@ int convertURLToUI(char *url, struct iurlinfo *ui) {
*url = '/';
ui->prefix = strdup(url);
- logMessage("url address %s", ui->address);
- logMessage("url prefix %s", ui->prefix);
+ logMessage(INFO, "url address %s", ui->address);
+ logMessage(INFO, "url prefix %s", ui->prefix);
return 0;
}
@@ -155,7 +155,7 @@ int urlinstStartTransfer(struct iurlinfo * ui, char * filename,
else
finalPrefix = ui->prefix;
- logMessage("transferring %s://%s/%s/%s to a fd",
+ logMessage(INFO, "transferring %s://%s/%s/%s to a fd",
ui->protocol == URL_METHOD_FTP ? "ftp" : "http",
ui->address, finalPrefix, filename);
diff --git a/loader2/usb.c b/loader2/usb.c
index d05c96db9..7cfa13d01 100644
--- a/loader2/usb.c
+++ b/loader2/usb.c
@@ -41,7 +41,7 @@ static void sleepUntilUsbIsStable(void) {
int i, count = 0;
/* sleep for a maximum of 20 seconds, minimum of 2 seconds */
- logMessage("waiting for usb to become stable...");
+ logMessage(INFO, "waiting for usb to become stable...");
for (i = 0; i < 20; i++) {
stat("/proc/bus/usb/devices", &sb);
if (last == sb.st_mtime) {
@@ -57,7 +57,7 @@ static void sleepUntilUsbIsStable(void) {
last = sb.st_mtime;
sleep(1);
}
- logMessage("%d seconds.", i);
+ logMessage(INFO, "%d seconds.", i);
}
int usbInitialize(moduleList modLoaded, moduleDeps modDeps,
@@ -69,19 +69,19 @@ int usbInitialize(moduleList modLoaded, moduleDeps modDeps,
if (FL_NOUSB(flags)) return 0;
- logMessage("looking for usb controllers");
+ logMessage(INFO, "looking for usb controllers");
devices = probeDevices(CLASS_USB, BUS_PCI, 0);
if (!devices) {
- logMessage("no usb controller found");
+ logMessage(WARNING, "no usb controller found");
return 0;
}
/* JKFIXME: if we looked for all of them, we could batch this up and it
* would be faster */
for (i=0; devices[i]; i++) {
- logMessage("found USB controller %s", devices[i]->driver);
+ logMessage(INFO, "found USB controller %s", devices[i]->driver);
if (mlLoadModuleSet(devices[i]->driver, modLoaded, modDeps,
modInfo, flags)) {
@@ -98,7 +98,7 @@ int usbInitialize(moduleList modLoaded, moduleDeps modDeps,
if (doPwMount("/proc/bus/usb", "/proc/bus/usb", "usbfs", 0, 0,
NULL, NULL, 0, 0))
- logMessage("failed to mount device usbfs: %s", strerror(errno));
+ logMessage(ERROR, "failed to mount device usbfs: %s", strerror(errno));
/* sleep so we make sure usb devices get properly enumerated.
that way we should block when initializing each usb driver until
@@ -136,11 +136,11 @@ void usbInitializeMouse(moduleList modLoaded, moduleDeps modDeps,
if (access("/proc/bus/usb/devices", R_OK)) return;
- logMessage("looking for USB mouse...");
+ logMessage(INFO, "looking for USB mouse...");
if (probeDevices(CLASS_MOUSE, BUS_USB, PROBE_ALL)) {
- logMessage("USB mouse found, loading mousedev module");
+ logMessage(INFO, "USB mouse found, loading mousedev module");
if (mlLoadModuleSetLocation("mousedev", modLoaded, modDeps, modInfo, flags, secondStageModuleLocation)) {
- logMessage ("failed to loading mousedev module");
+ logMessage (ERROR, "failed to loading mousedev module");
return;
}
}