in my study and examine linux kernel code I encountered with function make_request_fn. in this link it says that this function type definition is in include/linux/blkdev.h, line 211 :

typedef void (make_request_fn) (struct request_queue *q, struct bio *bio);

but did not mention where is its implementation as source code in a .c file. my question is where is this function source code?

typedef void (make_request_fn) (struct request_queue *q, struct bio *bio);

This is not a function declaration. It is definition of function type. Later in the same file include/linux/blkdev.h, line 299, the same name gets the field in request_queue structure.

And in file drivers/md/bcache/request.c on line 1140, there is assigned function flash_dev_make_request to this field, which makes you think that you call function make_request_fn(), but you really call flash_dev_make_request().

It is really basic way of providing Encapsulation and Polymorphism and really basic OOP model in C.

| improve this answer | |

It seems like different kernel versions have different function layout. I am working on Linux Kernel 4.9. make_request_fn is initialized by blk_queue_make_request() function in blk-core.c.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.