ubifs: Add logging functions for ubifs_msg, ubifs_err and ubifs_warn
[cascardo/linux.git] / fs / ubifs / misc.c
1 #include <linux/kernel.h>
2 #include "ubifs.h"
3
4 /* Normal UBIFS messages */
5 void ubifs_msg(const struct ubifs_info *c, const char *fmt, ...)
6 {
7         struct va_format vaf;
8         va_list args;
9
10         va_start(args, fmt);
11
12         vaf.fmt = fmt;
13         vaf.va = &args;
14
15         pr_notice("UBIFS (ubi%d:%d): %pV\n",
16                   c->vi.ubi_num, c->vi.vol_id, &vaf);
17
18         va_end(args);
19 }                                                                   \
20
21 /* UBIFS error messages */
22 void ubifs_err(const struct ubifs_info *c, const char *fmt, ...)
23 {
24         struct va_format vaf;
25         va_list args;
26
27         va_start(args, fmt);
28
29         vaf.fmt = fmt;
30         vaf.va = &args;
31
32         pr_err("UBIFS error (ubi%d:%d pid %d): %ps: %pV\n",
33                c->vi.ubi_num, c->vi.vol_id, current->pid,
34                __builtin_return_address(0),
35                &vaf);
36
37         va_end(args);
38 }                                                                   \
39
40 /* UBIFS warning messages */
41 void ubifs_warn(const struct ubifs_info *c, const char *fmt, ...)
42 {
43         struct va_format vaf;
44         va_list args;
45
46         va_start(args, fmt);
47
48         vaf.fmt = fmt;
49         vaf.va = &args;
50
51         pr_warn("UBIFS warning (ubi%d:%d pid %d): %ps: %pV\n",
52                 c->vi.ubi_num, c->vi.vol_id, current->pid,
53                 __builtin_return_address(0),
54                 &vaf);
55
56         va_end(args);
57 }