Re: structure definition in a .c file rather than .h file

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

 



On Thu, Mar 12, 2009 at 2:06 PM, Sukanto Ghosh
<sukanto.cse.iitb@xxxxxxxxx> wrote:
> Hi,
>
> The complete definition of structure cfs_rq is in a .c file
> (kernel/sched.c). In the head linux/sched.h it has been declared as
> "struct cfs_rq;"
> What is the purpose of doing so ?

With this declaration in linux/sched.h you can make pointers of the
structure anywhere. All pointers have the same size thus it just
doesn't matter if you don't know the details of the structure.

The idea of not exposing the structure is just encapsulation. It means
you shouldn't be touching those fields outside kernel/sched.c unless
you use one of the provided API functions to do so (if any).

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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