Re: Reading page from given block device

From: Pavel Machek (pavel@ucw.cz)
Date: Thu May 09 2002 - 16:36:24 EST


Hi!

> > Well, I'm doing it during boot, and this is swap partition; it should
> > not have been accessed previously.
> >
> > > > bdev = bdget(kdev_t_to_nr(dev));
> > > > if (!bdev) {
> > > > printk("No block device for %s\n", __bdevname(dev));
> > > > BUG();
> > > > }
> > > > printk("C");
>
> blkdev_open(bdev, FMODE_READ, O_RDONLY, BDEV_RAW)

blkdev_open is

fs.h:extern int blkdev_open(struct inode *, struct file *);

... I can't see how to use it in this context.

> > > > if (!bh || (!bh->b_data)) {
> > > > return -1;
>
> However, I would really suggest to open the bugger once, do all IO and
> then close it. See how raw.c and friends deal with these problems.

Performance should not matter here.
                                                                Pavel

-- 
Casualities in World Trade Center: ~3k dead inside the building,
cryptography in U.S.A. and free speech in Czech Republic.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue May 14 2002 - 12:00:12 EST