Whamcloud - gitweb
Quiet compiler warnings related to passing "const" pointers to non-const
authorgirish <girish>
Wed, 27 Aug 2008 12:27:57 +0000 (12:27 +0000)
committergirish <girish>
Wed, 27 Aug 2008 12:27:57 +0000 (12:27 +0000)
functions. (Andreas)
b=15981
i=girish
i=rread

libcfs/include/libcfs/libcfs_debug.h
libcfs/include/libcfs/libcfs_private.h
libcfs/include/libcfs/user-bitops.h
libcfs/libcfs/darwin/darwin-debug.c
libcfs/libcfs/debug.c
libcfs/libcfs/linux/linux-debug.c
libcfs/libcfs/linux/linux-proc.c
libcfs/libcfs/posix/posix-debug.c
libcfs/libcfs/tracefile.c
libcfs/libcfs/user-prim.c
libcfs/libcfs/winnt/winnt-debug.c

index 49d819e..87037f0 100644 (file)
@@ -54,7 +54,7 @@ extern cfs_duration_t libcfs_console_max_delay;
 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);
index 3620355..05254ea 100644 (file)
 
 #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__)
@@ -223,12 +223,12 @@ do {                                                                    \
 
 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);
 
index 5ed4a74..b6889f7 100644 (file)
@@ -42,9 +42,9 @@
 #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));
@@ -54,9 +54,9 @@ static __inline__ int set_bit(int nr, unsigned long * addr)
 }
 
 /* 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));
@@ -65,9 +65,10 @@ static __inline__ int clear_bit(int nr, unsigned long * addr)
         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 */
index fc10f9c..34bd02c 100644 (file)
 #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",
index 41848c2..12ec7a9 100644 (file)
@@ -113,15 +113,15 @@ EXPORT_SYMBOL(libcfs_kmemory);
 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
-char *debug_file_path_p = &debug_file_path[0];
-
-CFS_MODULE_PARM(debug_file_path_p, "s", charp, 0644,
+/* 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");
 
@@ -427,10 +427,10 @@ void libcfs_debug_dumplog_internal(void *arg)
 
         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);
@@ -515,7 +515,7 @@ int libcfs_debug_clear_buffer(void)
  * 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);
index e405ceb..2ecdba5 100644 (file)
@@ -151,7 +151,7 @@ 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)
 {
         char *argv[6];
         char buf[32];
@@ -160,7 +160,7 @@ void libcfs_run_lbug_upcall(char *file, const char *fn, const int line)
         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;
@@ -169,7 +169,7 @@ void libcfs_run_lbug_upcall(char *file, const char *fn, const int line)
 }
 
 #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,
@@ -181,7 +181,7 @@ void lbug_with_loc(char *file, const char *func, const int 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");
index a6b10f0..1d24167 100644 (file)
@@ -375,8 +375,8 @@ static cfs_sysctl_table_t lnet_table[] = {
         {
                 .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,
         },
index 18317f6..6a8a4f2 100644 (file)
@@ -216,7 +216,7 @@ int libcfs_debug_clear_buffer(void)
         return 0;
 }
 
-int libcfs_debug_mark_buffer(char *text)
+int libcfs_debug_mark_buffer(const char *text)
 {
 
         fprintf(debug_file_fd, "*******************************************************************************\n");
index 9107ebb..5530832 100644 (file)
@@ -448,7 +448,7 @@ libcfs_assertion_failed(const char *expr, const char *file,
 {
         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);
 
index 7b23ba9..07678e0 100644 (file)
@@ -356,7 +356,7 @@ void *cfs_stack_trace_frame(struct cfs_stack_trace *trace, int frame_no)
 /* __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");
index dff082b..e226608 100644 (file)
 #include "tracefile.h"
 
 void lnet_debug_dumpstack(cfs_task_t *tsk)
-{ 
+{
        return;
 }
 
 cfs_task_t *lnet_current(void)
-{ 
+{
        return cfs_current();
 }
 
@@ -59,17 +59,21 @@ int lnet_arch_debug_cleanup(void)
        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