Whamcloud - gitweb
LU-147 hash code cleanup
[fs/lustre-release.git] / libcfs / libcfs / debug.c
index d41ea60..de6e0da 100644 (file)
@@ -26,7 +26,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  */
 /*
@@ -65,7 +65,7 @@ CFS_MODULE_PARM(libcfs_debug_mb, "i", uint, 0644,
                 "Total debug buffer size.");
 EXPORT_SYMBOL(libcfs_debug_mb);
 
-unsigned int libcfs_printk = (D_CANTMASK | D_NETERROR);
+unsigned int libcfs_printk = D_CANTMASK;
 CFS_MODULE_PARM(libcfs_printk, "i", uint, 0644,
                 "Lustre kernel debug console mask");
 EXPORT_SYMBOL(libcfs_printk);
@@ -115,10 +115,10 @@ EXPORT_SYMBOL(libcfs_kmemory);
 
 static cfs_waitq_t debug_ctlwq;
 
-char libcfs_debug_file_path_arr[1024] = LIBCFS_DEBUG_FILE_PATH_DEFAULT;
+char libcfs_debug_file_path_arr[PATH_MAX] = LIBCFS_DEBUG_FILE_PATH_DEFAULT;
 
 /* We need to pass a pointer here, but elsewhere this must be a const */
-char *libcfs_debug_file_path = &libcfs_debug_file_path_arr[0];
+char *libcfs_debug_file_path;
 CFS_MODULE_PARM(libcfs_debug_file_path, "s", charp, 0644,
                 "Path for dumping debug logs, "
                 "set 'NONE' to prevent log dumping");
@@ -316,12 +316,14 @@ libcfs_debug_str2mask(int *mask, const char *str, int is_subsys)
 
         if ((t = sscanf(str, "%i%n", &m, &matched)) >= 1 &&
             matched == n) {
+                CWARN("You are trying to use a numerical value for the mask -"
+                      " this will be deprecated in a future release.\n");
                 *mask = m;
                 return 0;
         }
 
-        return libcfs_str2mask(str, fn, mask, is_subsys ? 0 : D_CANTMASK,
-                               0xffffffff);
+        return cfs_str2mask(str, fn, mask, is_subsys ? 0 : D_CANTMASK,
+                            0xffffffff);
 }
 
 /**
@@ -393,6 +395,12 @@ int libcfs_debug_init(unsigned long bufsize)
                 libcfs_console_min_delay = CDEBUG_DEFAULT_MIN_DELAY;
         }
 
+        if (libcfs_debug_file_path != NULL) {
+                memset(libcfs_debug_file_path_arr, 0, PATH_MAX);
+                strncpy(libcfs_debug_file_path_arr, 
+                        libcfs_debug_file_path, PATH_MAX-1);
+        }
+
         /* If libcfs_debug_mb is set to an invalid value or uninitialized
          * then just make the total buffers smp_num_cpus * TCD_MAX_PAGES */
         if (max > cfs_trace_max_debug_mb() || max < cfs_num_possible_cpus()) {