LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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-03-2012, 05:04 PM   #1
pxhai
LQ Newbie
 
Registered: Feb 2008
Posts: 4

Rep: Reputation: 0
Get struct block_device from device name


Hi all,

I need help on how to get the information of a block device. If you are wondering, yes it's an assignment.

I have to implement a driver to wrap a block device and monitor its read/write activities. The problem is how to get device's info from just name, e.g "/dev/sda2"? This info is loaded when module is initialized, to later redirect data to the real device.

Thanks,
Pxh
 
Old 11-06-2012, 02:57 PM   #2
pxhai
LQ Newbie
 
Registered: Feb 2008
Posts: 4

Original Poster
Rep: Reputation: 0
I found some functions in "fs/block_dev.c" to get the pointer to a block device by name. Will report back after trying
 
Old 11-08-2012, 12:36 PM   #3
pxhai
LQ Newbie
 
Registered: Feb 2008
Posts: 4

Original Poster
Rep: Reputation: 0
call any of those function causes kernel panic. Not sure what goes wrong
 
  


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
[SOLVED] error: 'struct tty_struct' has no member named 'device' vlzj Programming 4 04-11-2012 08:58 PM
[SOLVED] Accesssing a block device within the kernel, Translating file* to block_device * tony.simple Linux - Kernel 1 03-01-2012 10:59 AM
Kernel API *get_super (struct block_device *bdev) producing error with Fedora Core 5 ankur0921 Programming 1 02-02-2011 05:24 AM
Kernel device Driver + Zone struct speedytangent Programming 0 10-16-2008 09:10 AM
How to get all block device's block_device pointer in kernel yinyang80 Linux - Kernel 0 12-16-2006 07:07 AM


All times are GMT -5. The time now is 08:45 AM.

Main Menu
Advertisement
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