The CURRENT macro
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
______________________________________________________
Send your holiday cheer with http://greetings.yahoo.ca
Quoted 2 lines
In Alessandro Rubini's book Linux Device Driver(Second Edition), Chatper 12
Alessandro and...um...some other guy...:)
Quoted 6 lines
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.
Quoted 4 lines
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
[email protected]
Quoted 12 lines · Michael Zhu
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 therequest_queue(a request_queue_t struct). CURRENT points to which field in the blk_dev[MAJOR_NR].request_queue? Thank you very much.
Quoted 1 line
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.
Quoted 12 lines · Michael Zhu
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 therequest_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
Signature · 7 lines
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) [email protected] -- Marvin Martian (w) 507-253-4558 (h) [email protected]
Quoted 12 lines · Michael Zhu
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 therequest_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
Signature · 7 lines
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) [email protected] -- Marvin Martian (w) 507-253-4558 (h) [email protected]
Quoted 3 lines · [email protected] (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%
Signature · 3 lines
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.unixEm Thu, Jan 03, 2002 at 02:48:39PM -0700, Jonathan Corbet escreveu:
Quoted 4 lines
Quoted 2 lines
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)
Quoted 9 lines
Quoted 6 lines
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
Quoted 9 lines · Arnaldo Carvalho de Melo
Quoted 3 lines
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
Or
make TAGS
emacs
then in emacs: M-.
In either case make sure you do a make xconfig or another config to make sure tags are correct for your platform.
Quoted 8 lines
8)
- Arnaldo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
TJ