Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - how to call a function from a LSM module of io-pkt(.so), the function is defined/implemented in another LSM module io-pkt.: (5 Items)
   
how to call a function from a LSM module of io-pkt(.so), the function is defined/implemented in another LSM module io-pkt.  
Hi,

How to i call a function from a io-pkt LSM module (.so), which is defined/implemented in another io-pkt  LSM module (.
so).  
There are two io-pkt LSM modules, lets say lsm-module1.so and lsm-module2.so.  The function1() is defined/implemented in

 lsm-module1.so. I want to call function1() from lsm-module2.so. The lsm-module1.so is mounted to io-pkt first and lsm-
module2.so is mouted later.
when i do mount of lsm-module2.so, I see error like "unresolved symbol function1()". Please let me know that how to fix 

the issue.
Thanks for the help.

./Prakash
Re: how to call a function from a LSM module of io-pkt(.so), the function is defined/implemented in another LSM module io-pkt.  
Apart from changing the design to remove the dependency or making both lsms into one, or changing the mount order, there
 are some other options.

It sounds like you have LD_BIND_NOW in effect, if you can make it lazy binding of symbols then that will defer 
resolution of the name to the point of use. If it is actually being called before being loaded then you could make it a 
function pointer that points to an empty function in the first lsm and the second lsm changes the pointer to point to 
the real function.
Re: how to call a function from a LSM module of io-pkt(.so), the function is defined/implemented in another LSM module io-pkt.  
Hello Nick,

Thanks for the response. I will check it.

./Prakash
Re: how to call a function from a LSM module of io-pkt(.so), the function is defined/implemented in another LSM module io-pkt.  
Hi Nick

The following are the steps, which i run on the two ".so" modules.
1. Function_1() is defined/coded in lsm-module-1.so.
2. I did load the lsm-module-1.so using command i.e mount -Tio-pkt /tmp/lsm-module-1.so. This is success as i see logs/
prints in this module.
3. i have another module i.e lsm-module-2.so. i am calling the above function ie Function_1() in one of the ".c" file of
 lsm-module-2.so. I did load using command i.e mount -Tio-pkt /tmp/lsm-module-2.so . I see the  errors lile "unresolved 
symbol i.e Function_1(). 
4. please let me know that whether the function call is valid or invalid. 

Thanks for the help.

./Prakash
Re: how to call a function from a LSM module of io-pkt(.so), the function is defined/implemented in another LSM module io-pkt.  
Check the symbol type with nm, it may be local (t) rather than global (T) and hence inaccessible to other modules.