Re: Loading symbol at startup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mar 24, 2008, at 3:32 PM, Carlo Bertoldi wrote:

Ok, I did that way because rummaging in kernel sources I found a file (drivers/mtd/devices/docprobe.c, kernel version 2.6.18) with those instructions. So here what I'm doing right now in the second module:

extern void write_seq_to_store(void);
[..]
init function
{
void (*my_write) (void) = NULL;

if ( request_module("modulo_seq") < 0) {
	printk(KERN_INFO "Unable to load module modulo_seq\n");
	return -1;
}
my_write = symbol_request(write_seq_to_store);

write_seq_to_store it's implemented by modulo_seq.
You also will need to ensure that the module doing the exporting is loaded successfully before you try to use the function and that it's not used again after unloading it.
Yes. So now my problem is: where do I place the above code in the kernel, such that it's executed early in the boot process?

I'm afraid I don't understand. Why do you need it to load "early"?

It shouldn't need to load before you intend to call the function the first time. As long as that's not at tasklet or interrupt context you can put the code above before you call my_write() the first time.

Is there some reason it needs to happen before that?

-Mike


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux