From 40e6bd08857a65ce955c42dcf24d1a87e0318d38 Mon Sep 17 00:00:00 2001 From: Dhaval Giani Date: Wed, 25 Feb 2009 13:31:29 +0000 Subject: [PATCH] libcgroup: Move dbg() to libcgroup-internal.h From: Jan Safranek I think dbg() should be in internal header file and not in the public one. The tools get their own definition of dbg() so they don't need to include library private header. dbg() is defined on three places now, it will make more sense when the sources are distributed to different directories. Signed-off-by: Jan Safranek Signed-off-by: Dhaval Giani git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@342 4f4bb910-9a46-0410-90c8-c897d4f1cd53 --- cgrulesengd.h | 4 ++-- libcgroup-internal.h | 6 ++++++ libcgroup.h | 6 ------ tools-common.h | 7 ++++++- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/cgrulesengd.h b/cgrulesengd.h index f49f79f3..1dc5bdae 100644 --- a/cgrulesengd.h +++ b/cgrulesengd.h @@ -32,9 +32,9 @@ __BEGIN_DECLS /* A simple macro for printing messages only when CGROUP_DEBUG is defined. */ #ifdef CGROUP_DEBUG - #define fdbg(a, b...) fprintf(a, b) + #define dbg(a...) printf(a) #else - #define fdbg(a, b...) do {} while(0) + #define dbg(a...) do {} while (0) #endif /* CGROUP_DEBUG */ /* The following ten macros are all for the Netlink code. */ diff --git a/libcgroup-internal.h b/libcgroup-internal.h index af5d396c..a94f6cdb 100644 --- a/libcgroup-internal.h +++ b/libcgroup-internal.h @@ -26,6 +26,12 @@ __BEGIN_DECLS #define CGROUP_BUFFER_LEN (5 * FILENAME_MAX) +#ifdef CGROUP_DEBUG +#define dbg(x...) printf(x) +#else +#define dbg(x...) do {} while (0) +#endif + struct control_value { char name[FILENAME_MAX]; char value[CG_VALUE_MAX]; diff --git a/libcgroup.h b/libcgroup.h index dee46486..08613cf1 100644 --- a/libcgroup.h +++ b/libcgroup.h @@ -43,12 +43,6 @@ __BEGIN_DECLS /* Estimated number of groups created */ #define MAX_GROUP_ELEMENTS 128 -#ifdef CGROUP_DEBUG -#define dbg(x...) printf(x) -#else -#define dbg(x...) do {} while(0) -#endif - /* * NOTE: Wide characters are not supported at the moment. Wide character support * would require us to use a scanner/parser that can parse beyond ASCII diff --git a/tools-common.h b/tools-common.h index cd16804c..bb5dd30e 100644 --- a/tools-common.h +++ b/tools-common.h @@ -19,7 +19,12 @@ #define __TOOLS_COMMON #include -#include "libcgroup-internal.h" + +#ifdef CGROUP_DEBUG +#define dbg(x...) printf(x) +#else +#define dbg(x...) do {} while (0) +#endif /** * Auxiliary specifier of group, used to store parsed command line options. -- 2.47.2