|
|
Subscribe / Log in / New account

Some API changes for 2.6.14

From what has been merged as of this writing, it appears that the 2.6.14 kernel will have few API changes which will break code. The changes which have been merged are mostly additions to the kernel API. Here is a quick discussion of a few of them.

Some previously-discussed additions have finally made it to the mainline. One of those is kzalloc(), which allocates pre-zeroed memory. The two new variants of schedule_timeout() (which perform the setting of the task state) have also been merged.

Speaking of task states, there is now a TASK_NONINTERACTIVE flag which is used to mark non-interactive sleeps. It should be set alongside TASK_INTERRUPTIBLE or TASK_UNINTERRUPTIBLE in cases where the fact that a process is sleeping does not provide any information on whether it is interactive or not. Its initial use is for processes waiting on pipe buffers; the idea is to keep batch tasks using pipes (such as kernel compiles) from looking more interactive than they are.

Ingo Molnar's spinlock consolidation patch has gone in. This change should not affect much outside of the spinlock implementation, but it effects some major cleanups inside. There have been a number of simplifications and enhancements applied to the spinlock debugging code in particular.

On the networking side, there is a new function for allocating sk_buff structures:

    struct sk_buff *alloc_skb_fclone(unsigned int size, 
                                     unsigned int priority);

This function is meant to be used for SKBs which are expected to be cloned over their life cycle. It actually allocates a pair of sk_buff structures, with the idea that the second can be used at skb_clone() time without having to perform another memory allocation. Some reference count tricks are used to know when the whole assembly can be freed.

The net_device structure has long contained a get_wireless_stats() method, used by wireless network drivers. A previous update of the wireless extensions API moved that method over to the iw_handler_def structure, but still continued to use the older form when present. Wireless extensions 19 maintains that compatibility a little longer, but now issues a warning when a driver uses the older API.

The block layer API has seen some enhancements. There is a pair of new functions for creating I/O requests out of kernel buffers:

    struct bio *bio_map_kern(request_queue_t *q, void *data, unsigned int len,
                             unsigned int gfp_mask);
    struct request *blk_rq_map_kern(request_queue_t *q, int rw, void *kbuf,
                                    unsigned int len, unsigned int gfp_mask)

The first will create a BIO structure out of the given kernel buffer (which should not be space obtained with vmalloc()). The second takes the additional step of queueing the request onto the given request queue.

There is also a new blk_rq_map_user_iov() which is intended to work with the sg_iovec structures used in the SCSI layer.

As of this writing, the discussion of removing devfs has started up again. That may not happen for 2.6.14, but it would be surprising, at this point, if the devfs API lasted into 2.6.15.


to post comments

Some API changes for 2.6.14

Posted Sep 22, 2005 21:26 UTC (Thu) by xorbe (guest, #3165) [Link] (1 responses)

> One of those is kzalloc(), which allocates pre-zeroed memory.

What happened to calloc()?

Some API changes for 2.6.14

Posted Sep 24, 2005 22:33 UTC (Sat) by zblaxell (subscriber, #26385) [Link]

calloc lacks a gfp_flags parameter.


Copyright © 2005, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds