All of lore.kernel.org
 help / color / mirror / Atom feed
* request_module with params
       [not found]             ` <CAOtcWM0HK3j+oPJdoPxMB38WGbsN_A3qVrPe7u6GNWhgE8sbdw@mail.gmail.com>
@ 2017-08-20  8:24               ` Okash Khawaja
  2017-08-21  7:21                 ` Cihangir Akturk
  0 siblings, 1 reply; 3+ messages in thread
From: Okash Khawaja @ 2017-08-20  8:24 UTC (permalink / raw)
  To: kernelnewbies

Hi,

Is there a way to load a kernel module from another module and pass
parameters to it? Something like

request_module("mymod param1=val1");

Thanks,
Okash
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170820/a9697adc/attachment.html 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* request_module with params
  2017-08-20  8:24               ` request_module with params Okash Khawaja
@ 2017-08-21  7:21                 ` Cihangir Akturk
  2017-08-21  7:38                   ` Okash Khawaja
  0 siblings, 1 reply; 3+ messages in thread
From: Cihangir Akturk @ 2017-08-21  7:21 UTC (permalink / raw)
  To: kernelnewbies

On Sun, Aug 20, 2017 at 09:24:09AM +0100, Okash Khawaja wrote:
> Hi,
> 
> Is there a way to load a kernel module from another module and pass
> parameters to it? Something like
> 
> request_module("mymod param1=val1");

I think this is exactly what you are looking for:

from include/linux/kmod.h
#define request_module(mod...) __request_module(true, mod)

and from kernel/kmod.c

/**
 * __request_module - try to load a kernel module
 * @wait: wait (or not) for the operation to complete
 * @fmt: printf style format string for the name of the module
 * @...: arguments as specified in the format string
 *
 * Load a module using the user mode module loader. The function returns
 * zero on success or a negative errno code or positive exit code from
 * "modprobe" on failure. Note that a successful module load does not mean
 * the module did not then unload and exit on an error of its own. Callers
 * must check that the service they requested is now available not blindly
 * invoke it.
 *
 * If module auto-loading support is disabled then this function
 * becomes a no-operation.
 */
int __request_module(bool wait, const char *fmt, ...)

In normal situtations, you just call exported functions from another
kernel module. Module order and dependencies between these modules are
handled by depmod at module installation time, as far as I know.

> 
> Thanks,
> Okash

> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 3+ messages in thread

* request_module with params
  2017-08-21  7:21                 ` Cihangir Akturk
@ 2017-08-21  7:38                   ` Okash Khawaja
  0 siblings, 0 replies; 3+ messages in thread
From: Okash Khawaja @ 2017-08-21  7:38 UTC (permalink / raw)
  To: kernelnewbies

Hi,

On 21 Aug 2017 8:21 am, "Cihangir Akturk" <cakturk@gmail.com> wrote:

On Sun, Aug 20, 2017 at 09:24:09AM +0100, Okash Khawaja wrote:
> Hi,
>
> Is there a way to load a kernel module from another module and pass
> parameters to it? Something like
>
> request_module("mymod param1=val1");

I think this is exactly what you are looking for:


This works fine when no parameters are supplied. But if I call it like
this:

request_module("mymod param1=val1");

It doesn't work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170821/498e4d9c/attachment.html 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-21  7:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAOtcWM0chtVrVuFQRg_Ms0Da51Gm87Uz6SyobWoh5x8CpiKM-w@mail.gmail.com>
     [not found] ` <CAOtcWM0FNWyosaxN4e-7rcjoJ=PNaaH3LPJyf6+89C3ig7kN2A@mail.gmail.com>
     [not found]   ` <CAOtcWM0ngZN3Y97xJvOXyWP=+LxdVof=PnaxP2F=2LweeKc8_A@mail.gmail.com>
     [not found]     ` <CAOtcWM1F_rM3yNKjvSJu4iwA732rJQXg2xLU1Wpq3sLmqmXhqQ@mail.gmail.com>
     [not found]       ` <CAOtcWM0WCwe+fxwvdyojQK2S_vq7Y7O3gm1L3eQcSNLB6F+7Ew@mail.gmail.com>
     [not found]         ` <CAOtcWM3x9ZP3ee04ad1_xpkbUS1n21dnbEkzsHUniRZJ_92ynQ@mail.gmail.com>
     [not found]           ` <CAOtcWM2XahvvN61HYvhuMn=BUQUGuK5YX54=0fa947es3NcCvQ@mail.gmail.com>
     [not found]             ` <CAOtcWM0HK3j+oPJdoPxMB38WGbsN_A3qVrPe7u6GNWhgE8sbdw@mail.gmail.com>
2017-08-20  8:24               ` request_module with params Okash Khawaja
2017-08-21  7:21                 ` Cihangir Akturk
2017-08-21  7:38                   ` Okash Khawaja

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.