globals in modules

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

 



I am facing a problem

In my source file I have something like this when I insert the module I
see all the values printed as 0xFFFF but when I remove one element from
the structure lets say c then I get correct result. Or when I add one
element to the ctructure lets say d I get correct result. I mean when
the size of the structre becomes 4,8,,16 I get right results. Whats
wrong ??


typedef struct {
	unsigned int a;
	unsigned int b;
	unsigned int c;
	
}my_struct;
my_struct  my_array[4]; 

int __init init_module(void)
{
int i =0;
for ( i=0; i< 4; i++)
{
my_array [i].a = i;
my_array [i].b = i + 10;
my_array [i].c = i + 20;
}
for ( i=0; i< 4; i++)
{
printk(" a = 0x%x,b = 0x%x, c = 0x%x\n", my_array [i].a, my_array
[i].b,my_array [i].c); }
}

--
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