Copyright (c) 1983, 1991, 1993 The Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the fol...
NAMEintro - introduction to system kernel interfaces
DESCRIPTIONThis section contains information about the interfaces and subroutines in the kernel.
PROTOTYPES ANSI-C AND ALL THATYes please.
We would like all code to be fully prototyped.
If your code compiles cleanly with cc -Wall we would feel happy about it. It is important to understand that this is not a question of just shutting up cc it is a question about avoiding the things it complains about. To put it bluntly, do not hide the problem by casting and other obfuscating practices, solve the problem.
INDENTATION AND STYLEBelieve it or not, there actually exists a guide for indentation and style. It is not generally applied though.
We would appreciate if people would pay attention to it, and at least not violate it blatantly.
We do not mind it too badly if you have your own style, but please make sure we can read it too.
Please take time to read style(9) for more information.
NAMING THINGSSome general rules exist:
If a function is meant as a debugging aid in DDB, it should be enclosed
#ifdef DDB #endif /* DDB */
And the name of the procedure should start with the prefix DDB_ to clearly identify the procedure as a debugger routine.
SCOPE OF SYMBOLSIt is important to carefully consider the scope of symbols in the kernel. The default is to make everything static, unless some reason requires the opposite.
There are several reasons for this policy, the main one is that the kernel is one monolithic name-space, and pollution is not a good idea here either.
For device drivers and other modules that do not add new internal interfaces to the kernel, the entire source should be in one file if possible. That way all symbols can be made static.
If for some reason a module is split over multiple source files, then try to split the module along some major fault-line and consider using the number of global symbols as your guide. The fewer the better.