Going from struct disk to a fh?

John Baldwin jhb at freebsd.org
Wed Apr 14 21:22:23 UTC 2010


On Wednesday 14 April 2010 9:08:50 am Sam Robb wrote:
> In the kernel, given a struct disk, is there a way to turn that into 
something that can be used to read/write from the disk? Or is my best bet in 
this situation to figure out the device path for the disk, and just use 
kern_open() to access it?

You can use dp->d_geom as the target of a bio via GEOM I think.  However, I 
don't have experience with sending bio's to a specific GEOM directly.  File 
systems usually use geom_vfs to feed requests from bread(), etc. to a mounted 
disk device using a devfs vnode for the associated disk device.

-- 
John Baldwin


More information about the freebsd-hackers mailing list