Kernel API changes from 2.2 to 2.4

Richard Gooch



The 2.4 linux kernel promises to have many cleanups and new features added. Changes should include many improvements in speed, resource utilisation and scalability compared to 2.0. Some of these improvements will require changes to the kernel API (the programming interface to internal kernel services). If you maintain a 3rd party driver, filesystem or other kernel code, this document may provide a few quick tips to help port from kernel 2.2 to 2.4.

If you are still stuck in the dark ages of the 2.0 series kernels, then read the porting guide for changing from 2.0 to 2.2 kernels.

Changes to the Wait Queue System

A major cleanup of the wait queue implementation has required a change to the interface. Where before you used to declare a wait queue head thus:
static struct wait_queue *my_wait_queue = NULL;
you now do:
static DECLARE_WAIT_QUEUE_HEAD (my_wait_queue);
If you want to declare and initialise the wait queue head separately, you need to change code like:
    struct wait_queue *my_wait_queue;
    init_waitqueue (&my_wait_queue);
to this:
    wait_queue_head_t my_wait_queue;
    init_waitqueue_head (&my_wait_queue);
And where you used to declare the wait queue entry thus:
    struct wait_queue wait = {current, NULL};
you now do:
    DECLARE_WAITQUEUE (wait, current);

Original: 15-MAY-1999
Back to my Home Page
Richard Gooch (rgooch at atnf dot csiro dot au)