Get USB Device Class Type and Mount point

Greg KH greg at kroah.com
Mon Feb 13 10:02:19 EST 2012


On Mon, Feb 13, 2012 at 05:44:56PM +0530, Abhijit Pawar wrote:
> The  reason I went for kernel module is to get the device add
> notification. However once I get the notification, I can have
> netlink socket pass the device data to my user space application.

Like others pointed out, use libudev for this, that's the only way you
can properly do it.

> Here the tricky part is I can get the device info, but not able to
> figure out how can I get the mount path from this device.

Within the kernel you can not.  Think of namespaces, and all that fun
stuff, it will not work properly within the kernel.

Again, if you are using an encrypted filesystem, just use what Linux
provides for this today.  Is there something there that does not meet
your needs?

greg k-h



More information about the Kernelnewbies mailing list