The PRINTK function is prototyped as follows:
asmlinkage int PRINTK (const char *FMT, ...)
The 1th parameter represents a format string, followed by a variable parameter. That is, once the PRINTK function has at least two parameters (the format string), if the format string is contained in the placeholder (%d,%s), it must be followed by a number of parameters such as placeholder typeface, so that one by one corresponds to the incoming PRINTK function.
Kern_debug Kren_warning is a two macro whose values are fly <7> and fly <4> respectively. In PRINTK
The number of the 1th parameter value (format string) preceded by an angle bracket (<...>) contains a number that represents the log level of the output.
Modify the P Rintk_demo driver code, define the Pr_debug macro by compiling the instructions, and modify the
The conditional value of the compilation directive to control whether the PRI NTK function is called
Linux file system, Proc is often used as the kernel space and user space for data intersection EE tools. /proc File system behaves like a device file system C/dev). /proc is a virtual file system, that is, Proc is not a real file system, but a memory map all read/write/proc L¥J operations are read and write to the memory, the read/write/proc file system is much faster than reading and writing to the dev file system. Therefore, the/proc file system can also act as a tool for Inux to interact with user-space programs.
Proc_mkdir
Name of the virtual directory.
The parent virtual directory parents Directory of Pro C_ gives the en-cho struct pointer. If the virtual directory is built directly in the/proc directory, the value of this parameter is NULL
Re e_p ro ntη
Name virtual file name
Access to the mode virtual file, equivalent to the access rights of the Linux file
Parent file proc _dir_ entry struct-body pointer. If you create a virtual machine directly under/Pro profile
File, the value of this parameter is NU LL
At E_p oc_ ad _e
Name of the virtual file.
MoD: Access to the virtual file, equivalent to the access rights of the Linux file
The ROC _dir_entry struct pointer to the parent directory of the base virtual file. If you create a virtual file directly under/proc,
The value of this parameter is NULL
Read_proc: A function pointer that handles read actions.
Data for the virtual file system (any type of pointer). This value is the last parameter value of the Pro _dir_entry.read_proc function. The equivalent of data that is permanently bound to a virtual file. Can be NULL if the data is not being set by the city
Remove_proc_entry
Name of the virtual file to delete.
The proc _dir_en struct body of parent virtual file is Zhao. If the virtual file is created directly under the/proc directory, the value of this parameter is NULL.
Android Deep Exploration (Volume I) tenth chapter