getting a disk structure given a device name

Raviprakash Darbha rdarbha at juniper.net
Wed Jul 29 23:31:11 UTC 2015


Hello All 

I am trying to write a filter driver for the ata block on freebsd 6.2 to simulate failed reads and writes. For this i would like to know if there is a call to convert a given device path (ex /dev/ad0)  to a disk structure (adp->disk) which has the strategy function so that i could modify that and point it to my filter. 
There is a similar function in linux kernel blk_get_by_path and would like to know if there is something similar on freebsd too.
The other option is to write  a function to traverse through the list of devs and return the disk which has the disk->d_name as the given device path.This is a bit laborious but not sure if thats the only option. 

Any help is appreciated. 

Thanks
Ravi 
 


More information about the freebsd-hackers mailing list