LinuxQuestions.org
Visit Jeremy's Blog.
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 03-24-2012, 07:59 AM   #1
pegasus
LQ Newbie
 
Registered: Jan 2012
Posts: 2

Rep: Reputation: Disabled
generic_make_request - callback does not work


Hi all!

I have the next code of driver:
Code:
void my_end_request(struct bio* child, int error)
{
  my_private_t*    private = child->bi_private;
  complete((struct completion*)private->completion);
}

int my_submit_request
(
    my_handle_t*   handle,
    int             rw,
    int             mode, 
    struct bio*     bio,
    void*           user_private_data,
    bio_end_io_t*   user_callback
)
{
  struct bio*       child     = NULL;
  my_private_t*    private   = NULL;
  my_registry_t*   registry  = NULL;
  int               direction = -1;
  DECLARE_COMPLETION_ONSTACK(completion);

  registry = handle->registry;

  direction = bio_data_dir(bio);

  child = bio_clone(bio, GFP_NOIO);

  private = my_private_get(registry->my_cache_private); // here we get a structure, that contains some of our data
 
  child->bi_end_io = (bio_end_io_t*)my_end_request; // set the callback

  child->bi_bdev = handle->bdev; // reading will be doing from this device
  
  private->completion = &completion;

  private->parent = bio;
  private->user_private_data = user_private_data;
  private->user_callback = user_callback;
  private->mode = mode;
  private->handle = handle;
  child->bi_private = private;
 
  generic_make_request(child);
  wait_for_completion(&completion); // waiting to complete the reading
  
  // yet another code

}
I'm trying to redirect requests (only read) to another device. In a function my_submit_request I'm call the bio_clone and then generic_make_request.
And also I'm call wait_for_completion (& completion) for waiting for the reading. The callback function should work when the reading will be completed.
The problem is, no callback call, and wait_for_completion does not return control.
 
  


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
Quick help with c++ callback gafferuk Programming 27 04-01-2009 08:26 PM
what are callback functions ? rbh123 Linux - Newbie 1 01-04-2007 11:14 AM
A problem about callback scanner Programming 6 07-05-2006 03:40 AM
Problem with Callback! Linuxnewbie Linux - Networking 1 02-24-2004 01:55 AM
ISDN + callback zeky Linux - General 0 12-25-2002 07:15 AM

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

All times are GMT -5. The time now is 09:30 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