Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp> --- usr/log.h | 14 ++++++++++++++ usr/tgtadm.c | 15 ++------------- usr/tgtimg.c | 15 ++------------- 3 files changed, 18 insertions(+), 26 deletions(-) diff --git a/usr/log.h b/usr/log.h index 426237e..3ec6307 100644 --- a/usr/log.h +++ b/usr/log.h @@ -72,6 +72,19 @@ extern void log_error(const char *fmt, ...) extern void log_debug(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); +#ifdef NO_LOGGING +#define eprintf(fmt, args...) \ +do { \ + fprintf(stderr, "%s: " fmt, program_name, ##args); \ +} while (0) + +#define dprintf(fmt, args...) \ +do { \ + if (debug) \ + fprintf(stderr, "%s %d: " fmt, \ + __FUNCTION__, __LINE__, ##args); \ +} while (0) +#else #define eprintf(fmt, args...) \ do { \ log_error("%s(%d) " fmt, __FUNCTION__, __LINE__, ##args); \ @@ -82,5 +95,6 @@ do { \ if (unlikely(is_debug)) \ log_debug("%s(%d) " fmt, __FUNCTION__, __LINE__, ##args); \ } while (0) +#endif #endif /* LOG_H */ diff --git a/usr/tgtadm.c b/usr/tgtadm.c index fc93ad9..c2ed6b4 100644 --- a/usr/tgtadm.c +++ b/usr/tgtadm.c @@ -41,19 +41,8 @@ #include "list.h" #include "tgtadm.h" -#undef eprintf -#define eprintf(fmt, args...) \ -do { \ - fprintf(stderr, "%s: " fmt, program_name, ##args); \ -} while (0) - -#undef dprintf -#define dprintf(fmt, args...) \ -do { \ - if (debug) \ - fprintf(stderr, "%s %d: " fmt, \ - __FUNCTION__, __LINE__, ##args); \ -} while (0) +#define NO_LOGGING +#include "log.h" #define BUFSIZE 4096 diff --git a/usr/tgtimg.c b/usr/tgtimg.c index 70a823b..758f1fb 100644 --- a/usr/tgtimg.c +++ b/usr/tgtimg.c @@ -38,19 +38,8 @@ #include "libssc.h" #include "scsi.h" -#undef eprintf -#define eprintf(fmt, args...) \ -do { \ - fprintf(stderr, "%s: " fmt, program_name, ##args); \ -} while (0) - -#undef dprintf -#define dprintf(fmt, args...) \ -do { \ - if (debug) \ - fprintf(stderr, "%s %d: " fmt, \ - __FUNCTION__, __LINE__, ##args); \ -} while (0) +#define NO_LOGGING +#include "log.h" enum { OP_NEW, -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe stgt" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html |