LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 11-26-2012, 07:22 AM   #1
karanb
LQ Newbie
 
Registered: Nov 2012
Posts: 3

Rep: Reputation: Disabled
How to get block device add/remove notification in kernel space ?


I had a block device driver working fine on Ubuntu 10.04 ( kernel version 2.6.32) . It used to hook into uevent_ops to get the device add/remove notification in init_module.
i.e.

my_uevent_ops = kset->uevent_ops;

kset->uevent_ops = my_uevent_ops_callback;

Now I want to port that driver to Ubuntu 12.04 (kernel 3.2.0-32-generic-pae) ,but the kset->uevent_ops is made constant, so it can't hook into it.
Is their any way to get add/remove event notifications of block devices in my device driver?
Also can I use notifier chain for block devices ?

Thanks in advance.
 
Old 11-28-2012, 11:03 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 1,548

Rep: Reputation: 377Reputation: 377Reputation: 377Reputation: 377
It would be kind of roundabout, but you could add a udev entry that calls a program to notify your kernel module when a new /sys/block entry is added.

I think USB uses notifier chains because there are many different types of USB devices. I don't think the SCSI device drivers have those. It would work if you only cared about USB drives.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Driver - how to read/write a block or character device in kernel space (procfs) stybi Linux - Kernel 1 01-27-2011 06:26 AM
Add/Remove Software App no longer display icon in notification area Borax_Man Fedora 1 10-29-2009 01:16 AM
user-space notification of USB device attached/detached rhardy Linux - Newbie 1 10-25-2006 08:31 AM
user-space notification of USB device attached/detached rhardy Linux - Software 1 10-24-2006 03:17 PM
callback or notification from kernel to user space yhus Programming 5 09-18-2005 09:41 PM


All times are GMT -5. The time now is 11:49 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration