LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 04: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, 01: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, 11:36 AM   #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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:17 PM.

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
Open Source Consulting | Domain Registration