Handle removable media USB/CD-ROM mount/umount events on Linux and Mac
I need to implement cross platform handler for the removable media mount/umount开发者_如何学JAVA events. It was not hard to implement it on Windows
, now I need to rinse and repeat on Mac
on Linux
. I suppose that these platforms handle the removable media in different manners. Which APIs should I look into?
On another note, about the APIs. MSDN is a pretty good resource for all Windows APIs for all the frameworks, thumbs up Microsoft. Are there similar resources for Mac and Linux development, where all the docs for all the APIs are consolidated and easy to search/navigate through?
Edit: For the Mac side of things there is DiskArbitration framework that seems to do the work.
On Linux you would write a udev rule to get notifications on such events. Here is specific info about udev rules and your scenario: http://reactivated.net/writing_udev_rules.html#external-run
The MSDN of Linux (or at least part of it) are the man pages. Here is an online copy: http://linux.die.net/man/
Start here: Writing udev rules
精彩评论