[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [master 1/6] move log.c from loader into isys.
- From: Martin Sivak <msivak redhat com>
- To: Discussion of Development and Customization of the Red Hat Linux Installer <anaconda-devel-list redhat com>
- Subject: Re: [master 1/6] move log.c from loader into isys.
- Date: Mon, 8 Mar 2010 07:15:58 -0500 (EST)
Ack. Martin
----- "Ales Kozumplik" <akozumpl redhat com> wrote:
> This is in preparation to use logging from imount.c.
> ---
> isys/Makefile.am | 2 +-
> isys/log.c | 178
> +++++++++++++++++++++++++++++++++++++++++++++++++
> isys/log.h | 44 ++++++++++++
> loader/Makefile.am | 2 +-
> loader/cdinstall.c | 2 +-
> loader/dirbrowser.c | 3 +-
> loader/driverdisk.c | 2 +-
> loader/driverselect.c | 3 +-
> loader/fwloader.c | 3 +-
> loader/getparts.c | 2 +-
> loader/hardware.c | 2 +-
> loader/hdinstall.c | 2 +-
> loader/kbd.c | 2 +-
> loader/kickstart.c | 2 +-
> loader/lang.c | 2 +-
> loader/loader.c | 2 +-
> loader/loadermisc.c | 3 +-
> loader/log.c | 178
> -------------------------------------------------
> loader/log.h | 44 ------------
> loader/mediacheck.c | 3 +-
> loader/method.c | 2 +-
> loader/modules.c | 3 +-
> loader/net.c | 2 +-
> loader/nfsinstall.c | 2 +-
> loader/rpmextract.c | 3 +-
> loader/selinux.c | 2 +-
> loader/telnet.c | 2 +-
> loader/telnetd.c | 3 +-
> loader/urlinstall.c | 2 +-
> loader/urls.c | 3 +-
> loader/windows.c | 3 +-
> 31 files changed, 259 insertions(+), 249 deletions(-)
> create mode 100644 isys/log.c
> create mode 100644 isys/log.h
> delete mode 100644 loader/log.c
> delete mode 100644 loader/log.h
>
> diff --git a/isys/Makefile.am b/isys/Makefile.am
> index 32ba64c..6c567a5 100644
> --- a/isys/Makefile.am
> +++ b/isys/Makefile.am
> @@ -19,7 +19,7 @@
>
> ISYS_SRCS = devices.c imount.c cpio.c uncpio.c lang.c \
> isofs.c linkdetect.c vio.c ethtool.c eddsupport.c iface.c
> \
> - str.c auditd.c
> + str.c auditd.c log.c
>
> if IS_PPC
> ISYS_SRCS += minifind.c
> diff --git a/isys/log.c b/isys/log.c
> new file mode 100644
> index 0000000..7824d92
> --- /dev/null
> +++ b/isys/log.c
> @@ -0,0 +1,178 @@
> +/*
> + * log.c - logging functionality
> + *
> + * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
> + * All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or
> modify
> + * it under the terms of the GNU General Public License as published
> by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program. If not, see
> <http://www.gnu.org/licenses/>.
> + *
> + * Author(s): Erik Troan <ewt redhat com>
> + * Matt Wilson <msw redhat com>
> + * Michael Fulbright <msf redhat com>
> + * Jeremy Katz <katzj redhat com>
> + */
> +
> +#include <fcntl.h>
> +#include <stdarg.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <time.h>
> +#include <unistd.h>
> +#include <sys/time.h>
> +#include <syslog.h>
> +
> +#include "log.h"
> +
> +static FILE * tty_logfile = NULL;
> +static FILE * file_logfile = NULL;
> +static int minLevel = INFO;
> +static const char * syslog_facility = "loader";
> +
> +/* maps our loglevel to syslog loglevel */
> +static int mapLogLevel(int level)
> +{
> + switch (level) {
> + case DEBUGLVL:
> + return LOG_DEBUG;
> + case INFO:
> + return LOG_INFO;
> + case WARNING:
> + return LOG_WARNING;
> + case CRITICAL:
> + return LOG_CRIT;
> + case ERROR:
> + default:
> + /* if someone called us with an invalid level value, log it
> as an error
> + too. */
> + return LOG_ERR;
> + }
> +}
> +
> +static void printLogHeader(int level, FILE *outfile) {
> + struct timeval current_time;
> + struct tm *t;
> + int msecs;
> +
> + gettimeofday(¤t_time, NULL);
> + t = gmtime(¤t_time.tv_sec);
> + msecs = current_time.tv_usec / 1000;
> + switch (level) {
> + case DEBUGLVL:
> + fprintf (outfile, "%02d:%02d:%02d,%03d DEBUG %s: ",
> t->tm_hour,
> + t->tm_min, t->tm_sec, msecs, syslog_facility);
> + break;
> +
> + case INFO:
> + fprintf (outfile, "%02d:%02d:%02d,%03d INFO %s: ",
> t->tm_hour,
> + t->tm_min, t->tm_sec, msecs, syslog_facility);
> + break;
> +
> + case WARNING:
> + fprintf (outfile, "%02d:%02d:%02d,%03d WARNING %s: ",
> t->tm_hour,
> + t->tm_min, t->tm_sec, msecs, syslog_facility);
> + break;
> +
> + case ERROR:
> + fprintf (outfile, "%02d:%02d:%02d,%03d ERROR %s: ",
> t->tm_hour,
> + t->tm_min, t->tm_sec, msecs, syslog_facility);
> + break;
> +
> + case CRITICAL:
> + fprintf (outfile, "%02d:%02d:%02d,%03d CRITICAL %s: ",
> t->tm_hour,
> + t->tm_min, t->tm_sec, msecs, syslog_facility);
> + break;
> + }
> +}
> +
> +void logMessageV(int level, const char * s, va_list ap) {
> + va_list apc;
> + /* Log everything into syslog */
> + va_copy(apc, ap);
> + vsyslog(mapLogLevel(level), s, apc);
> + va_end(apc);
> +
> + /* Only log to the screen things that are above the minimum
> level. */
> + if (tty_logfile && level >= minLevel) {
> + printLogHeader(level, tty_logfile);
> + va_copy(apc, ap);
> + vfprintf(tty_logfile, s, apc);
> + va_end(apc);
> + fprintf(tty_logfile, "\n");
> + fflush(tty_logfile);
> + }
> +
> + /* But log everything to the file. */
> + if (file_logfile) {
> + printLogHeader(level, file_logfile);
> + va_copy(apc, ap);
> + vfprintf(file_logfile, s, apc);
> + va_end(apc);
> + fprintf(file_logfile, "\n");
> + fflush(file_logfile);
> + }
> +}
> +
> +void logMessage(int level, const char * s, ...) {
> + va_list args;
> +
> + va_start(args, s);
> + logMessageV(level, s, args);
> + va_end(args);
> +}
> +
> +int tty_logfd = -1;
> +int file_logfd = -1;
> +
> +void openLog() {
> + /* init syslog logging (so loader messages can also be forwarded
> to a remote
> + syslog daemon */
> + openlog(syslog_facility, 0, LOG_LOCAL1);
> +
> + int flags;
> + tty_logfile = fopen("/dev/tty3", "w");
> + file_logfile = fopen("/tmp/anaconda.log", "w");
> +
> + if (tty_logfile) {
> + tty_logfd = fileno(tty_logfile);
> + flags = fcntl(tty_logfd, F_GETFD, 0) | FD_CLOEXEC;
> + fcntl(tty_logfd, F_SETFD, flags);
> + }
> +
> + if (file_logfile) {
> + file_logfd = fileno(file_logfile);
> + flags = fcntl(file_logfd, F_GETFD, 0) | FD_CLOEXEC;
> + fcntl(file_logfd, F_SETFD, flags);
> + }
> +}
> +
> +void closeLog(void) {
> + if (tty_logfile)
> + fclose(tty_logfile);
> +
> + if (file_logfile)
> + fclose(file_logfile);
> + /* close syslog logger */
> + closelog();
> +}
> +
> +/* set the level. higher means you see more verbosity */
> +void setLogLevel(int level) {
> + minLevel = level;
> +}
> +
> +int getLogLevel(void) {
> + return minLevel;
> +}
> +
> +/* vim:set shiftwidth=4 softtabstop=4: */
> diff --git a/isys/log.h b/isys/log.h
> new file mode 100644
> index 0000000..183c0b2
> --- /dev/null
> +++ b/isys/log.h
> @@ -0,0 +1,44 @@
> +/*
> + * log.h
> + *
> + * Copyright (C) 2007 Red Hat, Inc. All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or
> modify
> + * it under the terms of the GNU General Public License as published
> by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program. If not, see
> <http://www.gnu.org/licenses/>.
> + */
> +
> +#ifndef _LOG_H_
> +#define _LOG_H_
> +
> +#include <stdio.h>
> +#include <stdarg.h>
> +
> +#define DEBUGLVL 10
> +#define INFO 20
> +#define WARNING 30
> +#define ERROR 40
> +#define CRITICAL 50
> +
> +void logMessageV(int level, const char * s, va_list ap)
> + __attribute__ ((format (printf, 2, 0)));
> +void logMessage(int level, const char * s, ...)
> + __attribute__ ((format (printf, 2, 3)));
> +void openLog();
> +void closeLog(void);
> +void setLogLevel(int minLevel);
> +int getLogLevel(void);
> +
> +extern int tty_logfd;
> +extern int file_logfd;
> +
> +#endif /* _LOG_H_ */
> diff --git a/loader/Makefile.am b/loader/Makefile.am
> index 4d063bb..a2b79d7 100644
> --- a/loader/Makefile.am
> +++ b/loader/Makefile.am
> @@ -46,7 +46,7 @@ loader_LDADD = $(NEWT_LIBS) $(GLIB_LIBS)
> $(LIBNL_LIBS) \
> $(LIBNM_GLIB_LIBS) $(CHECKISOMD5_LIBS) \
> $(LIBCURL_LIBS) $(LIBARCHIVE_LIBS) $(RPM_LIBS)
> \
> $(ISCSI_LIBS) $(top_srcdir)/isys/libisys.la -lm
> -loader_SOURCES = loader.c copy.c log.c moduleinfo.c loadermisc.c
> \
> +loader_SOURCES = loader.c copy.c moduleinfo.c loadermisc.c \
> modules.c windows.c lang.c kbd.c driverdisk.c \
> selinux.c mediacheck.c kickstart.c
> driverselect.c \
> getparts.c dirbrowser.c fwloader.c ibft.c
> hardware.c \
> diff --git a/loader/cdinstall.c b/loader/cdinstall.c
> index 3ccc332..9d5cee1 100644
> --- a/loader/cdinstall.c
> +++ b/loader/cdinstall.c
> @@ -49,7 +49,6 @@
> #include "kickstart.h"
> #include "loader.h"
> #include "loadermisc.h"
> -#include "log.h"
> #include "lang.h"
> #include "modules.h"
> #include "method.h"
> @@ -59,6 +58,7 @@
>
> #include "../isys/imount.h"
> #include "../isys/isys.h"
> +#include "../isys/log.h"
>
> /* boot flags */
> extern uint64_t flags;
> diff --git a/loader/dirbrowser.c b/loader/dirbrowser.c
> index 5632984..9199850 100644
> --- a/loader/dirbrowser.c
> +++ b/loader/dirbrowser.c
> @@ -31,7 +31,8 @@
> #include <sys/stat.h>
>
> #ifndef STANDALONE
> -#include "log.h"
> +#include "../isys/log.h"
> +
> #include "loader.h"
> #include "loadermisc.h"
> #include "lang.h"
> diff --git a/loader/driverdisk.c b/loader/driverdisk.c
> index 4c98b27..686cc1c 100644
> --- a/loader/driverdisk.c
> +++ b/loader/driverdisk.c
> @@ -38,7 +38,6 @@
>
> #include "copy.h"
> #include "loader.h"
> -#include "log.h"
> #include "loadermisc.h"
> #include "lang.h"
> #include "fwloader.h"
> @@ -59,6 +58,7 @@
> #include "../isys/isys.h"
> #include "../isys/imount.h"
> #include "../isys/eddsupport.h"
> +#include "../isys/log.h"
>
> /* boot flags */
> extern uint64_t flags;
> diff --git a/loader/driverselect.c b/loader/driverselect.c
> index f9379f0..19aa357 100644
> --- a/loader/driverselect.c
> +++ b/loader/driverselect.c
> @@ -28,11 +28,12 @@
> #include <unistd.h>
> #include <errno.h>
>
> +#include "../isys/log.h"
> +
> #include "modules.h"
> #include "moduleinfo.h"
> #include "loader.h"
> #include "loadermisc.h"
> -#include "log.h"
> #include "lang.h"
> #include "driverdisk.h"
>
> diff --git a/loader/fwloader.c b/loader/fwloader.c
> index a91ff6b..5ad1d8e 100644
> --- a/loader/fwloader.c
> +++ b/loader/fwloader.c
> @@ -41,10 +41,11 @@
> #include <asm/types.h>
> #include <linux/netlink.h>
>
> +#include "../isys/log.h"
> +
> #include "loader.h"
> #include "fwloader.h"
> #include "udelay.h"
> -#include "log.h"
>
> #ifndef FWDEBUG
> #define logMessage(x, ...)
> diff --git a/loader/getparts.c b/loader/getparts.c
> index 8d2b7c4..c60dc83 100644
> --- a/loader/getparts.c
> +++ b/loader/getparts.c
> @@ -29,7 +29,7 @@
> #include <ctype.h>
> #include <string.h>
>
> -#include "log.h"
> +#include "../isys/log.h"
>
> /* see if this is a partition name or not */
> static int isPartitionName(char *pname) {
> diff --git a/loader/hardware.c b/loader/hardware.c
> index 93fb0f8..6444271 100644
> --- a/loader/hardware.c
> +++ b/loader/hardware.c
> @@ -35,12 +35,12 @@
>
> #include "loader.h"
> #include "hardware.h"
> -#include "log.h"
>
> /* FIXME: for turning off dma */
> #include <sys/ioctl.h>
> #include <linux/hdreg.h>
> #include "../isys/isys.h"
> +#include "../isys/log.h"
>
> /* boot flags */
> extern uint64_t flags;
> diff --git a/loader/hdinstall.c b/loader/hdinstall.c
> index ea39095..b21604a 100644
> --- a/loader/hdinstall.c
> +++ b/loader/hdinstall.c
> @@ -39,7 +39,6 @@
> #include "kickstart.h"
> #include "loader.h"
> #include "loadermisc.h"
> -#include "log.h"
> #include "lang.h"
> #include "modules.h"
> #include "method.h"
> @@ -50,6 +49,7 @@
> #include "../isys/imount.h"
> #include "../isys/isys.h"
> #include "../isys/eddsupport.h"
> +#include "../isys/log.h"
>
> /* boot flags */
> extern uint64_t flags;
> diff --git a/loader/kbd.c b/loader/kbd.c
> index 191f91d..b94f920 100644
> --- a/loader/kbd.c
> +++ b/loader/kbd.c
> @@ -31,12 +31,12 @@
>
> #include "loader.h"
> #include "loadermisc.h"
> -#include "log.h"
> #include "lang.h"
> #include "windows.h"
>
> #include "../isys/stubs.h"
> #include "../isys/lang.h"
> +#include "../isys/log.h"
>
> /* boot flags */
> extern uint64_t flags;
> diff --git a/loader/kickstart.c b/loader/kickstart.c
> index f2c758d..4ff800f 100644
> --- a/loader/kickstart.c
> +++ b/loader/kickstart.c
> @@ -37,7 +37,6 @@
> #include "loader.h"
> #include "loadermisc.h"
> #include "lang.h"
> -#include "log.h"
> #include "kickstart.h"
> #include "modules.h"
>
> @@ -53,6 +52,7 @@
>
> #include "../isys/imount.h"
> #include "../isys/isys.h"
> +#include "../isys/log.h"
>
> /* boot flags */
> extern uint64_t flags;
> diff --git a/loader/lang.c b/loader/lang.c
> index fe2e8b7..c74a11b 100644
> --- a/loader/lang.c
> +++ b/loader/lang.c
> @@ -37,7 +37,6 @@
>
> #include "loader.h"
> #include "lang.h"
> -#include "log.h"
> #include "loadermisc.h"
> #include "windows.h"
>
> @@ -45,6 +44,7 @@
> #include "../isys/cpio.h"
> #include "../isys/lang.h"
> #include "../isys/isys.h"
> +#include "../isys/log.h"
>
> /* boot flags */
> extern uint64_t flags;
> diff --git a/loader/loader.c b/loader/loader.c
> index 265fa85..1f60160 100644
> --- a/loader/loader.c
> +++ b/loader/loader.c
> @@ -64,7 +64,6 @@
> #include "getparts.h"
> #include "loader.h"
> #include "loadermisc.h" /* JKFIXME: functions here should be split
> out */
> -#include "log.h"
> #include "lang.h"
> #include "fwloader.h"
> #include "kbd.h"
> @@ -100,6 +99,7 @@
> #include "../isys/lang.h"
> #include "../isys/eddsupport.h"
> #include "../isys/str.h"
> +#include "../isys/log.h"
>
> /* maximum number of extra arguments that can be passed to the second
> stage */
> #define MAX_EXTRA_ARGS 128
> diff --git a/loader/loadermisc.c b/loader/loadermisc.c
> index 03d26bb..64e80a2 100644
> --- a/loader/loadermisc.c
> +++ b/loader/loadermisc.c
> @@ -32,7 +32,8 @@
> #include <stdarg.h>
> #include <stdlib.h>
>
> -#include "log.h"
> +#include "../isys/log.h"
> +
> #include "windows.h"
>
> int copyFileFd(int infd, char * dest, progressCB pbcb,
> diff --git a/loader/log.c b/loader/log.c
> deleted file mode 100644
> index 7824d92..0000000
> --- a/loader/log.c
> +++ /dev/null
> @@ -1,178 +0,0 @@
> -/*
> - * log.c - logging functionality
> - *
> - * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
> - * All rights reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> modify
> - * it under the terms of the GNU General Public License as published
> by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program. If not, see
> <http://www.gnu.org/licenses/>.
> - *
> - * Author(s): Erik Troan <ewt redhat com>
> - * Matt Wilson <msw redhat com>
> - * Michael Fulbright <msf redhat com>
> - * Jeremy Katz <katzj redhat com>
> - */
> -
> -#include <fcntl.h>
> -#include <stdarg.h>
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <time.h>
> -#include <unistd.h>
> -#include <sys/time.h>
> -#include <syslog.h>
> -
> -#include "log.h"
> -
> -static FILE * tty_logfile = NULL;
> -static FILE * file_logfile = NULL;
> -static int minLevel = INFO;
> -static const char * syslog_facility = "loader";
> -
> -/* maps our loglevel to syslog loglevel */
> -static int mapLogLevel(int level)
> -{
> - switch (level) {
> - case DEBUGLVL:
> - return LOG_DEBUG;
> - case INFO:
> - return LOG_INFO;
> - case WARNING:
> - return LOG_WARNING;
> - case CRITICAL:
> - return LOG_CRIT;
> - case ERROR:
> - default:
> - /* if someone called us with an invalid level value, log it
> as an error
> - too. */
> - return LOG_ERR;
> - }
> -}
> -
> -static void printLogHeader(int level, FILE *outfile) {
> - struct timeval current_time;
> - struct tm *t;
> - int msecs;
> -
> - gettimeofday(¤t_time, NULL);
> - t = gmtime(¤t_time.tv_sec);
> - msecs = current_time.tv_usec / 1000;
> - switch (level) {
> - case DEBUGLVL:
> - fprintf (outfile, "%02d:%02d:%02d,%03d DEBUG %s: ",
> t->tm_hour,
> - t->tm_min, t->tm_sec, msecs, syslog_facility);
> - break;
> -
> - case INFO:
> - fprintf (outfile, "%02d:%02d:%02d,%03d INFO %s: ",
> t->tm_hour,
> - t->tm_min, t->tm_sec, msecs, syslog_facility);
> - break;
> -
> - case WARNING:
> - fprintf (outfile, "%02d:%02d:%02d,%03d WARNING %s: ",
> t->tm_hour,
> - t->tm_min, t->tm_sec, msecs, syslog_facility);
> - break;
> -
> - case ERROR:
> - fprintf (outfile, "%02d:%02d:%02d,%03d ERROR %s: ",
> t->tm_hour,
> - t->tm_min, t->tm_sec, msecs, syslog_facility);
> - break;
> -
> - case CRITICAL:
> - fprintf (outfile, "%02d:%02d:%02d,%03d CRITICAL %s: ",
> t->tm_hour,
> - t->tm_min, t->tm_sec, msecs, syslog_facility);
> - break;
> - }
> -}
> -
> -void logMessageV(int level, const char * s, va_list ap) {
> - va_list apc;
> - /* Log everything into syslog */
> - va_copy(apc, ap);
> - vsyslog(mapLogLevel(level), s, apc);
> - va_end(apc);
> -
> - /* Only log to the screen things that are above the minimum
> level. */
> - if (tty_logfile && level >= minLevel) {
> - printLogHeader(level, tty_logfile);
> - va_copy(apc, ap);
> - vfprintf(tty_logfile, s, apc);
> - va_end(apc);
> - fprintf(tty_logfile, "\n");
> - fflush(tty_logfile);
> - }
> -
> - /* But log everything to the file. */
> - if (file_logfile) {
> - printLogHeader(level, file_logfile);
> - va_copy(apc, ap);
> - vfprintf(file_logfile, s, apc);
> - va_end(apc);
> - fprintf(file_logfile, "\n");
> - fflush(file_logfile);
> - }
> -}
> -
> -void logMessage(int level, const char * s, ...) {
> - va_list args;
> -
> - va_start(args, s);
> - logMessageV(level, s, args);
> - va_end(args);
> -}
> -
> -int tty_logfd = -1;
> -int file_logfd = -1;
> -
> -void openLog() {
> - /* init syslog logging (so loader messages can also be forwarded
> to a remote
> - syslog daemon */
> - openlog(syslog_facility, 0, LOG_LOCAL1);
> -
> - int flags;
> - tty_logfile = fopen("/dev/tty3", "w");
> - file_logfile = fopen("/tmp/anaconda.log", "w");
> -
> - if (tty_logfile) {
> - tty_logfd = fileno(tty_logfile);
> - flags = fcntl(tty_logfd, F_GETFD, 0) | FD_CLOEXEC;
> - fcntl(tty_logfd, F_SETFD, flags);
> - }
> -
> - if (file_logfile) {
> - file_logfd = fileno(file_logfile);
> - flags = fcntl(file_logfd, F_GETFD, 0) | FD_CLOEXEC;
> - fcntl(file_logfd, F_SETFD, flags);
> - }
> -}
> -
> -void closeLog(void) {
> - if (tty_logfile)
> - fclose(tty_logfile);
> -
> - if (file_logfile)
> - fclose(file_logfile);
> - /* close syslog logger */
> - closelog();
> -}
> -
> -/* set the level. higher means you see more verbosity */
> -void setLogLevel(int level) {
> - minLevel = level;
> -}
> -
> -int getLogLevel(void) {
> - return minLevel;
> -}
> -
> -/* vim:set shiftwidth=4 softtabstop=4: */
> diff --git a/loader/log.h b/loader/log.h
> deleted file mode 100644
> index 183c0b2..0000000
> --- a/loader/log.h
> +++ /dev/null
> @@ -1,44 +0,0 @@
> -/*
> - * log.h
> - *
> - * Copyright (C) 2007 Red Hat, Inc. All rights reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> modify
> - * it under the terms of the GNU General Public License as published
> by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program. If not, see
> <http://www.gnu.org/licenses/>.
> - */
> -
> -#ifndef _LOG_H_
> -#define _LOG_H_
> -
> -#include <stdio.h>
> -#include <stdarg.h>
> -
> -#define DEBUGLVL 10
> -#define INFO 20
> -#define WARNING 30
> -#define ERROR 40
> -#define CRITICAL 50
> -
> -void logMessageV(int level, const char * s, va_list ap)
> - __attribute__ ((format (printf, 2, 0)));
> -void logMessage(int level, const char * s, ...)
> - __attribute__ ((format (printf, 2, 3)));
> -void openLog();
> -void closeLog(void);
> -void setLogLevel(int minLevel);
> -int getLogLevel(void);
> -
> -extern int tty_logfd;
> -extern int file_logfd;
> -
> -#endif /* _LOG_H_ */
> diff --git a/loader/mediacheck.c b/loader/mediacheck.c
> index 6e96647..ee5a794 100644
> --- a/loader/mediacheck.c
> +++ b/loader/mediacheck.c
> @@ -30,8 +30,9 @@
> #include <newt.h>
> #include <libcheckisomd5.h>
>
> +#include "../isys/log.h"
> +
> #include "lang.h"
> -#include "log.h"
> #include "windows.h"
>
> int doMediaCheck(char *file, char *descr) {
> diff --git a/loader/method.c b/loader/method.c
> index 0073d34..c2a5bd6 100644
> --- a/loader/method.c
> +++ b/loader/method.c
> @@ -41,7 +41,6 @@
> #include "copy.h"
> #include "loader.h"
> #include "loadermisc.h"
> -#include "log.h"
> #include "lang.h"
> #include "mediacheck.h"
> #include "method.h"
> @@ -49,6 +48,7 @@
> #include "../isys/imount.h"
> #include "../isys/isys.h"
> #include "../isys/cpio.h"
> +#include "../isys/log.h"
>
> #include "devt.h"
>
> diff --git a/loader/modules.c b/loader/modules.c
> index 07f781a..0944b97 100644
> --- a/loader/modules.c
> +++ b/loader/modules.c
> @@ -40,8 +40,9 @@
> #include <unistd.h>
> #include <glib.h>
>
> +#include "../isys/log.h"
> +
> #include "loader.h"
> -#include "log.h"
> #include "modules.h"
> #include "windows.h"
>
> diff --git a/loader/net.c b/loader/net.c
> index 9e4daa1..8796a68 100644
> --- a/loader/net.c
> +++ b/loader/net.c
> @@ -44,11 +44,11 @@
> #include "../isys/ethtool.h"
> #include "../isys/iface.h"
> #include "../isys/str.h"
> +#include "../isys/log.h"
>
> #include "lang.h"
> #include "loader.h"
> #include "loadermisc.h"
> -#include "log.h"
> #include "method.h"
> #include "net.h"
> #include "windows.h"
> diff --git a/loader/nfsinstall.c b/loader/nfsinstall.c
> index de1ce29..ae13874 100644
> --- a/loader/nfsinstall.c
> +++ b/loader/nfsinstall.c
> @@ -44,7 +44,6 @@
> #include "lang.h"
> #include "loadermisc.h"
> #include "kickstart.h"
> -#include "log.h"
> #include "method.h"
> #include "nfsinstall.h"
> #include "net.h"
> @@ -53,6 +52,7 @@
>
> #include "../isys/imount.h"
> #include "../isys/iface.h"
> +#include "../isys/log.h"
>
> /* boot flags */
> extern uint64_t flags;
> diff --git a/loader/rpmextract.c b/loader/rpmextract.c
> index 90af54c..d1549b8 100644
> --- a/loader/rpmextract.c
> +++ b/loader/rpmextract.c
> @@ -37,9 +37,10 @@
> #include <archive_entry.h>
>
> #include "loader.h"
> -#include "log.h"
> #include "rpmextract.h"
>
> +#include "../isys/log.h"
> +
> /*
> * internal structure to pass to libarchive callbacks
> */
> diff --git a/loader/selinux.c b/loader/selinux.c
> index 337d041..66bfe4d 100644
> --- a/loader/selinux.c
> +++ b/loader/selinux.c
> @@ -32,7 +32,7 @@
>
> #include "loader.h"
> #include "loadermisc.h"
> -#include "log.h"
> +#include "../isys/log.h"
>
> int loadpolicy() {
> int pid, status;
> diff --git a/loader/telnet.c b/loader/telnet.c
> index a2c0b20..3c123ae 100644
> --- a/loader/telnet.c
> +++ b/loader/telnet.c
> @@ -27,7 +27,7 @@
> #include <unistd.h>
>
> #include "telnet.h"
> -#include "log.h"
> +#include "../isys/log.h"
>
> #define IAC "\xff"
> #define DONT "\xfe"
> diff --git a/loader/telnetd.c b/loader/telnetd.c
> index cdf7e16..e3a021d 100644
> --- a/loader/telnetd.c
> +++ b/loader/telnetd.c
> @@ -36,9 +36,10 @@
> #include <sys/types.h>
> #include <unistd.h>
>
> +#include "../isys/log.h"
> +
> #include "lang.h"
> #include "loader.h"
> -#include "log.h"
> #include "modules.h"
> #include "net.h"
> #include "telnet.h"
> diff --git a/loader/urlinstall.c b/loader/urlinstall.c
> index 9148c33..85776de 100644
> --- a/loader/urlinstall.c
> +++ b/loader/urlinstall.c
> @@ -32,13 +32,13 @@
> #include <glib.h>
>
> #include "../isys/iface.h"
> +#include "../isys/log.h"
>
> #include "copy.h"
> #include "kickstart.h"
> #include "loader.h"
> #include "loadermisc.h"
> #include "lang.h"
> -#include "log.h"
> #include "method.h"
> #include "net.h"
> #include "method.h"
> diff --git a/loader/urls.c b/loader/urls.c
> index f7d3e34..ed600ed 100644
> --- a/loader/urls.c
> +++ b/loader/urls.c
> @@ -39,11 +39,12 @@
> #include <errno.h>
> #include <curl/curl.h>
>
> +#include "../isys/log.h"
> +
> #include "lang.h"
> #include "loader.h"
> #include "loadermisc.h"
> #include "urls.h"
> -#include "log.h"
> #include "windows.h"
> #include "net.h"
>
> diff --git a/loader/windows.c b/loader/windows.c
> index 3d57136..b0f1c46 100644
> --- a/loader/windows.c
> +++ b/loader/windows.c
> @@ -31,7 +31,8 @@
> #include <stdarg.h>
> #include <math.h>
>
> -#include "log.h"
> +#include "../isys/log.h"
> +
> #include "windows.h"
>
> void winStatus(int width, int height, char * title, char * text, ...)
> {
> --
> 1.6.6
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list redhat com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]