* Regarding enumerating Block devices registered in kernel mode
@ 2013-11-12 5:24 vaibhav
2013-11-12 8:08 ` Richard Weinberger
0 siblings, 1 reply; 4+ messages in thread
From: vaibhav @ 2013-11-12 5:24 UTC (permalink / raw)
To: kernelnewbies
Hi Mentors,
I am working on a kernel module wherein I need to enumerate all the block
devices registered with the kernel. Also looking for notifications when a
block device gets added/remove. Google didn't help much and the thought of
reading the contents of /sys/block from kernel mode looks messy to me.
Looking for guidance on performing this enumeration.
Thanks,
VJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20131112/9ae06307/attachment.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Regarding enumerating Block devices registered in kernel mode
2013-11-12 5:24 Regarding enumerating Block devices registered in kernel mode vaibhav
@ 2013-11-12 8:08 ` Richard Weinberger
2013-11-12 8:47 ` vaibhav
0 siblings, 1 reply; 4+ messages in thread
From: Richard Weinberger @ 2013-11-12 8:08 UTC (permalink / raw)
To: kernelnewbies
On Tue, Nov 12, 2013 at 6:24 AM, vaibhav <vaibhav92@hotmail.com> wrote:
> I am working on a kernel module wherein I need to enumerate all the block
> devices registered with the kernel. Also looking for notifications when a
> block device gets added/remove. Google didn?t help much and the thought of
> reading the contents of /sys/block from kernel mode looks messy to me.
> Looking for guidance on performing this enumeration.
Why do you need this within the kernel?
Sounds much like a userspace job done in kernel land...
--
Thanks,
//richard
^ permalink raw reply [flat|nested] 4+ messages in thread
* Regarding enumerating Block devices registered in kernel mode
2013-11-12 8:08 ` Richard Weinberger
@ 2013-11-12 8:47 ` vaibhav
2013-11-12 8:50 ` Richard Weinberger
0 siblings, 1 reply; 4+ messages in thread
From: vaibhav @ 2013-11-12 8:47 UTC (permalink / raw)
To: kernelnewbies
Thanks for replying Richard,
I need to access the blockdevice structure associated with each block device
so that I can patch its block_device_operations to receive ioctls calls in
my code. In my code I check for ioctls that I handle and pass it to the
original ioctl handler if the ioctl is not understood by me.
I intend to patch these block_device structures during my module
initialization hence I need to iterate all BD's available in the system at
that point. Also need to keep track of new BD's appearing in the system so
that I can patch them as soon as they are available.
Thanks Again,
VJ
-----Original Message-----
From: Richard Weinberger [mailto:richard.weinberger at gmail.com]
Sent: Tuesday, November 12, 2013 1:39 PM
To: vaibhav
Cc: kernelnewbies
Subject: Re: Regarding enumerating Block devices registered in kernel mode
On Tue, Nov 12, 2013 at 6:24 AM, vaibhav <vaibhav92@hotmail.com> wrote:
> I am working on a kernel module wherein I need to enumerate all the
> block devices registered with the kernel. Also looking for
> notifications when a block device gets added/remove. Google didn't
> help much and the thought of reading the contents of /sys/block from
kernel mode looks messy to me.
> Looking for guidance on performing this enumeration.
Why do you need this within the kernel?
Sounds much like a userspace job done in kernel land...
--
Thanks,
//richard
^ permalink raw reply [flat|nested] 4+ messages in thread
* Regarding enumerating Block devices registered in kernel mode
2013-11-12 8:47 ` vaibhav
@ 2013-11-12 8:50 ` Richard Weinberger
0 siblings, 0 replies; 4+ messages in thread
From: Richard Weinberger @ 2013-11-12 8:50 UTC (permalink / raw)
To: kernelnewbies
Am 12.11.2013 09:47, schrieb vaibhav:
> Thanks for replying Richard,
>
> I need to access the blockdevice structure associated with each block device
> so that I can patch its block_device_operations to receive ioctls calls in
> my code. In my code I check for ioctls that I handle and pass it to the
> original ioctl handler if the ioctl is not understood by me.
>
> I intend to patch these block_device structures during my module
> initialization hence I need to iterate all BD's available in the system at
> that point. Also need to keep track of new BD's appearing in the system so
> that I can patch them as soon as they are available.
Please don't do that.
Such patching/hooking/etc...-games are doomed to failure.
Thanks,
//richard
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-11-12 8:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-12 5:24 Regarding enumerating Block devices registered in kernel mode vaibhav
2013-11-12 8:08 ` Richard Weinberger
2013-11-12 8:47 ` vaibhav
2013-11-12 8:50 ` Richard Weinberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).