LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-07-2012, 06:06 AM   #1
linux_ques
LQ Newbie
 
Registered: May 2012
Posts: 3

Rep: Reputation: Disabled
Trap block level read and write request for disk


hi,

I want to develop a kernel module that can trap all the read/write requests coming for the disk.
How can i trap the read/write command issued by filesystem driver
to disk driver.
any pointers/suggestions.

thanks for help.
 
Old 05-17-2012, 12:34 AM   #2
linux_ques
LQ Newbie
 
Registered: May 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Trap block level read and write request for disk

I have found this driver on sourceforge.org

static int __init init_module( void )
{
//----------//
dev[0] = (dev_t)open_by_devnum (MKDEV(HOST_DISK_MAJOR_NUM,HOST_DISK_MINOR_NUM), FMODE_READ|FMODE_WRITE); // It is trying to open the Host disk
blk_queue_make_request (Queue, make_request);
blk_queue_hardsect_size(Queue, hardsect_size);
//register the function for I/O request handling
//-------------------
}

But when i perform I/O's on the disk it doesnt show me read and write request funtion being called.

Is there any way to access the I/O request queue for hard disk.

Please verify my understanding or provide some pointer to sample code doing the same.

thanks in advance
 
Old 05-17-2012, 12:44 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 18,235

Rep: Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710Reputation: 2710
Have you considered systemtap http://www.linuxtopia.org/online_boo...stemtap_guide/
 
  


Reply

Tags
module block level access


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
mount: block device is write-protected, mounting read-only xpucto Linux - Server 10 02-01-2017 02:16 AM
read/write in block device driver zali Programming 4 05-05-2012 03:14 AM
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
Raid disk problem : Attempt to read block from filesystem resulted in short read ElmPie Linux - General 5 08-26-2008 05:21 AM
remount USB Disk Read Write poetfreak MEPIS 1 08-30-2006 01:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:17 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
Open Source Consulting | Domain Registration