The reuse of code is divided into static reuse and dynamic reuse. Static Reuse:Adopt a standardCprogram, put the code that will be reused in other files, and if you want to use some of the appropriate features,includeThe corresponding header file can be. Dynamic Reuse:Is aLinuxThe driver can use a differentLinuxresources in the drive. There is another way to share code:, module dependencies, also known as export symbols. The exported symbols (constants, variables, functions, etc.) are used in one drive module in another. Compilation is made up of multiple filesLinuxDrive, ifLinuxThe driver code is not much, you can put all the code in a file, ifLinuxdriver code is more complex, it is necessary to use multiple source code files to hold different function code, which facilitates the classification and management of code. IfLinuxdriver to use the original code of a third party, then you have to compile multiple source code files, and eventually generate. Kofiles or compiled intoLinuxkernel. Forced uninstallation is required in some casesLinuxDrive: 1, becauseLinuxThe initialization function of the driver module crashes for some operation, which causes the initialization function to fail back properly. 2, in useRmmodwhen the command unloads the drive, the system invokes the Unload function, and only if the Unload function returns successfully.Linuxthe driver will be uninstalled if the Unload function is blocked,Rmmodcommand will also be blocked, unable to perform to uninstallLinuxthe code for the drive module. The root of this problem is the Unload function, so just replace the original unload function with an empty unload function.
http://www.cnblogs.com/sam0304/
Android Deep Explore reading notes eighth Chapter