Writing Device Drivers

.c Files

A .c file for a device driver contains the data declarations and the code for the entry points of the driver. It contains the #include statements the driver needs, declares extern references, declares local data, sets up the cb_ops and dev_ops structures, declares and initializes the module configuration section (the modlinkage(9S) and modldrv(9S) structures), makes any other necessary declarations, and defines the driver entry points.