In C, you would use opendir
to traverse the directories, and stat
to examine the file details. The stat
call will give (amongst other things) the device id st_rdev
, and you can extract the device numbers from this using the major
macros which are found in 'sys/sysmacros.h' (which is included by 'sys/types.h').