Hi:
I want to load a module to access an extern variable (extern boolean_t
e1000g_force_detach) defined in e1000g_sw.h. And I have passed
compilation. But when I execute modload, the system exports :
undefined symbol
can't load module : Invalid argument
'e1000g_force_detach'
.....
Who could tell me why? and how to access kernel extern variable in my
self module? thank you for your help.
My modular code as following:
#include <sys/ddi.h>
#include <sys/conf.h>
#include <sys/dtrace.h>
#include <sys/kobj.h>
#include <sys/stat.h>
#include <sys/sunddi.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/modctl.h>
#include <sys/cmn_err.h>
#include <sys/errno.h>
extern int wenji_access[100];
/* Extern Variable about module-self */
extern struct mod_ops mod_miscops;
extern boolean_t e1000g_force_detach;
static struct modldrv modldrv = {
&mod_miscops,
"schrock module %I%",
NULL
};
static struct modlinkage modlinkage = {
MODREV_1, (void *)&modldrv, NULL
};
int
_init(void)
{
int count;
cmn_err(CE_WARN, "OpenSolaris has arrived the building");
if(e1000g_force_detach) cmn_err(CE_WARN, "e1000_force_detach on");
else cmn_err(CE_WARN, "e1000_force_detach off");
for(count=0; count<100;count++)
wenji_access[count] = -1; /* the variable recorded data packet
receiving path */
return(mod_install(&modlinkage));
}
int
_fini(void)
{
int count;
for(count=0; count<10;count++){
if(wenji_access[count] == -1)
cmn_err(CE_WARN,"Wenji_Probe [%d] : No access :
Value : %d \n",
count, wenji_access[count]);
else
cmn_err(CE_WARN,"Wenji_Probe [%d] : Accessed :
Value : %d \n",
count, wenji_access[count]);
drv_usecwait(5);
}
cmn_err(CE_WARN, "OpenSolaris has left the building");
return(mod_remove(&modlinkage));
}
int
_info(struct modinfo *modinfop)
{
return(mod_info(&modlinkage, modinfop));
}
_______________________________________________
driver-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/driver-discuss