* in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see [sun.com URL with a
- * copy of GPLv2].
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* from here: this will lead to infinite recursion.
*/
- printk(KERN_WARNING "debug daemon buffer overflowed; discarding"
- " 10%% of pages (%d of %ld)\n", pgcount + 1, tcd->tcd_cur_pages);
+ if (printk_ratelimit())
+ printk(KERN_WARNING "debug daemon buffer overflowed; "
+ "discarding 10%% of pages (%d of %ld)\n",
+ pgcount + 1, tcd->tcd_cur_pages);
CFS_INIT_LIST_HEAD(&pc.pc_pages);
spin_lock_init(&pc.pc_lock);
int libcfs_debug_vmsg2(cfs_debug_limit_state_t *cdls, int subsys, int mask,
const char *file, const char *fn, const int line,
const char *format1, va_list args,
- const char *format2, ...)
+ const char *format2, ...)
{
struct trace_cpu_data *tcd = NULL;
struct ptldebug_header header;
* _without_ terminating NULL.
* if needed is to small for this format.
*/
- for (i=0;i<2;i++) {
+ for (i = 0; i < 2; i++) {
tage = trace_get_tage(tcd, needed + known_size + 1);
if (tage == NULL) {
if (needed + known_size > CFS_PAGE_SIZE)
goto console;
}
- string_buf = (char *)cfs_page_address(tage->page)+tage->used+known_size;
+ string_buf = (char *)cfs_page_address(tage->page) +
+ tage->used + known_size;
max_nob = CFS_PAGE_SIZE - tage->used - known_size;
if (max_nob <= 0) {
needed = vsnprintf(string_buf, max_nob, format1, ap);
va_end(ap);
}
-
if (format2) {
remain = max_nob - needed;
if (remain < 0)
remain = 0;
-
+
va_start(ap, format2);
- needed += vsnprintf(string_buf+needed, remain, format2, ap);
+ needed += vsnprintf(string_buf + needed, remain,
+ format2, ap);
va_end(ap);
}
if (needed < max_nob) /* well. printing ok.. */
break;
}
-
+
if (*(string_buf+needed-1) != '\n')
printk(KERN_INFO "format at %s:%d:%s doesn't end in newline\n",
file, line, fn);
-
+
header.ph_len = known_size + needed;
debug_buf = (char *)cfs_page_address(tage->page) + tage->used;
{
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);
const char *usr_buffer, int usr_buffer_nob)
{
int nob;
-
+
if (usr_buffer_nob > knl_buffer_nob)
return -EOVERFLOW;
-
- if (copy_from_user((void *)knl_buffer,
+
+ if (copy_from_user((void *)knl_buffer,
(void *)usr_buffer, usr_buffer_nob))
return -EFAULT;
* copied out string - usually "\n", for /proc entries and "" (i.e. a
* terminating zero byte) for sysctl entries */
int nob = strlen(knl_buffer);
-
+
if (nob > usr_buffer_nob)
nob = usr_buffer_nob;
-
+
if (copy_to_user(usr_buffer, knl_buffer, nob))
return -EFAULT;
-
+
if (append != NULL && nob < usr_buffer_nob) {
if (copy_to_user(usr_buffer + nob, append, 1))
return -EFAULT;
-
+
nob++;
}
{
if (nob > 2 * CFS_PAGE_SIZE) /* string must be "sensible" */
return -EINVAL;
-
+
*str = cfs_alloc(nob, CFS_ALLOC_STD | CFS_ALLOC_ZERO);
if (*str == NULL)
return -ENOMEM;
int trace_daemon_command(char *str)
{
int rc = 0;
-
+
tracefile_write_lock();
if (strcmp(str, "stop") == 0) {
int pages;
int limit = trace_max_debug_mb();
struct trace_cpu_data *tcd;
-
+
if (mb < num_possible_cpus())
return -EINVAL;
int j;
struct trace_cpu_data *tcd;
int total_pages = 0;
-
+
tracefile_read_lock();
tcd_for_each(tcd, i, j)