Re: kernel headers & userspace

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

 



Selon Guillaume Thouvenin <guillaume.thouvenin@polymtl.ca>:

> > ---- NEW HEADER FILE ----
> > #ifndef __LINUX_ELSA_H
> > #define __LINUX_ELSA_H
> > 
> > struct bank_root_s;
> > enum elsa_opcode {BANK_INIT,BANK_ALLOC,BANK_FREE,BANK_ADD,BANK_REMOVE};
> > 
> > /* 
> >  * sys_elsa() interface. 
> >  *
> >  * int sys_elsa(int opcode, unsigned int arg0,
> >  *              unsigned int arg1, unsigned int arg2)
> >  */
> > 
> > #ifdef __KERNEL__
> > 
> > Now, I can compile the test program. Therefore, my question is :
> > Is it a correct solution 
> 
> There is a problem with this solution because the can declare the structure 
> bank_root_s in the user program but the compiler will not know the size of
> the structure as the type is incomplete....

In fact, I think the problem is that a user MUST NOT interact directly with 
kernel structure. So, struct bank_root_s shouldn't be visible from userland.

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