Re: The CURRENT macro

Richard B. Johnson
2002-01-03T22:01:32Z

On Thu, 3 Jan 2002, Michael Zhu wrote:

> In Alessandro Rubini's book Linux Device Driver(Second
> Edition), Chatper 12, he said that "By accessing the
> fields in the request structure, usually by way of
> CURRENT" and "CURRENT is just a pointer into
> blk_dev[MAJOR_NR].request_queue". I know CURRENT is
> just a macro. Where can I find the definition of this
> macro?
> I just don't know how to get the struct request from
> the request_queue(a request_queue_t struct). CURRENT
> points to which field in the
> blk_dev[MAJOR_NR].request_queue? Thank you very much.
>
> Michael

If symlinks are set up:

/usr/include/linux/blk.h

#ifndef _BLK_H
#define _BLK_H

[SNIPPED...]

#ifndef CURRENT
#define CURRENT blkdev_entry_next_request(&blk_dev[MAJOR_NR].request_queue.queue_head)
#endif

#endif /* _BLK_H */

Otherwise:

../linux-n.n.n/include/linux/blk.h

FYI. To find things in the future, do:
cd /usr/include/linux
grep WHAT_TO_FIND *.h | more
cd ../asm
grep WHAT_TO_FIND *.h | more

Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (797.90 BogoMips).

I was going to compile a list of innovations that could be
attributed to Microsoft. Once I realized that Ctrl-Alt-Del
was handled in the BIOS, I found that there aren't any.