Other Changes

There are a few other differences between 2.0 and 2.1.43. They don’t deserve special treatment in my opinion, so I’ll summarize them quickly.

The proc_register_dynamic function disappeared in 2.1.29. Recent kernels use the proc_register interface for every /proc file; if the low_ino field in struct proc_dir_entry is 0, then a dynamic inode number is assigned. The header sysdep-2.1.h defines proc_register_dynamic as proc_register when compiling for 2.1.29 or newer; this works as long as the proc_dir_entry structure being registered features 0 as the inode number.

In the field of network interface drivers, the rebuild_header device method has a new prototype from 2.1.15 onwards. You won’t be concerned with this difference as long as you develop Ethernet drivers, as Ethernet drivers don’t implement their own method; they fall back on the general-purpose Ethernet implementation. The sysdep-2.1 header defines the macro __USE_OLD_REBUILD_HEADER__ when the old implementation is needed. The sample module snull shows how to use the macro, but it’s not worth showing here.

Another change in network code affects struct enet_statistics, which doesn’t exist any more since 2.1.25. There is a new structure, struct net_device_stats, in its place, which is declared in <linux/netdevice.h> instead of <linux/if_ether.h>. The new structure is just like the old one, with the addition of two fields to store byte counters: unsigned long rx_bytes, tx_bytes;. A full-featured network interface ...

Get Linux Device Drivers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.