kernel module question

2006-07-04 Thread Michael Sternberg

Hi, I'm writing kernel module for 2.6 linux.

The purpose is to intercept all writes to disk devices and to notify user 
mode application about sector/length of write.


I want to change function pointers of request_fn and make_request_fn to my 
own routines.


The question is what is a difference between this two functions?

Sometimes I see device like sda which has both pointers and both functions 
get called upon I/O.


Sometimes I see only make_request_fn (for instance in LVM case).

Which function should I intercept?

I did it for make_request_fn and checked with application that writes to 
some sector on disk. But in kernel I got write to different location.


Make_request_fn gets bio as parameter so I got writes info from it, but 
request_fn gets only queue as parameter.


Thank you for help

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word unsubscribe in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]



Re: kernel module question

2006-07-04 Thread Gilad Ben-Yossef

Michael Sternberg wrote:

Hi, I'm writing kernel module for 2.6 linux.

The purpose is to intercept all writes to disk devices and to notify 
user mode application about sector/length of write.


I want to change function pointers of request_fn and make_request_fn to 
my own routines.


Sounds like a horrible and racy plan. I'm sure there's a far better way.


The question is what is a difference between this two functions?

I did it for make_request_fn and checked with application that writes to 
some sector on disk. But in kernel I got write to different location.


Make_request_fn gets bio as parameter so I got writes info from it, but 
request_fn gets only queue as parameter.


AFAIK, make_request_fn is the function that produces the request queue = it queues requests for a device. request_fn is 
the consumes the queue - it's the function where the driver reads the queue and handle the requests.


Gilad



--
Gilad Ben-Yossef [EMAIL PROTECTED]
Codefidence. A name you can trust(tm)
Web: http://codefidence.com  | SIP: [EMAIL PROTECTED]
IL: +972.3.7515563 ext. 201  | Fax:+972.3.7515503
US: +1.212.2026643 ext. 201  | Cel:   +972.52.8260388

The journey of a thousand miles begins with a single oy.

=
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word unsubscribe in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]