Whamcloud - gitweb
LU-9859 libcfs: change libcfs_log_* functions to inline
[fs/lustre-release.git] / libcfs / include / libcfs / libcfs_debug.h
index a167cf3..662d290 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * libcfs/include/libcfs/libcfs_debug.h
  *
@@ -38,7 +37,6 @@
 #ifndef __LIBCFS_DEBUG_H__
 #define __LIBCFS_DEBUG_H__
 
-#include <stdarg.h>
 #include <linux/limits.h>
 #include <uapi/linux/lnet/libcfs_debug.h>
 
@@ -49,16 +47,19 @@ extern unsigned int libcfs_subsystem_debug;
 extern unsigned int libcfs_stack;
 extern unsigned int libcfs_debug;
 extern unsigned int libcfs_printk;
-extern unsigned int libcfs_console_ratelimit;
 extern unsigned int libcfs_watchdog_ratelimit;
+extern unsigned int libcfs_console_ratelimit;
 extern unsigned int libcfs_console_max_delay;
 extern unsigned int libcfs_console_min_delay;
 extern unsigned int libcfs_console_backoff;
 extern unsigned int libcfs_debug_binary;
-extern char libcfs_debug_file_path_arr[PATH_MAX];
+extern char *libcfs_debug_file_path;
+
+struct task_struct;
 
 int libcfs_debug_mask2str(char *str, int size, int mask, int is_subsys);
 int libcfs_debug_str2mask(int *mask, const char *str, int is_subsys);
+void libcfs_debug_dumpstack(struct task_struct *tsk);
 
 /* Has there been an LBUG? */
 extern unsigned int libcfs_catastrophe;
@@ -211,10 +212,32 @@ static inline int cfs_cdebug_show(unsigned int mask, unsigned int subsystem)
 #define LCONSOLE_EMERG(format, ...) \
        CDEBUG(D_CONSOLE | D_EMERG, format, ## __VA_ARGS__)
 
+int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata,
+                    const char *format1, ...)
+       __printf(2, 3);
+
+/* other external symbols that tracefile provides: */
+int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,
+                            const char *knl_buffer, char *append);
+
+#define LIBCFS_DEBUG_FILE_PATH_DEFAULT "/tmp/lustre-log"
+
 #if defined(CDEBUG_ENTRY_EXIT)
 
-void libcfs_log_goto(struct libcfs_debug_msg_data *goto_data,
-                    const char *label, long rc);
+static inline long libcfs_log_return(struct libcfs_debug_msg_data *msgdata, long rc)
+{
+       libcfs_debug_msg(msgdata, "Process leaving (rc=%lu : %ld : %lx)\n",
+                        rc, rc, rc);
+       return rc;
+}
+
+static inline void libcfs_log_goto(struct libcfs_debug_msg_data *msgdata,
+                                  const char *label, long rc)
+{
+       libcfs_debug_msg(msgdata,
+                        "Process leaving via %s (rc=%lu : %ld : %#lx)\n",
+                        label, rc, rc, rc);
+}
 
 # define GOTO(label, rc)                                                     \
 do {                                                                         \
@@ -228,8 +251,6 @@ do {                                                                              \
        goto label;                                                           \
 } while (0)
 
-
-long libcfs_log_return(struct libcfs_debug_msg_data *, long rc);
 # if BITS_PER_LONG > 32
 #  define RETURN(rc)                                                         \
 do {                                                                         \
@@ -284,22 +305,6 @@ do {                                                                       \
        return;                                                         \
 } while (0)
 
-extern int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata,
-                            const char *format1, ...)
-        __attribute__ ((format (printf, 2, 3)));
-
-extern int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
-                              const char *format1,
-                              va_list args, const char *format2, ...)
-        __attribute__ ((format (printf, 4, 5)));
-
-/* other external symbols that tracefile provides: */
-extern int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob,
-                                  const char __user *usr_buffer,
-                                  int usr_buffer_nob);
-extern int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,
-                                   const char *knl_buffer, char *append);
-
-#define LIBCFS_DEBUG_FILE_PATH_DEFAULT "/tmp/lustre-log"
+void cfs_debug_init(void);
 
 #endif /* __LIBCFS_DEBUG_H__ */