diff options
| author | Joe Perches <joe@perches.com> | 2013-07-31 16:53:47 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-31 17:41:03 -0400 |
| commit | 62e32ac3505a0cab1c5ef8ea2c0eab3b26ed855f (patch) | |
| tree | 692752410a3027dd8602617589efbfa25eb50366 /kernel | |
| parent | 23475408c618ecd5b44b7e069fd65ec73d17d9f0 (diff) | |
printk: rename struct log to struct printk_log
Rename the struct to enable moving portions of
printk.c to separate files.
The rename changes output of /proc/vmcoreinfo.
Signed-off-by: Joe Perches <joe@perches.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/printk/printk.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 8f1fb50aa3ce..5b5a7080e2a5 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
| @@ -173,7 +173,7 @@ static int console_may_schedule; | |||
| 173 | * 67 "g" | 173 | * 67 "g" |
| 174 | * 0032 00 00 00 padding to next message header | 174 | * 0032 00 00 00 padding to next message header |
| 175 | * | 175 | * |
| 176 | * The 'struct log' buffer header must never be directly exported to | 176 | * The 'struct printk_log' buffer header must never be directly exported to |
| 177 | * userspace, it is a kernel-private implementation detail that might | 177 | * userspace, it is a kernel-private implementation detail that might |
| 178 | * need to be changed in the future, when the requirements change. | 178 | * need to be changed in the future, when the requirements change. |
| 179 | * | 179 | * |
| @@ -195,7 +195,7 @@ enum log_flags { | |||
| 195 | LOG_CONT = 8, /* text is a fragment of a continuation line */ | 195 | LOG_CONT = 8, /* text is a fragment of a continuation line */ |
| 196 | }; | 196 | }; |
| 197 | 197 | ||
| 198 | struct log { | 198 | struct printk_log { |
| 199 | u64 ts_nsec; /* timestamp in nanoseconds */ | 199 | u64 ts_nsec; /* timestamp in nanoseconds */ |
| 200 | u16 len; /* length of entire record */ | 200 | u16 len; /* length of entire record */ |
| 201 | u16 text_len; /* length of text buffer */ | 201 | u16 text_len; /* length of text buffer */ |
| @@ -243,7 +243,7 @@ static u32 clear_idx; | |||
| 243 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) | 243 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) |
| 244 | #define LOG_ALIGN 4 | 244 | #define LOG_ALIGN 4 |
| 245 | #else | 245 | #else |
| 246 | #define LOG_ALIGN __alignof__(struct log) | 246 | #define LOG_ALIGN __alignof__(struct printk_log) |
| 247 | #endif | 247 | #endif |
| 248 | #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) | 248 | #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) |
| 249 | static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); | 249 | static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); |
| @@ -254,35 +254,35 @@ static u32 log_buf_len = __LOG_BUF_LEN; | |||
| 254 | static volatile unsigned int logbuf_cpu = UINT_MAX; | 254 | static volatile unsigned int logbuf_cpu = UINT_MAX; |
| 255 | 255 | ||
| 256 | /* human readable text of the record */ | 256 | /* human readable text of the record */ |
| 257 | static char *log_text(const struct log *msg) | 257 | static char *log_text(const struct printk_log *msg) |
| 258 | { | 258 | { |
| 259 | return (char *)msg + sizeof(struct log); | 259 | return (char *)msg + sizeof(struct printk_log); |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | /* optional key/value pair dictionary attached to the record */ | 262 | /* optional key/value pair dictionary attached to the record */ |
| 263 | static char *log_dict(const struct log *msg) | 263 | static char *log_dict(const struct printk_log *msg) |
| 264 | { | 264 | { |
| 265 | return (char *)msg + sizeof(struct log) + msg->text_len; | 265 | return (char *)msg + sizeof(struct printk_log) + msg->text_len; |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | /* get record by index; idx must point to valid msg */ | 268 | /* get record by index; idx must point to valid msg */ |
| 269 | static struct log *log_from_idx(u32 idx) | 269 | static struct printk_log *log_from_idx(u32 idx) |
| 270 | { | 270 | { |
| 271 | struct log *msg = (struct log *)(log_buf + idx); | 271 | struct printk_log *msg = (struct printk_log *)(log_buf + idx); |
| 272 | 272 | ||
| 273 | /* | 273 | /* |
| 274 | * A length == 0 record is the end of buffer marker. Wrap around and | 274 | * A length == 0 record is the end of buffer marker. Wrap around and |
| 275 | * read the message at the start of the buffer. | 275 | * read the message at the start of the buffer. |
| 276 | */ | 276 | */ |
| 277 | if (!msg->len) | 277 | if (!msg->len) |
| 278 | return (struct log *)log_buf; | 278 | return (struct printk_log *)log_buf; |
| 279 | return msg; | 279 | return msg; |
| 280 | } | 280 | } |
| 281 | 281 | ||
| 282 | /* get next record; idx must point to valid msg */ | 282 | /* get next record; idx must point to valid msg */ |
| 283 | static u32 log_next(u32 idx) | 283 | static u32 log_next(u32 idx) |
| 284 | { | 284 | { |
| 285 | struct log *msg = (struct log *)(log_buf + idx); | 285 | struct printk_log *msg = (struct printk_log *)(log_buf + idx); |
| 286 | 286 | ||
| 287 | /* length == 0 indicates the end of the buffer; wrap */ | 287 | /* length == 0 indicates the end of the buffer; wrap */ |
| 288 | /* | 288 | /* |
| @@ -291,7 +291,7 @@ static u32 log_next(u32 idx) | |||
| 291 | * return the one after that. | 291 | * return the one after that. |
| 292 | */ | 292 | */ |
| 293 | if (!msg->len) { | 293 | if (!msg->len) { |
| 294 | msg = (struct log *)log_buf; | 294 | msg = (struct printk_log *)log_buf; |
| 295 | return msg->len; | 295 | return msg->len; |
| 296 | } | 296 | } |
| 297 | return idx + msg->len; | 297 | return idx + msg->len; |
| @@ -303,11 +303,11 @@ static void log_store(int facility, int level, | |||
| 303 | const char *dict, u16 dict_len, | 303 | const char *dict, u16 dict_len, |
| 304 | const char *text, u16 text_len) | 304 | const char *text, u16 text_len) |
| 305 | { | 305 | { |
| 306 | struct log *msg; | 306 | struct printk_log *msg; |
| 307 | u32 size, pad_len; | 307 | u32 size, pad_len; |
| 308 | 308 | ||
| 309 | /* number of '\0' padding bytes to next message */ | 309 | /* number of '\0' padding bytes to next message */ |
| 310 | size = sizeof(struct log) + text_len + dict_len; | 310 | size = sizeof(struct printk_log) + text_len + dict_len; |
| 311 | pad_len = (-size) & (LOG_ALIGN - 1); | 311 | pad_len = (-size) & (LOG_ALIGN - 1); |
| 312 | size += pad_len; | 312 | size += pad_len; |
| 313 | 313 | ||
| @@ -319,7 +319,7 @@ static void log_store(int facility, int level, | |||
| 319 | else | 319 | else |
| 320 | free = log_first_idx - log_next_idx; | 320 | free = log_first_idx - log_next_idx; |
| 321 | 321 | ||
| 322 | if (free > size + sizeof(struct log)) | 322 | if (free > size + sizeof(struct printk_log)) |
| 323 | break; | 323 | break; |
| 324 | 324 | ||
| 325 | /* drop old messages until we have enough contiuous space */ | 325 | /* drop old messages until we have enough contiuous space */ |
| @@ -327,18 +327,18 @@ static void log_store(int facility, int level, | |||
| 327 | log_first_seq++; | 327 | log_first_seq++; |
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | if (log_next_idx + size + sizeof(struct log) >= log_buf_len) { | 330 | if (log_next_idx + size + sizeof(struct printk_log) >= log_buf_len) { |
| 331 | /* | 331 | /* |
| 332 | * This message + an additional empty header does not fit | 332 | * This message + an additional empty header does not fit |
| 333 | * at the end of the buffer. Add an empty header with len == 0 | 333 | * at the end of the buffer. Add an empty header with len == 0 |
| 334 | * to signify a wrap around. | 334 | * to signify a wrap around. |
| 335 | */ | 335 | */ |
| 336 | memset(log_buf + log_next_idx, 0, sizeof(struct log)); | 336 | memset(log_buf + log_next_idx, 0, sizeof(struct printk_log)); |
| 337 | log_next_idx = 0; | 337 | log_next_idx = 0; |
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | /* fill message */ | 340 | /* fill message */ |
| 341 | msg = (struct log *)(log_buf + log_next_idx); | 341 | msg = (struct printk_log *)(log_buf + log_next_idx); |
| 342 | memcpy(log_text(msg), text, text_len); | 342 | memcpy(log_text(msg), text, text_len); |
| 343 | msg->text_len = text_len; | 343 | msg->text_len = text_len; |
| 344 | memcpy(log_dict(msg), dict, dict_len); | 344 | memcpy(log_dict(msg), dict, dict_len); |
| @@ -351,7 +351,7 @@ static void log_store(int facility, int level, | |||
| 351 | else | 351 | else |
| 352 | msg->ts_nsec = local_clock(); | 352 | msg->ts_nsec = local_clock(); |
| 353 | memset(log_dict(msg) + dict_len, 0, pad_len); | 353 | memset(log_dict(msg) + dict_len, 0, pad_len); |
| 354 | msg->len = sizeof(struct log) + text_len + dict_len + pad_len; | 354 | msg->len = sizeof(struct printk_log) + text_len + dict_len + pad_len; |
| 355 | 355 | ||
| 356 | /* insert message */ | 356 | /* insert message */ |
| 357 | log_next_idx += msg->len; | 357 | log_next_idx += msg->len; |
| @@ -474,7 +474,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf, | |||
| 474 | size_t count, loff_t *ppos) | 474 | size_t count, loff_t *ppos) |
| 475 | { | 475 | { |
| 476 | struct devkmsg_user *user = file->private_data; | 476 | struct devkmsg_user *user = file->private_data; |
| 477 | struct log *msg; | 477 | struct printk_log *msg; |
| 478 | u64 ts_usec; | 478 | u64 ts_usec; |
| 479 | size_t i; | 479 | size_t i; |
| 480 | char cont = '-'; | 480 | char cont = '-'; |
| @@ -719,14 +719,14 @@ void log_buf_kexec_setup(void) | |||
| 719 | VMCOREINFO_SYMBOL(log_first_idx); | 719 | VMCOREINFO_SYMBOL(log_first_idx); |
| 720 | VMCOREINFO_SYMBOL(log_next_idx); | 720 | VMCOREINFO_SYMBOL(log_next_idx); |
| 721 | /* | 721 | /* |
| 722 | * Export struct log size and field offsets. User space tools can | 722 | * Export struct printk_log size and field offsets. User space tools can |
| 723 | * parse it and detect any changes to structure down the line. | 723 | * parse it and detect any changes to structure down the line. |
| 724 | */ | 724 | */ |
| 725 | VMCOREINFO_STRUCT_SIZE(log); | 725 | VMCOREINFO_STRUCT_SIZE(printk_log); |
| 726 | VMCOREINFO_OFFSET(log, ts_nsec); | 726 | VMCOREINFO_OFFSET(printk_log, ts_nsec); |
| 727 | VMCOREINFO_OFFSET(log, len); | 727 | VMCOREINFO_OFFSET(printk_log, len); |
| 728 | VMCOREINFO_OFFSET(log, text_len); | 728 | VMCOREINFO_OFFSET(printk_log, text_len); |
| 729 | VMCOREINFO_OFFSET(log, dict_len); | 729 | VMCOREINFO_OFFSET(printk_log, dict_len); |
| 730 | } | 730 | } |
| 731 | #endif | 731 | #endif |
| 732 | 732 | ||
| @@ -879,7 +879,7 @@ static size_t print_time(u64 ts, char *buf) | |||
| 879 | (unsigned long)ts, rem_nsec / 1000); | 879 | (unsigned long)ts, rem_nsec / 1000); |
| 880 | } | 880 | } |
| 881 | 881 | ||
| 882 | static size_t print_prefix(const struct log *msg, bool syslog, char *buf) | 882 | static size_t print_prefix(const struct printk_log *msg, bool syslog, char *buf) |
| 883 | { | 883 | { |
| 884 | size_t len = 0; | 884 | size_t len = 0; |
| 885 | unsigned int prefix = (msg->facility << 3) | msg->level; | 885 | unsigned int prefix = (msg->facility << 3) | msg->level; |
| @@ -902,7 +902,7 @@ static size_t print_prefix(const struct log *msg, bool syslog, char *buf) | |||
| 902 | return len; | 902 | return len; |
| 903 | } | 903 | } |
| 904 | 904 | ||
| 905 | static size_t msg_print_text(const struct log *msg, enum log_flags prev, | 905 | static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev, |
| 906 | bool syslog, char *buf, size_t size) | 906 | bool syslog, char *buf, size_t size) |
| 907 | { | 907 | { |
| 908 | const char *text = log_text(msg); | 908 | const char *text = log_text(msg); |
| @@ -964,7 +964,7 @@ static size_t msg_print_text(const struct log *msg, enum log_flags prev, | |||
| 964 | static int syslog_print(char __user *buf, int size) | 964 | static int syslog_print(char __user *buf, int size) |
| 965 | { | 965 | { |
| 966 | char *text; | 966 | char *text; |
| 967 | struct log *msg; | 967 | struct printk_log *msg; |
| 968 | int len = 0; | 968 | int len = 0; |
| 969 | 969 | ||
| 970 | text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL); | 970 | text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL); |
| @@ -1055,7 +1055,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear) | |||
| 1055 | idx = clear_idx; | 1055 | idx = clear_idx; |
| 1056 | prev = 0; | 1056 | prev = 0; |
| 1057 | while (seq < log_next_seq) { | 1057 | while (seq < log_next_seq) { |
| 1058 | struct log *msg = log_from_idx(idx); | 1058 | struct printk_log *msg = log_from_idx(idx); |
| 1059 | 1059 | ||
| 1060 | len += msg_print_text(msg, prev, true, NULL, 0); | 1060 | len += msg_print_text(msg, prev, true, NULL, 0); |
| 1061 | prev = msg->flags; | 1061 | prev = msg->flags; |
| @@ -1068,7 +1068,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear) | |||
| 1068 | idx = clear_idx; | 1068 | idx = clear_idx; |
| 1069 | prev = 0; | 1069 | prev = 0; |
| 1070 | while (len > size && seq < log_next_seq) { | 1070 | while (len > size && seq < log_next_seq) { |
| 1071 | struct log *msg = log_from_idx(idx); | 1071 | struct printk_log *msg = log_from_idx(idx); |
| 1072 | 1072 | ||
| 1073 | len -= msg_print_text(msg, prev, true, NULL, 0); | 1073 | len -= msg_print_text(msg, prev, true, NULL, 0); |
| 1074 | prev = msg->flags; | 1074 | prev = msg->flags; |
| @@ -1082,7 +1082,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear) | |||
| 1082 | len = 0; | 1082 | len = 0; |
| 1083 | prev = 0; | 1083 | prev = 0; |
| 1084 | while (len >= 0 && seq < next_seq) { | 1084 | while (len >= 0 && seq < next_seq) { |
| 1085 | struct log *msg = log_from_idx(idx); | 1085 | struct printk_log *msg = log_from_idx(idx); |
| 1086 | int textlen; | 1086 | int textlen; |
| 1087 | 1087 | ||
| 1088 | textlen = msg_print_text(msg, prev, true, text, | 1088 | textlen = msg_print_text(msg, prev, true, text, |
| @@ -1228,7 +1228,7 @@ int do_syslog(int type, char __user *buf, int len, bool from_file) | |||
| 1228 | 1228 | ||
| 1229 | error = 0; | 1229 | error = 0; |
| 1230 | while (seq < log_next_seq) { | 1230 | while (seq < log_next_seq) { |
| 1231 | struct log *msg = log_from_idx(idx); | 1231 | struct printk_log *msg = log_from_idx(idx); |
| 1232 | 1232 | ||
| 1233 | error += msg_print_text(msg, prev, true, NULL, 0); | 1233 | error += msg_print_text(msg, prev, true, NULL, 0); |
| 1234 | idx = log_next(idx); | 1234 | idx = log_next(idx); |
| @@ -1714,10 +1714,10 @@ static struct cont { | |||
| 1714 | u8 level; | 1714 | u8 level; |
| 1715 | bool flushed:1; | 1715 | bool flushed:1; |
| 1716 | } cont; | 1716 | } cont; |
| 1717 | static struct log *log_from_idx(u32 idx) { return NULL; } | 1717 | static struct printk_log *log_from_idx(u32 idx) { return NULL; } |
| 1718 | static u32 log_next(u32 idx) { return 0; } | 1718 | static u32 log_next(u32 idx) { return 0; } |
| 1719 | static void call_console_drivers(int level, const char *text, size_t len) {} | 1719 | static void call_console_drivers(int level, const char *text, size_t len) {} |
| 1720 | static size_t msg_print_text(const struct log *msg, enum log_flags prev, | 1720 | static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev, |
| 1721 | bool syslog, char *buf, size_t size) { return 0; } | 1721 | bool syslog, char *buf, size_t size) { return 0; } |
| 1722 | static size_t cont_print_text(char *text, size_t size) { return 0; } | 1722 | static size_t cont_print_text(char *text, size_t size) { return 0; } |
| 1723 | 1723 | ||
| @@ -2029,7 +2029,7 @@ void console_unlock(void) | |||
| 2029 | console_cont_flush(text, sizeof(text)); | 2029 | console_cont_flush(text, sizeof(text)); |
| 2030 | again: | 2030 | again: |
| 2031 | for (;;) { | 2031 | for (;;) { |
| 2032 | struct log *msg; | 2032 | struct printk_log *msg; |
| 2033 | size_t len; | 2033 | size_t len; |
| 2034 | int level; | 2034 | int level; |
| 2035 | 2035 | ||
| @@ -2645,7 +2645,7 @@ void kmsg_dump(enum kmsg_dump_reason reason) | |||
| 2645 | bool kmsg_dump_get_line_nolock(struct kmsg_dumper *dumper, bool syslog, | 2645 | bool kmsg_dump_get_line_nolock(struct kmsg_dumper *dumper, bool syslog, |
| 2646 | char *line, size_t size, size_t *len) | 2646 | char *line, size_t size, size_t *len) |
| 2647 | { | 2647 | { |
| 2648 | struct log *msg; | 2648 | struct printk_log *msg; |
| 2649 | size_t l = 0; | 2649 | size_t l = 0; |
| 2650 | bool ret = false; | 2650 | bool ret = false; |
| 2651 | 2651 | ||
| @@ -2757,7 +2757,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, | |||
| 2757 | idx = dumper->cur_idx; | 2757 | idx = dumper->cur_idx; |
| 2758 | prev = 0; | 2758 | prev = 0; |
| 2759 | while (seq < dumper->next_seq) { | 2759 | while (seq < dumper->next_seq) { |
| 2760 | struct log *msg = log_from_idx(idx); | 2760 | struct printk_log *msg = log_from_idx(idx); |
| 2761 | 2761 | ||
| 2762 | l += msg_print_text(msg, prev, true, NULL, 0); | 2762 | l += msg_print_text(msg, prev, true, NULL, 0); |
| 2763 | idx = log_next(idx); | 2763 | idx = log_next(idx); |
| @@ -2770,7 +2770,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, | |||
| 2770 | idx = dumper->cur_idx; | 2770 | idx = dumper->cur_idx; |
| 2771 | prev = 0; | 2771 | prev = 0; |
| 2772 | while (l > size && seq < dumper->next_seq) { | 2772 | while (l > size && seq < dumper->next_seq) { |
| 2773 | struct log *msg = log_from_idx(idx); | 2773 | struct printk_log *msg = log_from_idx(idx); |
| 2774 | 2774 | ||
| 2775 | l -= msg_print_text(msg, prev, true, NULL, 0); | 2775 | l -= msg_print_text(msg, prev, true, NULL, 0); |
| 2776 | idx = log_next(idx); | 2776 | idx = log_next(idx); |
| @@ -2785,7 +2785,7 @@ bool kmsg_dump_get_buffer(struct kmsg_dumper *dumper, bool syslog, | |||
| 2785 | l = 0; | 2785 | l = 0; |
| 2786 | prev = 0; | 2786 | prev = 0; |
| 2787 | while (seq < dumper->next_seq) { | 2787 | while (seq < dumper->next_seq) { |
| 2788 | struct log *msg = log_from_idx(idx); | 2788 | struct printk_log *msg = log_from_idx(idx); |
| 2789 | 2789 | ||
| 2790 | l += msg_print_text(msg, prev, syslog, buf + l, size - l); | 2790 | l += msg_print_text(msg, prev, syslog, buf + l, size - l); |
| 2791 | idx = log_next(idx); | 2791 | idx = log_next(idx); |
