Switch to the new and preferred approach for printing kernel messages (merge r4558 from trunk)

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@5035 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2013-10-05 17:49:40 +00:00
parent 85c4e7cf02
commit e41353a07f
5 changed files with 57 additions and 22 deletions

View File

@@ -1213,26 +1213,26 @@ static void iscsi_dump_char(int ch, unsigned char *text, int *pos)
if (ch < 0) {
while ((i % 16) != 0) {
printk(KERN_CONT " ");
pr_cont(" ");
text[i] = ' ';
i++;
if ((i % 16) == 0)
printk(KERN_CONT " | %.16s |\n", text);
pr_cont(" | %.16s |\n", text);
else if ((i % 4) == 0)
printk(KERN_CONT " |");
pr_cont(" |");
}
i = 0;
goto out;
}
text[i] = (ch < 0x20 || (ch >= 0x80 && ch <= 0xa0)) ? ' ' : ch;
printk(KERN_CONT " %02x", ch);
pr_cont(" %02x", ch);
i++;
if ((i % 16) == 0) {
printk(KERN_CONT " | %.16s |\n", text);
pr_cont(" | %.16s |\n", text);
i = 0;
} else if ((i % 4) == 0)
printk(KERN_CONT " |");
pr_cont(" |");
out:
*pos = i;

View File

@@ -1007,13 +1007,13 @@ int __del_conn(struct iscsi_session *session, struct iscsi_kern_conn_info *info)
void iscsi_extracheck_is_rd_thread(struct iscsi_conn *conn)
{
if (unlikely(current != conn->rd_task)) {
printk(KERN_EMERG "conn %p rd_task != current %p (pid %d)\n",
conn, current, current->pid);
pr_emerg("conn %p rd_task != current %p (pid %d)\n",
conn, current, current->pid);
while (in_softirq())
local_bh_enable();
printk(KERN_EMERG "rd_state %x\n", conn->rd_state);
printk(KERN_EMERG "rd_task %p\n", conn->rd_task);
printk(KERN_EMERG "rd_task->pid %d\n", conn->rd_task->pid);
pr_emerg("rd_state %x\n", conn->rd_state);
pr_emerg("rd_task %p\n", conn->rd_task);
pr_emerg("rd_task->pid %d\n", conn->rd_task->pid);
BUG();
}
}
@@ -1021,13 +1021,13 @@ void iscsi_extracheck_is_rd_thread(struct iscsi_conn *conn)
void iscsi_extracheck_is_wr_thread(struct iscsi_conn *conn)
{
if (unlikely(current != conn->wr_task)) {
printk(KERN_EMERG "conn %p wr_task != current %p (pid %d)\n",
conn, current, current->pid);
pr_emerg("conn %p wr_task != current %p (pid %d)\n",
conn, current, current->pid);
while (in_softirq())
local_bh_enable();
printk(KERN_EMERG "wr_state %x\n", conn->wr_state);
printk(KERN_EMERG "wr_task %p\n", conn->wr_task);
printk(KERN_EMERG "wr_task->pid %d\n", conn->wr_task->pid);
pr_emerg("wr_state %x\n", conn->wr_state);
pr_emerg("wr_task %p\n", conn->wr_task);
pr_emerg("wr_task->pid %d\n", conn->wr_task->pid);
BUG();
}
}

View File

@@ -103,7 +103,7 @@ __qla2x00_send_enable_lun(scsi_qla_host_t *ha, int enable)
qla_clear_tgt_mode(ha);
#if defined(QL_DEBUG_LEVEL_2) || defined(QL_DEBUG_LEVEL_3)
if (!pkt)
printk(KERN_ERR "%s: **** FAILED ****\n", __func__);
pr_err("%s: **** FAILED ****\n", __func__);
#endif
return;

View File

@@ -2990,7 +2990,7 @@ static inline bool scst_cmd_atomic(struct scst_cmd *cmd)
*/
if (unlikely((in_atomic() || in_interrupt() || irqs_disabled()) &&
!res)) {
printk(KERN_ERR "ERROR: atomic context and non-atomic cmd!\n");
pr_err("ERROR: atomic context and non-atomic cmd!\n");
dump_stack();
cmd->atomic = 1;
res = 1;

View File

@@ -32,12 +32,47 @@
#include <linux/bug.h> /* for WARN_ON_ONCE */
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
/*
* See also the following commits:
* d091c2f5 - Introduction of pr_info() etc. in <linux/kernel.h>.
* 311d0761 - Introduction of pr_cont() in <linux/kernel.h>.
* 968ab183 - Moved pr_info() etc. from <linux/kernel.h> to <linux/printk.h>
*/
#ifndef pr_info
#ifndef pr_fmt
#define pr_fmt(fmt) fmt
#endif
#define pr_emerg(fmt, ...) \
printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
#define pr_alert(fmt, ...) \
printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
#define pr_crit(fmt, ...) \
printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
#define pr_err(fmt, ...) \
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
#define pr_warning(fmt, ...) \
printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
#define pr_warn pr_warning
#define pr_notice(fmt, ...) \
printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
#define pr_info(fmt, ...) \
printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
#endif
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
#ifndef pr_cont
#define pr_cont(fmt, ...) \
printk(KERN_CONT fmt, ##__VA_ARGS__)
#endif
#endif
#if !defined(INSIDE_KERNEL_TREE)
#ifdef CONFIG_SCST_DEBUG
#define sBUG() do { \
printk(KERN_CRIT "BUG at %s:%d\n", \
__FILE__, __LINE__); \
pr_crit("BUG at %s:%d\n", __FILE__, __LINE__); \
local_irq_enable(); \
while (in_softirq()) \
local_bh_enable(); \
@@ -46,8 +81,8 @@
#define sBUG_ON(p) do { \
if (unlikely(p)) { \
printk(KERN_CRIT "BUG at %s:%d (%s)\n", \
__FILE__, __LINE__, #p); \
pr_crit("BUG at %s:%d (%s)\n", \
__FILE__, __LINE__, #p); \
local_irq_enable(); \
while (in_softirq()) \
local_bh_enable(); \