I'm aware that it's possible to find the file system type (apfs, hfs, msdos etc.) and also the disks's mount path by disk's BSD name using the Disk Arbitration framework and also the POSIX statfs()
function.
However, I'm wondering if this information is also written somewhere in the IO Registry, so that I could extract it using only IOKit framework?
I've searched my own Mac's IO Registry but didn't find anything like that, but still suspect it's there.
Any ideas?
I/O Kit is not involved with mounted file systems: that happens at the BSD layer, so the only thing IOKit "sees" are the reads, writes, and ioctl
s to the device coming from the BSD subsystem and being converted into IOStorage method calls by the IOMediaBSDClient
. I/O Kit does not care what file system is issuing those IO operations.
However, it does have the concept of a "content hint" (kIOMediaContentHintKey
) property on an IOMedia
node. The content hint influences which file system(s) will attempt to mount the block device.
The content hint comes from the partitioning or volume management scheme: on GPT disks, the content hint will be the partition type GUID. Each file system implementation advertises the content hints it is looking for, and the OS (Disk Arbitration) runs the mount command for any file systems claiming to support the content hint of a newly appeared block device node.
Note that the content hint is only a hint:
IOStorage
node may be "open" or not, but any process can open a block device, it doesn't have to be a file system implementation in the kernel doing this.)So in short, no, the precisely equivalent mount point information from the BSD and Disk Arbitration subsystems does not exist in I/O Kit, although there is some information about file system types which the block device claims to contain.