]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
printk: prefix print_time and msg_print_text with printk_
authorJoe Perches <joe@perches.com>
Tue, 23 Oct 2012 02:50:22 +0000 (13:50 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 24 Oct 2012 03:20:16 +0000 (14:20 +1100)
Make these static functions global and prefix them with printk_.
Create declarations for these functions in printk_log.h

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Kay Sievers <kay@vrfy.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/printk/printk.c
kernel/printk/printk_log.h

index 76206d0f2ea134085ed414a254ee462f1cfa9225..63cfc2a90302c3fe8ad530d5393ee6a61e0d222c 100644 (file)
@@ -324,7 +324,7 @@ static bool printk_time;
 #endif
 module_param_named(time, printk_time, bool, S_IRUGO | S_IWUSR);
 
-static size_t print_time(u64 ts, char *buf)
+size_t printk_print_time(u64 ts, char *buf)
 {
        unsigned long rem_nsec;
 
@@ -358,11 +358,11 @@ static size_t print_prefix(const struct printk_log *msg, bool syslog, char *buf)
                }
        }
 
-       len += print_time(msg->ts_nsec, buf ? buf + len : NULL);
+       len += printk_print_time(msg->ts_nsec, buf ? buf + len : NULL);
        return len;
 }
 
-static size_t msg_print_text(const struct printk_log *msg,
+size_t printk_msg_print_text(const struct printk_log *msg,
                             enum printk_log_flags prev,
                             bool syslog, char *buf, size_t size)
 {
@@ -451,8 +451,8 @@ static int syslog_print(char __user *buf, int size)
 
                skip = syslog_partial;
                msg = printk_log_from_idx(syslog_idx);
-               n = msg_print_text(msg, syslog_prev, true, text,
-                                  PRINTK_LOG_LINE_MAX + PRINTK_PREFIX_MAX);
+               n = printk_msg_print_text(msg, syslog_prev, true, text,
+                                         PRINTK_LOG_LINE_MAX + PRINTK_PREFIX_MAX);
                if (n - syslog_partial <= size) {
                        /* message fits into buffer, move forward */
                        syslog_idx = printk_log_next(syslog_idx);
@@ -518,7 +518,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
                while (seq < printk_log_next_seq) {
                        struct printk_log *msg = printk_log_from_idx(idx);
 
-                       len += msg_print_text(msg, prev, true, NULL, 0);
+                       len += printk_msg_print_text(msg, prev, true, NULL, 0);
                        prev = msg->flags;
                        idx = printk_log_next(idx);
                        seq++;
@@ -531,7 +531,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
                while (len > size && seq < printk_log_next_seq) {
                        struct printk_log *msg = printk_log_from_idx(idx);
 
-                       len -= msg_print_text(msg, prev, true, NULL, 0);
+                       len -= printk_msg_print_text(msg, prev, true, NULL, 0);
                        prev = msg->flags;
                        idx = printk_log_next(idx);
                        seq++;
@@ -546,8 +546,8 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
                        struct printk_log *msg = printk_log_from_idx(idx);
                        int textlen;
 
-                       textlen = msg_print_text(msg, prev, true, text,
-                                                PRINTK_LOG_LINE_MAX + PRINTK_PREFIX_MAX);
+                       textlen = printk_msg_print_text(msg, prev, true, text,
+                                                       PRINTK_LOG_LINE_MAX + PRINTK_PREFIX_MAX);
                        if (textlen < 0) {
                                len = textlen;
                                break;
@@ -691,7 +691,7 @@ int do_syslog(int type, char __user *buf, int len, bool from_file)
                        while (seq < printk_log_next_seq) {
                                struct printk_log *msg = printk_log_from_idx(idx);
 
-                               error += msg_print_text(msg, prev, true, NULL, 0);
+                               error += printk_msg_print_text(msg, prev, true, NULL, 0);
                                idx = printk_log_next(idx);
                                seq++;
                                prev = msg->flags;
@@ -942,7 +942,7 @@ static size_t cont_print_text(char *text, size_t size)
        size_t len;
 
        if (cont.cons == 0 && (console_prev & LOG_NEWLINE)) {
-               textlen += print_time(cont.ts_nsec, text);
+               textlen += printk_print_time(cont.ts_nsec, text);
                size -= textlen;
        }
 
@@ -1192,9 +1192,14 @@ static struct cont {
 struct printk_log *printk_log_from_idx(u32 idx) { return NULL; }
 u32 printk_log_next(u32 idx) { return 0; }
 static void call_console_drivers(int level, const char *text, size_t len) {}
-static size_t msg_print_text(const struct printk_log *msg,
+size_t printk_print_time(u64 ts, char *buf) { return 0; }
+size_t printk_msg_print_text(const struct printk_log *msg,
                             enum printk_log_flags prev,
-                            bool syslog, char *buf, size_t size) { return 0; }
+                            bool syslog, char *buf, size_t size)
+{
+       return 0;
+}
+
 static size_t cont_print_text(char *text, size_t size) { return 0; }
 
 #endif /* CONFIG_PRINTK */
@@ -1557,8 +1562,8 @@ skip:
                }
 
                level = msg->level;
-               len = msg_print_text(msg, console_prev, false,
-                                    text, sizeof(text));
+               len = printk_msg_print_text(msg, console_prev, false,
+                                           text, sizeof(text));
                console_idx = printk_log_next(console_idx);
                console_seq++;
                console_prev = msg->flags;
@@ -2113,7 +2118,7 @@ bool kmsg_dump_get_line_nolock(struct kmsg_dumper *dumper, bool syslog,
                goto out;
 
        msg = printk_log_from_idx(dumper->cur_idx);
-       l = msg_print_text(msg, 0, syslog, line, size);
+       l = printk_msg_print_text(msg, 0, syslog, line, size);
 
        dumper->cur_idx = printk_log_next(dumper->cur_idx);
        dumper->cur_seq++;
@@ -2209,7 +2214,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
        while (seq < dumper->next_seq) {
                struct printk_log *msg = printk_log_from_idx(idx);
 
-               l += msg_print_text(msg, prev, true, NULL, 0);
+               l += printk_msg_print_text(msg, prev, true, NULL, 0);
                idx = printk_log_next(idx);
                seq++;
                prev = msg->flags;
@@ -2222,7 +2227,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
        while (l > size && seq < dumper->next_seq) {
                struct printk_log *msg = printk_log_from_idx(idx);
 
-               l -= msg_print_text(msg, prev, true, NULL, 0);
+               l -= printk_msg_print_text(msg, prev, true, NULL, 0);
                idx = printk_log_next(idx);
                seq++;
                prev = msg->flags;
@@ -2237,7 +2242,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog,
        while (seq < dumper->next_seq) {
                struct printk_log *msg = printk_log_from_idx(idx);
 
-               l += msg_print_text(msg, prev, syslog, buf + l, size - l);
+               l += printk_msg_print_text(msg, prev, syslog, buf + l, size - l);
                idx = printk_log_next(idx);
                seq++;
                prev = msg->flags;
index a7125d547c0391734fa3f40d75e1aecae45b1dc8..607529713cdeb7bd6b8a38ca1b524e697dc4d293 100644 (file)
@@ -115,5 +115,9 @@ void printk_log_store(int facility, int level,
                      enum printk_log_flags flags, u64 ts_nsec,
                      const char *dict, u16 dict_len,
                      const char *text, u16 text_len);
+size_t printk_print_time(u64 ts, char *buf);
+size_t printk_msg_print_text(const struct printk_log *msg,
+                            enum printk_log_flags prev,
+                            bool syslog, char *buf, size_t size);
 
 #endif