From mboxrd@z Thu Jan 1 00:00:00 1970 From: fser@code-libre.org (=?UTF-8?B?RnJhbsOnb2lz?=) Date: Tue, 29 Mar 2016 14:39:34 +0200 Subject: Reading disks sectors Message-ID: To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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