There's struct request, which represents a request by the hard disk. The question is, how can I get info on whether the disk does a read or a write?
Your help will be much appreciated!
There's struct request, which represents a request by the hard disk. The question is, how can I get info on whether the disk does a read or a write?
Your help will be much appreciated!
As far as I know, there is no struct request in the C standard library. I am going to hazard a guess as to the context that you did not provide: *moved to Linux programming forum*
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Good call, laserlight.
The struct request defined in include/linux/blkdev.h file in the Linux kernel sources has a field unsigned int cmd_flags (line 102 or so). If (cmd_flags & REQ_WRITE) is true the request is a write request, otherwise it is a read request.
This is documented in the comments for the enum rq_flag_bits type in the include/linux/blk_types.h file (line 140 or so) in the kernel sources.
Thank you Nominal Animal, you have been most helpful!