If you followed last issue’s
“Gearheads” column, all of your block and character devices should be running
under Linux 2.2, albeit possibly with warnings about obsolete PCI interfaces. In
this article, I will finish up with some of the smaller changes that may catch a
driver author, cover networking, and then look at the new PCI layer.
If you followed last issue’s “Gearheads” column, all of your block and character devices should be running under Linux 2.2, albeit possibly with warnings about obsolete PCI interfaces. In this article, I will finish up with some of the smaller changes that may catch a driver author, cover networking, and then look at the new PCI layer.
Figure 1
if(skb->protocol == htons(ETH_P_MYPROTO)) { /* The card requires we mask the addresses for this */ u8 v; skb = skb_cow(skb, 0); if(skb==NULL) return 1; /* Whoops no memory */ skb->data[4]&=0×7F; skb->data[5]&=0×7F; }
I’ll start with the small stuff, since that is nice and easy. The first of these is signal handling. Linux 2.2 has more signals as well as POSIX real-time signal queues. This fact changes the driver code to determine whether a process has received a signal.
In Linux 2.0, drivers check for signals directly. This is done with code such as:
which ensures that pressing Ctrl-C on the terminal will return the EINTR error code from the device driver function.
Linux 2.2 replaces this with a function which hides the implementation of signals, which also means that we can avoid changing drivers again in the future. The above code now becomes:
if(signal_pending(current)) return -EINTR;
which is much cleaner.
The second, related issue is…
Please log in to view this content.
Not Yet a Member?
Register with LinuxMagazine.com and get free access to the entire archive, including: