Unknown symbol in module but ...

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

 



Hello,

 I add new structures and functions to manipulate them in the linux kernel
2.6.5.  I added a new system call in order to test if I can manipulate the new
structures. Everything works fine. The new functions can be view via /proc
interface and with the sytem call I can manipulate structures useing a test
program running in user space. Now, I'd like to manipulate structures by using a
module and a new device. Thus I remove the implementation of the system call
that I replace by a very basic module that currently does the initialization.
Here is the code of the module:

===================================================
  /* module headers */
#include <linux/module.h>
#include <linux/config.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/elsa_acct.h>
#include <linux/elsa_bank.h>

 /********************************************
 * functions used to do enhanced accounting. *
 ********************************************/

void do_elsa_acct(int bid)
{
        struct elsa_acct_s *info;

        info = (struct elsa_acct_s *)elsa_bank_get_info(bid);

        if (info)
                info->eac_ptot++;
        else
                printk("do_elsa_acct error\n");
}

void free_elsa_info(int bid)
{
        struct elsa_acct_s *info;
   
        info = (struct elsa_acct_s *)elsa_bank_get_info(bid);

        /*
         * We put information in the log file. If the file isn't empty,
         * information in the file will be destroyed.
         */
        if (info) {
                kfree(info);
        } else {
                printk("free_elsa_info: ERROR, info == NULL\n");
        }
}

void hang_elsa_info(int bid)
{
        struct elsa_acct_s *info;

        info = (struct elsa_acct_s *)kmalloc(sizeof(struct elsa_acct_s),
                                             GFP_KERNEL);

        if (info) {
                printk("Bank #id%d created: info hung\n", bid);

                /* initialize fields */
                ELSA_FIELD_INIT(info);
                elsa_bank_set_info(bid, info);
        } else {
                printk("Bank #id%d created: info error\n", bid);
        }

}

static int __init elsa_acct_init(void)
{
        elsa_init_cb(&free_elsa_info, &do_elsa_acct);
        return 0;
}

#ifdef MODULE
static int __init elsacct_init(void) {
        printk(KERN_INFO "ELSA accounting started\n");
        return elsa_acct_init();
}

static void __exit elsacct_cleanup(void) {
        printk(KERN_INFO "ELSA accounting terminated\n");
}

module_init(elsacct_init);
module_exit(elsacct_cleanup);

MODULE_AUTHOR("Guillaume Thouvenin <guillaume.thouvenin@bull.net>");
MODULE_LICENSE("GPL");

#else
module_init(elsa_acct_init);
#endif /* !(MODULE) */
===================================================

I compile this module in the linux kernel tree (file is in kernel/ and I
modified kernel/Makefile by adding obj-m:elsa_acct.o). Everything works fine and
the result is in the file elsa_acct.ko

When I try to load it, I have the following errorinsmod: 
error inserting '/home/guill/build/k265-elsa/kernel/elsa_acct.ko': -1 Unknown
symbol in module:

And in the /proc/kallsyms I have:
guill@nuptse:~/projects/elsa/linux-2.6.5-elsa$ cat /proc/kallsyms | grep elsa
c01316f0 t elsa_bank_set_info
c013171f t elsa_bank_get_info
c013173d t elsa_init_cb
c0131750 t elsa_bank_add
c013189c t elsa_bank_clean
c01318f2 t elsa_bank_remove
c013196d t elsa_copy_parent_bank
c01319f5 t elsa_bank_remove_all
c0131a2f t elsa_get_bid
c0131ab9 t elsa_get_bank
c0131b09 t elsa_get_data
c0131b73 t elsa_bank_alloc
c0131c1c t elsa_bank_free
c0131cf5 t elsa_data_free
c0131fab t .text.lock.elsa_bank
c0131fc0 t do_elsa_acct
c0131feb t free_elsa_info
c013201a t hang_elsa_info

So, I don't understand why those symbols are not visible in my module???

Thank you very much for your help
Guillaume

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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