|
Embedded Linux Primer: A Practical, Real-World ApproachOur goal here is to illustrate the mechanism, so don't be concerned if you don't understand the argument or its values. Listing 5-4 is a snippet of code from .../kernel/printk.c. The body of the function has been stripped because it is not relevant to the discussion. The most relevant part of Listing 5-4 is the last line, the invocation of the __setup macro. This macro expects two arguments; in this case, it is passed a string literal and a function pointer. It is no coincidence that the string literal passed to the __setup macro is the same as the first eight characters of the kernel command line related to the console: console=. Listing 5-4. Console Setup Code Snippet /* * Setup a list of consoles. Called from init/main.c */ static int __init console_setup(char *str) { Pchar name[sizeof(console_cmdline[0].name)]; Pchar*s, *options; Pint idx; P/* PP* Decode str into name, index, options. PP*/ Preturn 1; } __setup("console=", console_setup); You can think of this macro as a registration function for the kernel command-line console parameter ...» |
Код для вставки книги в блог HTML
phpBB
текст
|
|