Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


LinkBack Search this Thread
Old 11-03-2012, 04:04 PM   #1
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.

Old 11-06-2012, 01:57 PM   #2
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, 11:36 AM   #3
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


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

All times are GMT -5. The time now is 11:31 PM.

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