Undefined function inserting new module in kernel linux

I'm working on a new system call for the kernel linux 2.6.32, with the aim to do a myOpen very close to the original open. I've modified the original struct file (linux/fs.h) with a new variable and i want to continue to use the original fileTable also with myOpen (I hope to add myOpen in the code of the original open, switching in my case with a simply flag).

To do this I compile my code in a module (module.ko) and load this dinamically on my kernel (the one with the fs.h modified).

Now the problem is that if I use some function relative to the file system (ex: get_unused_fd_flags(flags); fd_install(fd, f); etc etc), some variable are not found (i recive it like warning and also in the kernel terminal).

I think the problem is that I Try to use some kernel function, but I do the same with others like filp_open and I not recive error. How I can solve this?

Terminal:

make -C /lib/modules/2.6.32progb/build M=/home/mauro/Scrivania modules 
make[1]: ingresso nella directory "/home/mauro/Scrivania/linux-2.6.32.B" 
    Building modules, stage 2. 
    MODPOST 1 modules 
WARNING: "alloc_fd" [/home/mauro/Scrivania/moduloB.ko] undefined! 
make[1]: uscita dalla directory "/home/mauro/Scrivania/linux-2.6.32.B" 
[sudo] password for mauro: insmod: error inserting 'moduloB.ko': -1 Unknown symbol in module

alloc_fd is not exported to modules.

This is a hint by the kernel developers that they don't want to encourage module developers to call the function. Now, since the kernel is open-source, you can of course export the function anyway by simply modifying the kernel source to add: "EXPORT_SYMBOL(alloc_fd);" just after the function in fs/file.c

Some functions you're trying to use are already exported - hence you don't get a warning for them.

链接地址: http://www.djcxy.com/p/87888.html

上一篇: 在用户提供的时间每天在Linux内核模块中调度任务

下一篇: 未定义的函数在内核linux中插入新模块