Commit 6b38d03f authored by Artem Bityutskiy's avatar Artem Bityutskiy

UBIFS: use pr_ helper instead of printk

Use 'pr_err()' instead of 'printk(KERN_ERR', etc.
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
parent 79fda517
This diff is collapsed.
...@@ -150,7 +150,7 @@ struct ubifs_global_debug_info { ...@@ -150,7 +150,7 @@ struct ubifs_global_debug_info {
#define ubifs_assert(expr) do { \ #define ubifs_assert(expr) do { \
if (unlikely(!(expr))) { \ if (unlikely(!(expr))) { \
printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ pr_crit("UBIFS assert failed in %s at %u (pid %d)\n", \
__func__, __LINE__, current->pid); \ __func__, __LINE__, current->pid); \
dump_stack(); \ dump_stack(); \
} \ } \
...@@ -159,7 +159,7 @@ struct ubifs_global_debug_info { ...@@ -159,7 +159,7 @@ struct ubifs_global_debug_info {
#define ubifs_assert_cmt_locked(c) do { \ #define ubifs_assert_cmt_locked(c) do { \
if (unlikely(down_write_trylock(&(c)->commit_sem))) { \ if (unlikely(down_write_trylock(&(c)->commit_sem))) { \
up_write(&(c)->commit_sem); \ up_write(&(c)->commit_sem); \
printk(KERN_CRIT "commit lock is not locked!\n"); \ pr_crit("commit lock is not locked!\n"); \
ubifs_assert(0); \ ubifs_assert(0); \
} \ } \
} while (0) } while (0)
...@@ -178,7 +178,7 @@ struct ubifs_global_debug_info { ...@@ -178,7 +178,7 @@ struct ubifs_global_debug_info {
/* Just a debugging messages not related to any specific UBIFS subsystem */ /* Just a debugging messages not related to any specific UBIFS subsystem */
#define dbg_msg(fmt, ...) \ #define dbg_msg(fmt, ...) \
printk(KERN_DEBUG "UBIFS DBG (pid %d): %s: " fmt "\n", current->pid, \ pr_err("UBIFS DBG (pid %d): %s: " fmt "\n", current->pid, \
__func__, ##__VA_ARGS__) __func__, ##__VA_ARGS__)
/* General messages */ /* General messages */
......
...@@ -1886,8 +1886,7 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum) ...@@ -1886,8 +1886,7 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum)
int err, len = c->leb_size, node_type, node_num, node_len, offs; int err, len = c->leb_size, node_type, node_num, node_len, offs;
void *buf, *p; void *buf, *p;
printk(KERN_DEBUG "(pid %d) start dumping LEB %d\n", pr_err("(pid %d) start dumping LEB %d\n", current->pid, lnum);
current->pid, lnum);
buf = p = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); buf = p = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL);
if (!buf) { if (!buf) {
ubifs_err("cannot allocate memory to dump LPT"); ubifs_err("cannot allocate memory to dump LPT");
...@@ -1905,14 +1904,14 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum) ...@@ -1905,14 +1904,14 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum)
pad_len = get_pad_len(c, p, len); pad_len = get_pad_len(c, p, len);
if (pad_len) { if (pad_len) {
printk(KERN_DEBUG "LEB %d:%d, pad %d bytes\n", pr_err("LEB %d:%d, pad %d bytes\n",
lnum, offs, pad_len); lnum, offs, pad_len);
p += pad_len; p += pad_len;
len -= pad_len; len -= pad_len;
continue; continue;
} }
if (len) if (len)
printk(KERN_DEBUG "LEB %d:%d, free %d bytes\n", pr_err("LEB %d:%d, free %d bytes\n",
lnum, offs, len); lnum, offs, len);
break; break;
} }
...@@ -1923,11 +1922,10 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum) ...@@ -1923,11 +1922,10 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum)
{ {
node_len = c->pnode_sz; node_len = c->pnode_sz;
if (c->big_lpt) if (c->big_lpt)
printk(KERN_DEBUG "LEB %d:%d, pnode num %d\n", pr_err("LEB %d:%d, pnode num %d\n",
lnum, offs, node_num); lnum, offs, node_num);
else else
printk(KERN_DEBUG "LEB %d:%d, pnode\n", pr_err("LEB %d:%d, pnode\n", lnum, offs);
lnum, offs);
break; break;
} }
case UBIFS_LPT_NNODE: case UBIFS_LPT_NNODE:
...@@ -1937,29 +1935,28 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum) ...@@ -1937,29 +1935,28 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum)
node_len = c->nnode_sz; node_len = c->nnode_sz;
if (c->big_lpt) if (c->big_lpt)
printk(KERN_DEBUG "LEB %d:%d, nnode num %d, ", pr_err("LEB %d:%d, nnode num %d, ",
lnum, offs, node_num); lnum, offs, node_num);
else else
printk(KERN_DEBUG "LEB %d:%d, nnode, ", pr_err("LEB %d:%d, nnode, ",
lnum, offs); lnum, offs);
err = ubifs_unpack_nnode(c, p, &nnode); err = ubifs_unpack_nnode(c, p, &nnode);
for (i = 0; i < UBIFS_LPT_FANOUT; i++) { for (i = 0; i < UBIFS_LPT_FANOUT; i++) {
printk(KERN_CONT "%d:%d", nnode.nbranch[i].lnum, pr_cont("%d:%d", nnode.nbranch[i].lnum,
nnode.nbranch[i].offs); nnode.nbranch[i].offs);
if (i != UBIFS_LPT_FANOUT - 1) if (i != UBIFS_LPT_FANOUT - 1)
printk(KERN_CONT ", "); pr_cont(", ");
} }
printk(KERN_CONT "\n"); pr_cont("\n");
break; break;
} }
case UBIFS_LPT_LTAB: case UBIFS_LPT_LTAB:
node_len = c->ltab_sz; node_len = c->ltab_sz;
printk(KERN_DEBUG "LEB %d:%d, ltab\n", pr_err("LEB %d:%d, ltab\n", lnum, offs);
lnum, offs);
break; break;
case UBIFS_LPT_LSAVE: case UBIFS_LPT_LSAVE:
node_len = c->lsave_sz; node_len = c->lsave_sz;
printk(KERN_DEBUG "LEB %d:%d, lsave len\n", lnum, offs); pr_err("LEB %d:%d, lsave len\n", lnum, offs);
break; break;
default: default:
ubifs_err("LPT node type %d not recognized", node_type); ubifs_err("LPT node type %d not recognized", node_type);
...@@ -1970,8 +1967,7 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum) ...@@ -1970,8 +1967,7 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum)
len -= node_len; len -= node_len;
} }
printk(KERN_DEBUG "(pid %d) finish dumping LEB %d\n", pr_err("(pid %d) finish dumping LEB %d\n", current->pid, lnum);
current->pid, lnum);
out: out:
vfree(buf); vfree(buf);
return; return;
...@@ -1988,12 +1984,10 @@ void ubifs_dump_lpt_lebs(const struct ubifs_info *c) ...@@ -1988,12 +1984,10 @@ void ubifs_dump_lpt_lebs(const struct ubifs_info *c)
{ {
int i; int i;
printk(KERN_DEBUG "(pid %d) start dumping all LPT LEBs\n", pr_err("(pid %d) start dumping all LPT LEBs\n", current->pid);
current->pid);
for (i = 0; i < c->lpt_lebs; i++) for (i = 0; i < c->lpt_lebs; i++)
dump_lpt_leb(c, i + c->lpt_first); dump_lpt_leb(c, i + c->lpt_first);
printk(KERN_DEBUG "(pid %d) finish dumping all LPT LEBs\n", pr_err("(pid %d) finish dumping all LPT LEBs\n", current->pid);
current->pid);
} }
/** /**
......
...@@ -42,16 +42,15 @@ ...@@ -42,16 +42,15 @@
#define UBIFS_VERSION 1 #define UBIFS_VERSION 1
/* Normal UBIFS messages */ /* Normal UBIFS messages */
#define ubifs_msg(fmt, ...) \ #define ubifs_msg(fmt, ...) pr_notice("UBIFS: " fmt "\n", ##__VA_ARGS__)
printk(KERN_NOTICE "UBIFS: " fmt "\n", ##__VA_ARGS__)
/* UBIFS error messages */ /* UBIFS error messages */
#define ubifs_err(fmt, ...) \ #define ubifs_err(fmt, ...) \
printk(KERN_ERR "UBIFS error (pid %d): %s: " fmt "\n", current->pid, \ pr_err("UBIFS error (pid %d): %s: " fmt "\n", current->pid, \
__func__, ##__VA_ARGS__) __func__, ##__VA_ARGS__)
/* UBIFS warning messages */ /* UBIFS warning messages */
#define ubifs_warn(fmt, ...) \ #define ubifs_warn(fmt, ...) \
printk(KERN_WARNING "UBIFS warning (pid %d): %s: " fmt "\n", \ pr_warn("UBIFS warning (pid %d): %s: " fmt "\n", \
current->pid, __func__, ##__VA_ARGS__) current->pid, __func__, ##__VA_ARGS__)
/* UBIFS file system VFS magic number */ /* UBIFS file system VFS magic number */
#define UBIFS_SUPER_MAGIC 0x24051905 #define UBIFS_SUPER_MAGIC 0x24051905
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment