>>> I am trying to write a 2.4 device driver but (basing it on the code in
>>> Linux Device Drivers by Mr Rubini) it complains about blk_dev[MAJOR]
>>> nor having a member named request_fn.
>>> I see from some of the kernel source code that there is a new style for
>>> request functions, something called make_request_fn. But I can't find
>>> any documentation on how to port it (or how to write 2.4 drivers from
>> The documentation IS the code. Look at examples of use in the other
>> drivers. Or just read the registration code itself. It should be plain
>> to you then.
> You're obviously a much more experienced Kernel hacker than I!! I can
> read C code well, but trying to pick up structures and function calls
> that are embedded in the Kernel (during odd moments in my day-job) is
> damn hard.
The function I think you are asking about is this one following, and it
seems perfectly documented in the code to me!
* blk_init_queue - prepare a request queue for use with a block device
* placed on the queue.
* If a block device wishes to use the standard request handling procedures,
* which sorts requests and coalesces adjacent requests, then it must
* are requests on the queue that need to be processed. If the device
* are available on the queue, but may be called at some time later instead.
* Plugged queues are generally unplugged when a buffer belonging to one
* of the requests on the queue is needed, or due to memory pressure.
* queue, but only as many as it can handle at a time. If it does leave
* requests on the queue, it is responsible for arranging that the requests
* get dealt with eventually.
* A global spin lock $io_request_lock must be held while manipulating the
* requests on the request queue.
* The request on the head of the queue is by default assumed to be
* potentially active, and it is not considered for re-ordering or merging
* whenever the given queue is unplugged. This behaviour can be changed with
* blk_init_queue() must be paired with a blk_cleanup-queue() call
* when the block device is deactivated (such as at module unload).
void blk_init_queue(request_queue_t * q, request_fn_proc * rfn)
It seems to me to be transparant! You should now go and search for the
type request_fn_proc to see what kind of thing you have to define, and
look at some examples in other drivers.
Quote:> Someone on IRC did point me to a good porting guide though:
I think I have seen this, but didn't find it useful ... it does
cover a question related to yours about block device registration,
however. The style of this document is 95% code and 5% commentary,
so I think the kernel code itself is more talkative.