I'm struggling to understand how to use in the proper way the
try_module_get()
I found this interesting post: How to put a check in the code to ensure the inter kernel module dependency - Linux Kernel?
But I miss one point: I can get the request_module
working, but I don' get how to use the try_module_get
I explain:
If I use
ret = request_module("ipt_conntrack")
the module xt_conntrack is correctly inserted, but marked as no used, because accordingly to the above post I didn't used the try_module_get
.
But how can I call the try_module_get
? The function requires a struct module
parameter, which I don't know how to populate for the xt_conntrack module. I found several examples, but all related to the "THIS_MODULE" parameter, which does not apply in this case.
Can you point me in the right direction for this?
Thanks for your help
symbol_request()
andsymbol_put()
? However, the "xt_conntrack" module doesn't export any symbols, so maybe not.try_module_get
depends on what actually you want to do with the requested module (ipt_conntrack
). Many use cases callstry_module_get
automatically. Note also, thatrequest_module
way is used only in a very specific cases. So, make sure that you actually need to use this approach.