diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/ini/ini_metadata.c | 2 | ||||
-rw-r--r-- | 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 3ee9fbaa..f6d35453 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 c7e375b7..04aa5c8b 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) |