From patchwork Thu Jan 22 00:26:56 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 19747 X-Patchwork-Delegate: jk@ozlabs.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 5F585DE086 for ; Thu, 22 Jan 2009 14:38:04 +1100 (EST) X-Original-To: cbe-oss-dev@ozlabs.org Delivered-To: cbe-oss-dev@ozlabs.org Received: from hera.kernel.org (hera.kernel.org [140.211.167.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C53C1DDF73; Thu, 22 Jan 2009 14:32:08 +1100 (EST) Received: from hera.kernel.org (IDENT:U2FsdGVkX19hKmUzM+8vMyz8pXNCy6azKxXL8uHiLzg@localhost [127.0.0.1]) by hera.kernel.org (8.14.2/8.14.2) with ESMTP id n0M3A0JI002850 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 22 Jan 2009 03:10:01 GMT Received: (from geoff@localhost) by hera.kernel.org (8.14.2/8.13.1/Submit) id n0M3A0vY002849; Thu, 22 Jan 2009 03:10:00 GMT Message-Id: <20090122002653.397608973@am.sony.com> References: <20090122002653.146035454@am.sony.com> User-Agent: quilt/0.46-1 Date: Wed, 21 Jan 2009 16:26:56 -0800 From: Geoff Levand To: Jeremy Kerr Content-Disposition: inline; filename=move-log-to-lib.diff X-Virus-Scanned: ClamAV 0.93.3/8886/Wed Jan 21 22:46:06 2009 on hera.kernel.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on hera.kernel.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (hera.kernel.org [127.0.0.1]); Thu, 22 Jan 2009 03:10:02 +0000 (UTC) Cc: cbe-oss-dev@ozlabs.org Subject: [Cbe-oss-dev] [patch 3/9] petitboot: Move log to library X-BeenThere: cbe-oss-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Discussion about Open Source Software for the Cell Broadband Engine List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: cbe-oss-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org 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. Signed-off-by: Geoff Levand --- discover/log.c | 23 ----------------------- discover/log.h | 9 --------- lib/log.c | 23 +++++++++++++++++++++++ lib/log.h | 9 +++++++++ rules.mk | 9 +++++---- 5 files changed, 37 insertions(+), 36 deletions(-) --- a/discover/log.c +++ /dev/null @@ -1,23 +0,0 @@ - -#include - -#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; -} --- a/discover/log.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _LOG_H -#define _LOG_H - -#include - -void pb_log(const char *fmt, ...); -void pb_log_set_stream(FILE *stream); - -#endif /* _LOG_H */ --- /dev/null +++ b/lib/log.c @@ -0,0 +1,23 @@ + +#include + +#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; +} --- /dev/null +++ b/lib/log.h @@ -0,0 +1,9 @@ +#ifndef _LOG_H +#define _LOG_H + +#include + +void pb_log(const char *fmt, ...); +void pb_log_set_stream(FILE *stream); + +#endif /* _LOG_H */ --- 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.o talloc_objs = lib/talloc/talloc.o list_objs = lib/list/list.o waiter_objs = lib/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,9 +47,9 @@ 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 $(waiter_objs) \ + discover/paths.o $(waiter_objs) $(log_objs) \ $(talloc_objs) $(server_objs) $(parser_objs) $(list_objs) discover/pb-discover: $(pb_discover_objs)