]> git.ozlabs.org Git - petitboot/commitdiff
Move log to library
authorGeoff Levand <geoffrey.levand@am.sony.com>
Thu, 22 Jan 2009 00:26:56 +0000 (16:26 -0800)
committerJeremy Kerr <jk@ozlabs.org>
Sun, 1 Feb 2009 00:49:29 +0000 (11:49 +1100)
Move the log routines to the petitboot library.  The log
routines are generic enough to be used for both server and
client.  Does not change the log source.

jk: move to lib/log/ instead of lib/

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
12 files changed:
configure.ac
discover/device-handler.c
discover/discover-server.c
discover/kboot-parser.c
discover/log.c [deleted file]
discover/log.h [deleted file]
discover/parser.c
discover/pb-discover.c
discover/udev.c
lib/log/log.c [new file with mode: 0644]
lib/log/log.h [new file with mode: 0644]
rules.mk

index f06ac80112e895b15fb4ce72f413ea9bc8a00bcc..88e5833ca213fa0897688ed6d9779d4ce4c72343 100644 (file)
@@ -32,6 +32,6 @@ AC_PROG_INSTALL
 PKG_CHECK_MODULES([twin], [libtwin])
 
 mkdir -p discover ui/test ui/common lib/talloc lib/pb-protocol lib/list \
-             lib/waiter
+             lib/waiter lib/log
 
 AC_OUTPUT
index 7e5819c5bd972d8284a9f70ac1c9eb1efbb9d0bb..9e40fb1d71cd09b86dd7fbfcb92248f6cb00548b 100644 (file)
@@ -8,13 +8,13 @@
 
 #include <talloc/talloc.h>
 #include <list/list.h>
+#include <log/log.h>
 #include <pb-protocol/pb-protocol.h>
 
 #include "device-handler.h"
 #include "discover-server.h"
 #include "parser.h"
 #include "udev.h"
-#include "log.h"
 #include "paths.h"
 
 #define MOUNT_BIN "/bin/mount"
index 1fab3036e9b05aa493357bfc4ba2dc08636388f1..56a427b85ac9806a11ff20a9dd34b1bd53eaecfc 100644 (file)
 
 #include <talloc/talloc.h>
 #include <waiter/waiter.h>
+#include <log/log.h>
 
 #include "pb-protocol/pb-protocol.h"
 #include "list/list.h"
 
-#include "log.h"
 #include "device-handler.h"
 #include "discover-server.h"
 
index 712456142f903c01ec04b17fb89c41ae587b64c3..930fbe49897cd51193762076b08d693783b7cd5a 100644 (file)
@@ -11,8 +11,8 @@
 #include <sys/stat.h>
 
 #include <talloc/talloc.h>
+#include <log/log.h>
 
-#include "log.h"
 #include "pb-protocol/pb-protocol.h"
 #include "paths.h"
 #include "params.h"
diff --git a/discover/log.c b/discover/log.c
deleted file mode 100644 (file)
index e006fd0..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-
-#include <stdarg.h>
-
-#include "log.h"
-
-static FILE *logf;
-
-void pb_log(const char *fmt, ...)
-{
-       va_list ap;
-       FILE *stream;
-
-       stream = logf ? logf : stdout;
-
-       va_start(ap, fmt);
-       vfprintf(stream, fmt, ap);
-       va_end(ap);
-}
-
-void pb_log_set_stream(FILE *stream)
-{
-       logf = stream;
-}
diff --git a/discover/log.h b/discover/log.h
deleted file mode 100644 (file)
index 3e92555..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _LOG_H
-#define _LOG_H
-
-#include <stdio.h>
-
-void pb_log(const char *fmt, ...);
-void pb_log_set_stream(FILE *stream);
-
-#endif /* _LOG_H */
index 87241a9cdb2e60b98913791b81eae86f371d08f3..2b4ddd2668e0e30a808184c004c0aac879b0e938 100644 (file)
@@ -2,9 +2,9 @@
 #include <stdlib.h>
 
 #include "pb-protocol/pb-protocol.h"
+#include <log/log.h>
 
 #include "device-handler.h"
-#include "log.h"
 #include "parser.h"
 #include "parser-utils.h"
 
index d11ab648b745fa2a20ab6b96b92e16988de82594..d8709b3974693f8657a61709e032486ec2ead08e 100644 (file)
@@ -3,11 +3,11 @@
 #include <signal.h>
 
 #include <waiter/waiter.h>
+#include <log/log.h>
 
 #include "udev.h"
 #include "discover-server.h"
 #include "device-handler.h"
-#include "log.h"
 
 static int running;
 
index 66d9544ad81dfe21c914b5505315ac556998a650..9d628407ca761bd3894c29ad122d6cffbf2fa974 100644 (file)
@@ -11,9 +11,9 @@
 
 #include <talloc/talloc.h>
 #include <waiter/waiter.h>
+#include <log/log.h>
 
 #include "udev.h"
-#include "log.h"
 #include "pb-discover.h"
 #include "device-handler.h"
 
diff --git a/lib/log/log.c b/lib/log/log.c
new file mode 100644 (file)
index 0000000..e006fd0
--- /dev/null
@@ -0,0 +1,23 @@
+
+#include <stdarg.h>
+
+#include "log.h"
+
+static FILE *logf;
+
+void pb_log(const char *fmt, ...)
+{
+       va_list ap;
+       FILE *stream;
+
+       stream = logf ? logf : stdout;
+
+       va_start(ap, fmt);
+       vfprintf(stream, fmt, ap);
+       va_end(ap);
+}
+
+void pb_log_set_stream(FILE *stream)
+{
+       logf = stream;
+}
diff --git a/lib/log/log.h b/lib/log/log.h
new file mode 100644 (file)
index 0000000..3e92555
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef _LOG_H
+#define _LOG_H
+
+#include <stdio.h>
+
+void pb_log(const char *fmt, ...);
+void pb_log_set_stream(FILE *stream);
+
+#endif /* _LOG_H */
index 607a25ee451b2e20523c3e829aab064c6c1924de..0eb4cab48eac783a8d1add318c89af3401131807 100644 (file)
--- a/rules.mk
+++ b/rules.mk
@@ -1,4 +1,5 @@
 
+
 VPATH = $(srcdir)
 
 CPPFLAGS += -I$(top_srcdir) -I$(top_srcdir)/lib -I$(builddir)
@@ -13,7 +14,7 @@ uis = ui/test/pb-test
 parsers = kboot
 artwork = background.jpg cdrom.png hdd.png usbpen.png tux.png cursor.gz
 
-
+log_objs = lib/log/log.o
 talloc_objs = lib/talloc/talloc.o
 list_objs = lib/list/list.o
 waiter_objs = lib/waiter/waiter.o
@@ -36,7 +37,7 @@ ui/twin/pb-twin: $(pb_twin_objs)
 
 # test ui
 pb_test_objs = ui/test/pb-test.o ui/common/discover-client.o \
-       $(talloc_objs) $(server_objs) $(list_objs)
+       $(log_objs) $(talloc_objs) $(server_objs) $(list_objs)
 
 ui/test/pb-test: $(pb_test_objs)
        $(LINK.o) -o $@ $^
@@ -46,10 +47,10 @@ ui/test/pb-test: $(pb_test_objs)
 #            discover/yaboot-cfg.o \
 #            $(foreach p,$(parsers),discover/$(p)-parser.o)
 
-pb_discover_objs = discover/pb-discover.o discover/udev.o discover/log.o \
+pb_discover_objs = discover/pb-discover.o discover/udev.o \
                   discover/discover-server.o discover/device-handler.o \
                   discover/paths.o $(talloc_objs) $(server_objs) \
-                  $(parser_objs) $(list_objs) $(waiter_objs)
+                  $(parser_objs) $(list_objs) $(waiter_objs) $(log_objs)
 
 discover/pb-discover: $(pb_discover_objs)
        $(LINK.o) -o $@ $^