#define KLASSERT(e) LASSERT(e)
-void lbug_with_loc(char *file, const char *func, const int line)
+void lbug_with_loc(const char *file, const char *func, const int line)
__attribute__((noreturn));
#define LBUG() lbug_with_loc(__FILE__, __FUNCTION__, __LINE__)
void libcfs_debug_dumpstack(cfs_task_t *tsk);
void libcfs_run_upcall(char **argv);
-void libcfs_run_lbug_upcall(char * file, const char *fn, const int line);
+void libcfs_run_lbug_upcall(const char * file, const char *fn, const int line);
void libcfs_debug_dumplog(void);
int libcfs_debug_init(unsigned long bufsize);
int libcfs_debug_cleanup(void);
int libcfs_debug_clear_buffer(void);
-int libcfs_debug_mark_buffer(char *text);
+int libcfs_debug_mark_buffer(const char *text);
void libcfs_debug_set_level(unsigned int debug_level);
extern cfs_duration_t libcfs_console_min_delay;
extern unsigned int libcfs_console_backoff;
extern unsigned int libcfs_debug_binary;
-extern char debug_file_path[1024];
+extern char debug_file_path_arr[1024];
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);
#define __LIBCFS_USER_BITOPS_H__
/* test if bit nr is set in bitmap addr; returns previous value of bit nr */
-static __inline__ int set_bit(int nr, unsigned long * addr)
+static __inline__ int set_bit(int nr, unsigned long *addr)
{
- long mask;
+ unsigned long mask;
addr += nr / BITS_PER_LONG;
mask = 1UL << (nr & (BITS_PER_LONG - 1));
}
/* clear bit nr in bitmap addr; returns previous value of bit nr*/
-static __inline__ int clear_bit(int nr, unsigned long * addr)
+static __inline__ int clear_bit(int nr, unsigned long *addr)
{
- long mask;
+ unsigned long mask;
addr += nr / BITS_PER_LONG;
mask = 1UL << (nr & (BITS_PER_LONG - 1));
return nr;
}
-static __inline__ int test_bit(int nr, const unsigned long * addr)
+static __inline__ int test_bit(int nr, const unsigned long *addr)
{
- return ((1UL << (nr & (BITS_PER_LONG - 1))) & ((addr)[nr / BITS_PER_LONG])) != 0;
+ return ((1UL << (nr & (BITS_PER_LONG - 1))) &
+ ((addr)[nr / BITS_PER_LONG])) != 0;
}
/* using binary seach */
#include "tracefile.h"
void libcfs_debug_dumpstack(cfs_task_t *tsk)
-{
+{
return;
}
-void libcfs_run_lbug_upcall(char *file, const char *fn, const int line)
+void libcfs_run_lbug_upcall(const char *file, const char *fn, const int line)
{
}
-void lbug_with_loc(char *file, const char *func, const int line)
+void lbug_with_loc(const char *file, const char *func, const int line)
{
libcfs_catastrophe = 1;
CEMERG("LBUG: pid: %u thread: %#x\n",
static cfs_waitq_t debug_ctlwq;
#ifdef HAVE_BGL_SUPPORT
-char debug_file_path[1024] = "/bgl/ion/tmp/lustre-log";
+char debug_file_path_arr[1024] = "/bgl/ion/tmp/lustre-log";
#elif defined(__arch_um__)
-char debug_file_path[1024] = "/r/tmp/lustre-log";
+char debug_file_path_arr[1024] = "/r/tmp/lustre-log";
#else
-char debug_file_path[1024] = "/tmp/lustre-log";
+char debug_file_path_arr[1024] = "/tmp/lustre-log";
#endif
+/* We need to pass a pointer here, but elsewhere this must be a const */
+static char *debug_file_path = &debug_file_path_arr[0];
CFS_MODULE_PARM(debug_file_path, "s", charp, 0644,
"Path for dumping debug logs, "
"set 'NONE' to prevent log dumping");
CFS_PUSH_JOURNAL;
- if (strncmp(debug_file_path, "NONE", 4) != 0) {
+ if (strncmp(debug_file_path_arr, "NONE", 4) != 0) {
snprintf(debug_file_name, sizeof(debug_file_name) - 1,
- "%s.%ld.%ld", debug_file_path, cfs_time_current_sec(),
- (long)arg);
+ "%s.%ld.%ld", debug_file_path_arr,
+ cfs_time_current_sec(), (long)arg);
printk(KERN_ALERT "LustreError: dumping log to %s\n",
debug_file_name);
tracefile_dump_all_pages(debug_file_name);
* should not be be marked as such. */
#undef DEBUG_SUBSYSTEM
#define DEBUG_SUBSYSTEM S_UNDEFINED
-int libcfs_debug_mark_buffer(char *text)
+int libcfs_debug_mark_buffer(const char *text)
{
CDEBUG(D_TRACE,"***************************************************\n");
CDEBUG(D_WARNING, "DEBUG MARKER: %s\n", text);
}
}
-void libcfs_run_lbug_upcall(char *file, const char *fn, const int line)
+void libcfs_run_lbug_upcall(const char *file, const char *fn, const int line)
{
char *argv[6];
char buf[32];
snprintf (buf, sizeof buf, "%d", line);
argv[1] = "LBUG";
- argv[2] = file;
+ argv[2] = (char *)file;
argv[3] = (char *)fn;
argv[4] = buf;
argv[5] = NULL;
}
#ifdef __arch_um__
-void lbug_with_loc(char *file, const char *func, const int line)
+void lbug_with_loc(const char *file, const char *func, const int line)
{
libcfs_catastrophe = 1;
libcfs_debug_msg(NULL, 0, D_EMERG, file, func, line,
}
#else
/* coverity[+kill] */
-void lbug_with_loc(char *file, const char *func, const int line)
+void lbug_with_loc(const char *file, const char *func, const int line)
{
libcfs_catastrophe = 1;
libcfs_debug_msg(NULL, 0, D_EMERG, file, func, line, "LBUG\n");
{
.ctl_name = PSDEV_DEBUG_PATH,
.procname = "debug_path",
- .data = debug_file_path,
- .maxlen = sizeof(debug_file_path),
+ .data = debug_file_path_arr,
+ .maxlen = sizeof(debug_file_path_arr),
.mode = 0644,
.proc_handler = &proc_dostring,
},
{
libcfs_debug_msg(NULL, 0, D_EMERG, file, func, line,
"ASSERTION(%s) failed\n", expr);
- LBUG();
+ lbug_with_loc(file, func, line);
}
EXPORT_SYMBOL(libcfs_assertion_failed);
/* __linux__ */
#endif
-void lbug_with_loc(char *file, const char *func, const int line)
+void lbug_with_loc(const char *file, const char *func, const int line)
{
/* No libcfs_catastrophe in userspace! */
libcfs_debug_msg(NULL, 0, D_EMERG, file, func, line, "LBUG\n");
#include "tracefile.h"
void lnet_debug_dumpstack(cfs_task_t *tsk)
-{
+{
return;
}
cfs_task_t *lnet_current(void)
-{
+{
return cfs_current();
}
return 0;
}
-void lnet_run_lbug_upcall(char *file, const char *fn, const int line)
+void libcfs_run_lbug_upcall(const char *file, const char *fn, const int line)
+{
+}
+
+void libcfs_debug_dumplog(void)
{
}
-void lbug_with_loc(char *file, const char *func, const int line)
+void lbug_with_loc(const char *file, const char *func, const int line)
{
libcfs_catastrophe = 1;
CEMERG("LBUG: pid: %u thread: %#x\n",
- (unsigned)cfs_curproc_pid(), (unsigned)PsGetCurrentThread());
- // portals_debug_dumplog();
- // portals_run_lbug_upcall(file, func, line);
+ (unsigned)cfs_curproc_pid(), (unsigned)PsGetCurrentThread());
+ libcfs_debug_dumplog();
+ libcfs_run_lbug_upcall(file, func, line);
}
#if TDI_LIBCFS_DBG