Before delving further, a quick re-look at some basics is a good idea. When programming with C, you should understand the following:
- Variables declared locally within a function are obviously local to it and only have scope within that function.
- Variables and functions prefixed with the static qualifier have scope only within the current "unit"; effectively, the file they have been declared within. This is good as it helps reduce namespace pollution. Static (and global) data variables retain their value within that function.
Prior to 2.6 Linux (that is, <= 2.4.x, ancient history now), kernel module static and global variables, as well as all functions, were automatically visible throughout the kernel. This was, in retrospect, obviously not a great idea. The decision was reversed from 2.5 (and thus 2.6 onward, modern Linux): all kernel module variables (static and global data) and functions...