I haven't looked at how lilo does it from userland but if he's
writing a kernel driver I'd have thought the easiest way would be
int bmap(struct inode *inode, int block);
which takes an inode and the relative block number within the file
and returns the absolute block number of the block on the underlying
block device. It only works for "ordinary" filesystems that support
the VFS bmap method but that certainly covers things like ext2.
If you can assume that the block number of the block device is the
"physical" block you're after then you are home free. Otherwise (if
you're worried about bad block remapping, md, nbd or any other weird
block device) then you've got more to do.
--Malcolm
-- Malcolm Beattie <mbeattie@sable.ox.ac.uk> Unix Systems Programmer Oxford University Computing Services- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/