Re: Get USB Device Class Type and Mount point

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On Mon, 2012-02-13 at 07:02 -0800, Greg KH wrote:
> 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.
I am getting the device node from libudev and witht his devnode I would
be traversing the mnttab to get the actual mount path for this
device.struct mntent* has helped me lot here.
> > 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?
There isnt any special filesystem need for my app. I am planning to use
ecryptfs module (with its overlay capability) which is available today.
Or is there any other module i should look into for this?

> greg k-h

If I am using the monitor capabilities of libudev then I may need to
write a daemon process to run this in background. There is always a
chance that user with root access can kill this application. 

I read about call_usermodehelper_exec API which can launch a user
application from kernel mode which can prove useful. However still
writing a kernel module and making it compatible for each kerne is time

As everyone is saying, I will go with user mode app for this

Abhijit Pawar

Kernelnewbies mailing list

[Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Networking]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux