Get device filesystem path from dev_t on macOS
问题 If I have a 32-bit integer BSD device number dev_t (e.g. 0x1000004) on macOS (Darwin), how can I get the corresponding filesystem path for this device (e.g. "/dev/disk1s4")? 回答1: You have to enumerate the mounted file systems and look for one who's device ID matches. You can use getfsstat() for the enumeration. That fills in struct statfs structures. Compare the field f_fsid.val[0] of each structure to the dev_t you're looking for. If they match, then that struct statfs is the one for the