KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How do I create my own bio request to read a sector from the disk drive ? I am trying the following but it freezes the system. static void read_bio() { struct bio *b; struct page *p; b = bio_alloc(GFP_KERNEL, 1); if (!b) { printk(KERN_INFO "bio allocation failed\n"); } bio_init(b); b->bi_sector = 10000; b->bi_bdev = bd; /* "/dev/sda1" */ b->bi_end_io = bio_end_clone; p = alloc_page(GFP_KERNEL); if (!p) { printk(KERN_INFO "page allocation failed\n"); } bio_add_page(b, p, PAGE_SIZE, 0); b->bi_private = p; bio_get(b); submit_bio(READ, b); printk(KERN_DEBUG "submit read request\n"); }
Tags (comma-separated)
Save Edits
Cancel