Reading disks sectors
François
fser at code-libre.org
Tue Mar 29 08:39:34 EDT 2016
Hello,
I'm trying to read raw disks sectors using bio requests.
I found a sample in a stackoverflow answer which seems to do exactly
what I'm trying to : http://stackoverflow.com/a/17527300/51760
Reading this, a few questions came to me:
1/ The API is outdated, and bio struct no longer have bi_sector for instance.
Those fields are now in bvec_iter (see
http://lxr.free-electrons.com/source/include/linux/blk_types.h?v=3.19).
bio struct do have bi_iter field, so I was wondering wether it's safe
to populate the bi_iter directly ie:
- bio->bi_sector = sector;
+ bio->bi_iter.bi_sector = sector;
2/ There is a generic bi_endio function in bio.c.
What should readComplete implement? IMO it should just complete the
"event" (of type struct completion), and then I can just call the
bio_endio function provided by bio.c. Is that correct?
Thanks in advance!
---
François
More information about the Kernelnewbies
mailing list