I'm doing some fairly low level work with OCaml and need to get a list of all of the block-level files that exist on a given Linux machine. My current attempt involves running the following and then parsing based on sd*
from there.
Sys.readdir "/dev/";;
But I am wondering if there is an existing/better way to do this? Since block devices have a ton of different names I'll have to write a ton of regexp. Is there a way that would let me specify that I only want block device files?
Note: Unfortunately I am unable to use Jane Street Core, or any other libraries for this.