All of lore.kernel.org
 help / color / mirror / Atom feed
From: apawar.linux@gmail.com (Abhijit Pawar)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Get USB Device Class Type and Mount point
Date: Tue, 14 Feb 2012 17:08:00 +0530	[thread overview]
Message-ID: <1329219480.18211.8.camel@abhijit-linux.cybage.com> (raw)
In-Reply-To: <20120213150219.GA7328@kroah.com>

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
consuming.

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


Thanks,
Abhijit Pawar

      reply	other threads:[~2012-02-14 11:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-09  6:10 Get USB Device Class Type and Mount point Abhijit Pawar
2012-02-09  6:22 ` Abhijit Pawar
2012-02-09 12:23 ` Greg KH
2012-02-09 13:48   ` Abhijit Pawar
2012-02-09 14:47     ` Greg KH
2012-02-10 13:49       ` Abhijit Pawar
2012-02-10 14:12         ` Greg KH
2012-02-13 12:14       ` Abhijit Pawar
2012-02-13 12:21         ` Mandeep Sandhu
2012-02-13 12:31           ` Abhijit Pawar
2012-02-13 15:02         ` Greg KH
2012-02-14 11:38           ` Abhijit Pawar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1329219480.18211.8.camel@abhijit-linux.cybage.com \
    --to=apawar.linux@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.