debug: Add GPFS tracing backend
authorChristof Schmitt <cs@samba.org>
Thu, 19 Feb 2015 23:32:44 +0000 (16:32 -0700)
committerChristof Schmitt <cs@samba.org>
Mon, 23 Mar 2015 20:22:12 +0000 (21:22 +0100)
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
docs-xml/smbdotconf/logging/logging.xml
lib/util/debug.c

index 20842bd9710aba2699a2c4a1b4cbad993bd15461..41b6c08467b67f49b5c3807447819e65e74a5cd1 100644 (file)
@@ -31,6 +31,7 @@
     <listitem><para><parameter moreinfo="none">file</parameter></para></listitem>
     <listitem><para><parameter moreinfo="none">systemd</parameter></para></listitem>
     <listitem><para><parameter moreinfo="none">lttng</parameter></para></listitem>
+    <listitem><para><parameter moreinfo="none">gpfs</parameter></para></listitem>
   </itemizedlist>
 
 </description>
index c2781afa39069f6edb483df2937f6b256531d504..6b16cd72815bf27b1d529282e7992d8b2552c4f6 100644 (file)
@@ -195,6 +195,38 @@ static void debug_lttng_log(int msg_level,
 }
 #endif /* WITH_LTTNG_TRACEF */
 
+#ifdef HAVE_GPFS
+#include "gpfswrap.h"
+static void debug_gpfs_reload(bool enabled, bool previously_enabled,
+                             const char *prog_name)
+{
+       gpfswrap_init();
+
+       if (enabled && !previously_enabled) {
+               gpfswrap_init_trace();
+               return;
+       }
+
+       if (!enabled && previously_enabled) {
+               gpfswrap_fini_trace();
+               return;
+       }
+
+       if (enabled) {
+               /*
+                * Trigger GPFS library to adjust state if necessary.
+                */
+               gpfswrap_query_trace();
+       }
+}
+
+static void debug_gpfs_log(int msg_level,
+                          const char *msg, const char *msg_no_nl)
+{
+       gpfswrap_add_trace(msg_level, msg_no_nl);
+}
+#endif /* HAVE_GPFS */
+
 static struct debug_backend {
        const char *name;
        int log_level;
@@ -228,6 +260,13 @@ static struct debug_backend {
        },
 #endif
 
+#ifdef HAVE_GPFS
+       {
+               .name = "gpfs",
+               .reload = debug_gpfs_reload,
+               .log = debug_gpfs_log,
+       },
+#endif
 };
 
 static struct debug_backend *debug_find_backend(const char *name)