[Pvfs2-cvs] commit by kunkel in pvfs2/src/common/gossip: gossip.h gossip.c

CVS commit program cvs at parl.clemson.edu
Sat Feb 17 06:17:31 EST 2007


Update of /projects/cvsroot/pvfs2/src/common/gossip
In directory parlweb1:/tmp/cvs-serv2872/src/common/gossip

Modified Files:
      Tag: kunkel-migration-branch
	gossip.h gossip.c 
Log Message:
Update migration branch to current CVS version


Index: gossip.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/gossip/gossip.h,v
diff -p -u -r1.17 -r1.17.4.1
--- gossip.h	10 Aug 2006 19:02:22 -0000	1.17
+++ gossip.h	17 Feb 2007 11:17:30 -0000	1.17.4.1
@@ -22,10 +22,12 @@
 
 #ifndef __KERNEL__
 #include <stdint.h>
+#include <stdarg.h>
 #include "syslog.h"
 #endif
 #include "pvfs2-config.h"
 
+
 /********************************************************************
  * Visible interface
  */
@@ -37,7 +39,8 @@ enum gossip_logstamp
 {
     GOSSIP_LOGSTAMP_NONE = 0,
     GOSSIP_LOGSTAMP_USEC = 1,
-    GOSSIP_LOGSTAMP_DATETIME = 2
+    GOSSIP_LOGSTAMP_DATETIME = 2,
+    GOSSIP_LOGSTAMP_THREAD = 3
 };
 #define GOSSIP_LOGSTAMP_DEFAULT GOSSIP_LOGSTAMP_USEC
 
@@ -66,6 +69,10 @@ do {                                    
 } while(0)
 
 #define gossip_err printk
+#define gossip_lerr(format, f...)                  \
+do {                                               \
+    gossip_err("%s line %d: " format, __FILE__ , __LINE__ , ##f); \
+} while(0)
 
 #else
 
@@ -102,6 +109,11 @@ int __gossip_debug(
 int gossip_err(
     const char *format,
     ...) __attribute__ ((format(printf, 1, 2)));
+int __gossip_debug_va(
+    uint64_t mask,
+    char prefix,
+    const char *format,
+    va_list ap);
 
 #ifdef GOSSIP_DISABLE_DEBUG
 #define gossip_debug(mask, format, f...) do {} while(0)

Index: gossip.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/gossip/gossip.c,v
diff -p -u -r1.19 -r1.19.16.1
--- gossip.c	7 Apr 2006 04:27:32 -0000	1.19
+++ gossip.c	17 Feb 2007 11:17:30 -0000	1.19.16.1
@@ -25,6 +25,7 @@
 #endif
 
 #include "gossip.h"
+#include "gen-locks.h"
 
 /** controls whether debugging is on or off */
 int gossip_debug_on = 0;
@@ -270,7 +271,23 @@ int __gossip_debug(
     const char *format,
     ...)
 {
+    int ret = -EINVAL;
     va_list ap;
+
+    /* rip out the variable arguments */
+    va_start(ap, format);
+    __gossip_debug_va(mask, prefix, format, ap);
+    va_end(ap);
+
+    return ret;
+}
+
+int __gossip_debug_va(
+    uint64_t mask,
+    char prefix,
+    const char *format,
+    va_list ap)
+{
     int ret = -EINVAL;
 
     /* NOTE: this check happens in the macro (before making a function call)
@@ -291,16 +308,14 @@ int __gossip_debug(
         prefix = 'D';
     }
 
-    /* rip out the variable arguments */
-    va_start(ap, format);
-
     switch (gossip_facility)
     {
     case GOSSIP_STDERR:
         ret = gossip_debug_fp(stderr, prefix, format, ap, internal_logstamp);
         break;
     case GOSSIP_FILE:
-        ret = gossip_debug_fp(internal_log_file, prefix, format, ap, internal_logstamp);
+        ret = gossip_debug_fp(
+            internal_log_file, prefix, format, ap, internal_logstamp);
         break;
     case GOSSIP_SYSLOG:
         ret = gossip_debug_syslog(prefix, format, ap);
@@ -309,8 +324,6 @@ int __gossip_debug(
         break;
     }
 
-    va_end(ap);
-
     return ret;
 }
 
@@ -451,6 +464,16 @@ static int gossip_debug_fp(FILE *fp, cha
             bptr += 13;
             bsize -= 13;
             break;
+        case GOSSIP_LOGSTAMP_THREAD:
+            gettimeofday(&tv, 0);
+            tp = tv.tv_sec;
+            strftime(bptr, 9, "%H:%M:%S", localtime(&tp));
+            sprintf(bptr+8, ".%06ld (%09lu)] ", (long)tv.tv_usec, 
+                    gen_thread_self());
+            bptr += 30;
+            bsize -= 30;
+            break;
+
         case GOSSIP_LOGSTAMP_NONE:
             bptr--;
             sprintf(bptr, "] ");



More information about the Pvfs2-cvs mailing list