printk.c (d197c43d04decb6b1298fa3ef26ea04a9ca7c977) | printk.c (bbeddf52adc1b4207674ab88686cbbe58c24f721) |
---|---|
1/* 2 * linux/kernel/printk.c 3 * 4 * Copyright (C) 1991, 1992 Linus Torvalds 5 * 6 * Modified to make sys_syslog() more flexible: added commands to 7 * return the last 4k of kernel messages, regardless of whether 8 * they've been read or not. Added option to suppress kernel printk's --- 38 unchanged lines hidden (view full) --- 47#include <linux/utsname.h> 48 49#include <asm/uaccess.h> 50 51#define CREATE_TRACE_POINTS 52#include <trace/events/printk.h> 53 54#include "console_cmdline.h" | 1/* 2 * linux/kernel/printk.c 3 * 4 * Copyright (C) 1991, 1992 Linus Torvalds 5 * 6 * Modified to make sys_syslog() more flexible: added commands to 7 * return the last 4k of kernel messages, regardless of whether 8 * they've been read or not. Added option to suppress kernel printk's --- 38 unchanged lines hidden (view full) --- 47#include <linux/utsname.h> 48 49#include <asm/uaccess.h> 50 51#define CREATE_TRACE_POINTS 52#include <trace/events/printk.h> 53 54#include "console_cmdline.h" |
55#include "braille.h" |
|
55 56/* printk's without a loglevel use this.. */ 57#define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL 58 59/* We show everything that is MORE important than this.. */ 60#define MINIMUM_CONSOLE_LOGLEVEL 1 /* Minimum loglevel we let people use */ 61#define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */ 62 --- 1701 unchanged lines hidden (view full) --- 1764 } 1765 if (i == MAX_CMDLINECONSOLES) 1766 return -E2BIG; 1767 if (!brl_options) 1768 selected_console = i; 1769 c = &console_cmdline[i]; 1770 strlcpy(c->name, name, sizeof(c->name)); 1771 c->options = options; | 56 57/* printk's without a loglevel use this.. */ 58#define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL 59 60/* We show everything that is MORE important than this.. */ 61#define MINIMUM_CONSOLE_LOGLEVEL 1 /* Minimum loglevel we let people use */ 62#define DEFAULT_CONSOLE_LOGLEVEL 7 /* anything MORE serious than KERN_DEBUG */ 63 --- 1701 unchanged lines hidden (view full) --- 1765 } 1766 if (i == MAX_CMDLINECONSOLES) 1767 return -E2BIG; 1768 if (!brl_options) 1769 selected_console = i; 1770 c = &console_cmdline[i]; 1771 strlcpy(c->name, name, sizeof(c->name)); 1772 c->options = options; |
1772#ifdef CONFIG_A11Y_BRAILLE_CONSOLE 1773 c->brl_options = brl_options; 1774#endif | 1773 braille_set_options(c, brl_options); 1774 |
1775 c->index = idx; 1776 return 0; 1777} 1778/* 1779 * Set up a list of consoles. Called from init/main.c 1780 */ 1781static int __init console_setup(char *str) 1782{ 1783 char buf[sizeof(console_cmdline[0].name) + 4]; /* 4 for index */ 1784 char *s, *options, *brl_options = NULL; 1785 int idx; 1786 | 1775 c->index = idx; 1776 return 0; 1777} 1778/* 1779 * Set up a list of consoles. Called from init/main.c 1780 */ 1781static int __init console_setup(char *str) 1782{ 1783 char buf[sizeof(console_cmdline[0].name) + 4]; /* 4 for index */ 1784 char *s, *options, *brl_options = NULL; 1785 int idx; 1786 |
1787#ifdef CONFIG_A11Y_BRAILLE_CONSOLE 1788 if (!memcmp(str, "brl,", 4)) { 1789 brl_options = ""; 1790 str += 4; 1791 } else if (!memcmp(str, "brl=", 4)) { 1792 brl_options = str + 4; 1793 str = strchr(brl_options, ','); 1794 if (!str) { 1795 printk(KERN_ERR "need port name after brl=\n"); 1796 return 1; 1797 } 1798 *(str++) = 0; 1799 } 1800#endif | 1787 if (_braille_console_setup(&str, &brl_options)) 1788 return 1; |
1801 1802 /* 1803 * Decode str into name, index, options. 1804 */ 1805 if (str[0] >= '0' && str[0] <= '9') { 1806 strcpy(buf, "ttyS"); 1807 strncpy(buf + 4, str, sizeof(buf) - 5); 1808 } else { --- 477 unchanged lines hidden (view full) --- 2286 i++) { 2287 if (strcmp(console_cmdline[i].name, newcon->name) != 0) 2288 continue; 2289 if (newcon->index >= 0 && 2290 newcon->index != console_cmdline[i].index) 2291 continue; 2292 if (newcon->index < 0) 2293 newcon->index = console_cmdline[i].index; | 1789 1790 /* 1791 * Decode str into name, index, options. 1792 */ 1793 if (str[0] >= '0' && str[0] <= '9') { 1794 strcpy(buf, "ttyS"); 1795 strncpy(buf + 4, str, sizeof(buf) - 5); 1796 } else { --- 477 unchanged lines hidden (view full) --- 2274 i++) { 2275 if (strcmp(console_cmdline[i].name, newcon->name) != 0) 2276 continue; 2277 if (newcon->index >= 0 && 2278 newcon->index != console_cmdline[i].index) 2279 continue; 2280 if (newcon->index < 0) 2281 newcon->index = console_cmdline[i].index; |
2294#ifdef CONFIG_A11Y_BRAILLE_CONSOLE 2295 if (console_cmdline[i].brl_options) { 2296 newcon->flags |= CON_BRL; 2297 braille_register_console(newcon, 2298 console_cmdline[i].index, 2299 console_cmdline[i].options, 2300 console_cmdline[i].brl_options); | 2282 2283 if (_braille_register_console(newcon, &console_cmdline[i])) |
2301 return; | 2284 return; |
2302 } 2303#endif | 2285 |
2304 if (newcon->setup && 2305 newcon->setup(newcon, console_cmdline[i].options) != 0) 2306 break; 2307 newcon->flags |= CON_ENABLED; 2308 newcon->index = console_cmdline[i].index; 2309 if (i == selected_console) { 2310 newcon->flags |= CON_CONSDEV; 2311 preferred_console = selected_console; --- 71 unchanged lines hidden (view full) --- 2383 newcon->name, newcon->index); 2384 } 2385} 2386EXPORT_SYMBOL(register_console); 2387 2388int unregister_console(struct console *console) 2389{ 2390 struct console *a, *b; | 2286 if (newcon->setup && 2287 newcon->setup(newcon, console_cmdline[i].options) != 0) 2288 break; 2289 newcon->flags |= CON_ENABLED; 2290 newcon->index = console_cmdline[i].index; 2291 if (i == selected_console) { 2292 newcon->flags |= CON_CONSDEV; 2293 preferred_console = selected_console; --- 71 unchanged lines hidden (view full) --- 2365 newcon->name, newcon->index); 2366 } 2367} 2368EXPORT_SYMBOL(register_console); 2369 2370int unregister_console(struct console *console) 2371{ 2372 struct console *a, *b; |
2391 int res = 1; | 2373 int res; |
2392 | 2374 |
2393#ifdef CONFIG_A11Y_BRAILLE_CONSOLE 2394 if (console->flags & CON_BRL) 2395 return braille_unregister_console(console); 2396#endif | 2375 res = _braille_unregister_console(console); 2376 if (res) 2377 return res; |
2397 | 2378 |
2379 res = 1; |
|
2398 console_lock(); 2399 if (console_drivers == console) { 2400 console_drivers=console->next; 2401 res = 0; 2402 } else if (console_drivers) { 2403 for (a=console_drivers->next, b=console_drivers ; 2404 a; b=a, a=b->next) { 2405 if (a == console) { --- 513 unchanged lines hidden --- | 2380 console_lock(); 2381 if (console_drivers == console) { 2382 console_drivers=console->next; 2383 res = 0; 2384 } else if (console_drivers) { 2385 for (a=console_drivers->next, b=console_drivers ; 2386 a; b=a, a=b->next) { 2387 if (a == console) { --- 513 unchanged lines hidden --- |