I need to run some code on storage device mounting and unmounting. How can i listen for these events on linux?
You can use libudev or the more convenient, glib based gudev to monitor udev events in C.