* Re: The CURRENT macro
2002-01-03 21:34 The CURRENT macro Michael Zhu
@ 2002-01-03 21:48 ` Jonathan Corbet
2002-01-03 21:55 ` Arnaldo Carvalho de Melo
2002-01-03 22:01 ` Richard B. Johnson
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Jonathan Corbet @ 2002-01-03 21:48 UTC (permalink / raw)
To: Michael Zhu; +Cc: linux-kernel
> In Alessandro Rubini's book Linux Device Driver(Second
> Edition), Chatper 12
Alessandro and...um...some other guy...:)
> 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?
A little grepping in the source would give you the answer there. It's in
.../include/linux/blk.h.
> 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.
CURRENT is one way. There's also functions like blkdev_entry_next_request
(also described in that chapter) that will pull a request off the queue for
you, if that's what you need.
Note that all this stuff has changed quite a bit in 2.5.
jon
Jonathan Corbet
Executive editor, LWN.net
corbet@lwn.net
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: The CURRENT macro
2002-01-03 21:48 ` Jonathan Corbet
@ 2002-01-03 21:55 ` Arnaldo Carvalho de Melo
2002-01-04 8:03 ` Terje Eggestad
0 siblings, 1 reply; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2002-01-03 21:55 UTC (permalink / raw)
To: Jonathan Corbet; +Cc: Michael Zhu, linux-kernel
Em Thu, Jan 03, 2002 at 02:48:39PM -0700, Jonathan Corbet escreveu:
> > In Alessandro Rubini's book Linux Device Driver(Second
> > Edition), Chatper 12
> Alessandro and...um...some other guy...:)
Yes, I know that other guy, very nice guy indeed 8)
> > 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?
> A little grepping in the source would give you the answer there. It's in
> .../include/linux/blk.h.
Or:
make tags
vi -t CURRENT
8)
- Arnaldo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: The CURRENT macro
2002-01-03 21:34 The CURRENT macro Michael Zhu
2002-01-03 21:48 ` Jonathan Corbet
@ 2002-01-03 22:01 ` Richard B. Johnson
2002-01-03 22:14 ` Peter Makholm
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Richard B. Johnson @ 2002-01-03 22:01 UTC (permalink / raw)
To: Michael Zhu; +Cc: linux-kernel
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.
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: The CURRENT macro
2002-01-03 21:34 The CURRENT macro Michael Zhu
2002-01-03 21:48 ` Jonathan Corbet
2002-01-03 22:01 ` Richard B. Johnson
@ 2002-01-03 22:14 ` Peter Makholm
2002-01-03 22:55 ` Tom Gall
2002-01-03 22:57 ` Tom Gall
4 siblings, 0 replies; 8+ messages in thread
From: Peter Makholm @ 2002-01-03 22:14 UTC (permalink / raw)
To: linux-kernel
mylinuxk@yahoo.ca (Michael Zhu) writes:
> blk_dev[MAJOR_NR].request_queue". I know CURRENT is
> just a macro. Where can I find the definition of this
> macro?
Seek, and ye shall find (Matt 7.7):
xyzzy% find -type f | xargs grep "#define CURRENT "
./include/linux/blk.h:#define CURRENT blkdev_entry_next_request(&blk_dev[MAJOR_NR].request_queue.queue_head)
xyzzy%
--
Når folk spørger mig, om jeg er nørd, bliver jeg altid ilde til mode
og svarer lidt undskyldende: "Nej, jeg bruger RedHat".
-- Allan Olesen på dk.edb.system.unix
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: The CURRENT macro
2002-01-03 21:34 The CURRENT macro Michael Zhu
` (2 preceding siblings ...)
2002-01-03 22:14 ` Peter Makholm
@ 2002-01-03 22:55 ` Tom Gall
2002-01-03 22:57 ` Tom Gall
4 siblings, 0 replies; 8+ messages in thread
From: Tom Gall @ 2002-01-03 22:55 UTC (permalink / raw)
To: Michael Zhu; +Cc: linux-kernel
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.
Look in include/asm-[your-arch]/current.h
It's architecture dependant. For instance on PPC64 we keep current in a
register.
Regards,
Tom
--
Tom Gall - [embedded] [PPC64 | PPC32] Code Monkey
Peace, Love & "Where's the ka-boom? There was
Linux Technology Center supposed to be an earth
http://www.ibm.com/linux/ltc/ shattering ka-boom!"
(w) tom_gall@vnet.ibm.com -- Marvin Martian
(w) 507-253-4558
(h) tgall@rochcivictheatre.org
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: The CURRENT macro
2002-01-03 21:34 The CURRENT macro Michael Zhu
` (3 preceding siblings ...)
2002-01-03 22:55 ` Tom Gall
@ 2002-01-03 22:57 ` Tom Gall
4 siblings, 0 replies; 8+ messages in thread
From: Tom Gall @ 2002-01-03 22:57 UTC (permalink / raw)
To: Michael Zhu; +Cc: linux-kernel
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.
Heh! Ignore that last one ...
Wrong current... you want CURRENT ... duh! look in include/linux/blk.h
grep is your friend.
Regards,
Tom
--
Tom Gall - [embedded] [PPC64 | PPC32] Code Monkey
Peace, Love & "Where's the ka-boom? There was
Linux Technology Center supposed to be an earth
http://www.ibm.com/linux/ltc/ shattering ka-boom!"
(w) tom_gall@vnet.ibm.com -- Marvin Martian
(w) 507-253-4558
(h) tgall@rochcivictheatre.org
^ permalink raw reply [flat|nested] 8+ messages in thread