Jakub Hrozek wrote: > On 04/10/2010 01:45 AM, Dmitri Pal wrote: > > Dmitri Pal wrote: > >> Addresses ticket https://fedorahosted.org/sssd/ticket/447 > >> Applies only on to of my previous ini metadata patch. > >> > >> > > Forgot to say that this is a patch in the title. > > > Nack, this does not compile with the default settings which do not have > HAVE_TRACE #defined, you need to add #define TRACE_LNUMBER(level, msg, > num) for that case, too.
The attached patch addresses the issue and adds other macros for signed numbers. _______________________________________________ sssd-devel mailing list sssd-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/sssd-devel -- Thank you, Dmitri Pal Engineering Manager IPA project, Red Hat Inc. ------------------------------- Looking to carve out IT costs? www.redhat.com/carveoutcosts/
From 8c1eba3f7b34951ea7b57e56cc0f99f17b8be5f0 Mon Sep 17 00:00:00 2001 From: Dmitri Pal <d...@redhat.com> Date: Fri, 9 Apr 2010 11:30:09 -0400 Subject: [PATCH] [TRACE] Add ability to trace 64bit numbers [TRACE] Adding macros for signed numbers --- common/ini/ini_metadata.c | 2 + common/trace/trace.h | 58 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/common/ini/ini_metadata.c b/common/ini/ini_metadata.c index 882ea11e58b729731fe706cc3c219fa88213a031..76a49edadc624c455b9f95bdb496c0463464d134 100644 --- a/common/ini/ini_metadata.c +++ b/common/ini/ini_metadata.c @@ -211,6 +211,8 @@ int collect_metadata(uint32_t metaflags, } /* Device ID */ + TRACE_INFO_LNUMBER("Device ID", file_stats.st_dev); + snprintf(buff, CONVERSION_BUFFER, "%lu", (unsigned long)file_stats.st_dev); error = col_add_str_property(metasec, diff --git a/common/trace/trace.h b/common/trace/trace.h index c7e375b7bbdfb67d6f99313e22be7c89c671e0c6..04aa5c8b8b304f0cd05a94f9beef0ff4e52d75bc 100644 --- a/common/trace/trace.h +++ b/common/trace/trace.h @@ -52,7 +52,7 @@ extern unsigned trace_level; } \ } while(0) -/* Tracing numbers */ +/* Tracing unsigned numbers */ #define TRACE_NUMBER(level, msg, num) \ do { \ if (level & trace_level) { \ @@ -64,6 +64,42 @@ extern unsigned trace_level; } \ } while(0) +/* Tracing signed numbers */ +#define TRACE_SNUMBER(level, msg, num) \ + do { \ + if (level & trace_level) { \ + printf("[DEBUG] %40s (%4d) %s%s %ld\n", \ + __FILE__, __LINE__, \ + (level == TRACE_ERROR) ? "ERROR-> " : "", \ + (msg != NULL) ? msg : "MISSING MESSAGE", \ + (long int)(num)); \ + } \ + } while(0) + +/* Tracing long numbers */ +#define TRACE_LNUMBER(level, msg, num) \ + do { \ + if (level & trace_level) { \ + printf("[DEBUG] %40s (%4d) %s%s %llu\n", \ + __FILE__, __LINE__, \ + (level == TRACE_ERROR) ? "ERROR-> " : "", \ + (msg != NULL) ? msg : "MISSING MESSAGE", \ + (unsigned long long int)(num)); \ + } \ + } while(0) + +/* Tracing signed long numbers */ +#define TRACE_SLNUMBER(level, msg, num) \ + do { \ + if (level & trace_level) { \ + printf("[DEBUG] %40s (%4d) %s%s %lld\n", \ + __FILE__, __LINE__, \ + (level == TRACE_ERROR) ? "ERROR-> " : "", \ + (msg != NULL) ? msg : "MISSING MESSAGE", \ + (long long int)(num)); \ + } \ + } while(0) + /* Tracing doubles */ #define TRACE_DOUBLE(level, msg, num) \ do { \ @@ -83,6 +119,9 @@ extern unsigned trace_level; /* Noop in case the tracing is disabled */ #define TRACE_STRING(level, msg, str) #define TRACE_NUMBER(level, msg, num) +#define TRACE_SNUMBER(level, msg, num) +#define TRACE_LNUMBER(level, msg, num) +#define TRACE_SLNUMBER(level, msg, num) #define TRACE_DOUBLE(level, msg, num) #endif /* HAVE_TRACE */ @@ -92,11 +131,26 @@ extern unsigned trace_level; #define TRACE_ERROR_STRING(msg, str) TRACE_STRING(TRACE_ERROR, msg, str) #define TRACE_INFO_STRING(msg, str) TRACE_STRING(TRACE_INFO, msg, str) -/* Convenience wrappers for numbers */ +/* Convenience wrappers for unsigned numbers */ #define TRACE_FLOW_NUMBER(msg, num) TRACE_NUMBER(TRACE_FLOW, msg, num) #define TRACE_ERROR_NUMBER(msg, num) TRACE_NUMBER(TRACE_ERROR, msg, num) #define TRACE_INFO_NUMBER(msg, num) TRACE_NUMBER(TRACE_INFO, msg, num) +/* Convenience wrappers for signed numbers */ +#define TRACE_FLOW_SNUMBER(msg, num) TRACE_SNUMBER(TRACE_FLOW, msg, num) +#define TRACE_ERROR_SNUMBER(msg, num) TRACE_SNUMBER(TRACE_ERROR, msg, num) +#define TRACE_INFO_SNUMBER(msg, num) TRACE_SNUMBER(TRACE_INFO, msg, num) + +/* Convenience wrappers for 64-bit long unsigned numbers */ +#define TRACE_FLOW_LNUMBER(msg, num) TRACE_LNUMBER(TRACE_FLOW, msg, num) +#define TRACE_ERROR_LNUMBER(msg, num) TRACE_LNUMBER(TRACE_ERROR, msg, num) +#define TRACE_INFO_LNUMBER(msg, num) TRACE_LNUMBER(TRACE_INFO, msg, num) + +/* Convenience wrappers for 64-bit long signed numbers */ +#define TRACE_FLOW_SLNUMBER(msg, num) TRACE_SLNUMBER(TRACE_FLOW, msg, num) +#define TRACE_ERROR_SLNUMBER(msg, num) TRACE_SLNUMBER(TRACE_ERROR, msg, num) +#define TRACE_INFO_SLNUMBER(msg, num) TRACE_SLNUMBER(TRACE_INFO, msg, num) + /* Convenience wrappers for numbers */ #define TRACE_FLOW_DOUBLE(msg, num) TRACE_DOUBLE(TRACE_FLOW, msg, num) #define TRACE_ERROR_DOUBLE(msg, num) TRACE_DOUBLE(TRACE_ERROR, msg, num) -- 1.5.5.6
_______________________________________________ sssd-devel mailing list sssd-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/sssd-devel