Re: what is the use of #ifndefs

2015-07-20 Thread Amit Pandey
Hi Ahmed, See the comments inline #ifndef _LINUX_LIST_H // If not defined _LINUX_LIST_H macro #define _LINUX_LIST_H // then define this macro #include "linuxlist.h" // and include linuxlist.h header file #endif // end of #ifndef Now say in a

Re: what is the use of #ifndefs

2015-07-20 Thread Raul Piper
This is to avoid multiple declarations.In header file you declare the variables and function names and these have to be declared just once otherwise you will get multiple declaration error. #ifndef avoids this error .By placing it at the top all the declaration is visited just once =>How?Since supp

Re: what is the use of #ifndefs

2015-07-20 Thread Navy
On Mon, Jul 20, 2015 at 12:03:07PM +0200, Ahmed Soliman wrote: > currently I started reading through the linux kernel and I started > reading liunx/include/linux/list.h> I understood some of the functions > but still I dont know what does these lines of code do > #ifndef _LINUX_LIST_H > #define _LI

Re: How to understand "processor" in "SMP" and "UP"?

2015-07-20 Thread Nan Xiao
Hi Rik, Thanks very much for your comments! Best Regards Nan Xiao On Tue, Jul 21, 2015 at 5:04 AM, Rik van Riel wrote: > On 07/19/2015 11:43 PM, Nan Xiao wrote: > > Hi all, > > > > Per my understanding, the "processor" in "SMP" and "UP" should be a > > "logic CPU", not a "physical CPU". > > I

Re: How to understand "processor" in "SMP" and "UP"?

2015-07-20 Thread Rik van Riel
On 07/19/2015 11:43 PM, Nan Xiao wrote: > Hi all, > > Per my understanding, the "processor" in "SMP" and "UP" should be a > "logic CPU", not a "physical CPU". > If the "physical CPU" contains 2 "cores", and every "core" contains 2 > "hardware threads", then the "processor" > should stands for "ha

Re: what is the use of #ifndefs

2015-07-20 Thread anish singh
On Mon, Jul 20, 2015 at 3:03 AM, Ahmed Soliman wrote: > currently I started reading through the linux kernel and I started > reading liunx/include/linux/list.h> I understood some of the functions > but still I dont know what does these lines of code do > #ifndef _LINUX_LIST_H > #define _LINUX_LIS

Re: what is the use of #ifndefs

2015-07-20 Thread Greg Freemyer
Ahmed, That's basic C syntax for 30 years both in and out of the kernel. If you include the same header file multiple times you can get errors about defining the same structures, constants, globals multiple times. So the first time it is included you want the header file to actually be included.

Re: what is the use of #ifndefs

2015-07-20 Thread Stephan Müller
The keyword is 'include guard' ~frukto Am 20.07.2015 um 17:55 schrieb leo kirotawa: > it means you don't want to redefine a .h file > > On Mon, Jul 20, 2015 at 7:03 AM, Ahmed Soliman > wrote: >> currently I started reading through the linux kernel and I started >> reading liunx/include/linux/l

Re: what is the use of #ifndefs

2015-07-20 Thread leo kirotawa
it means you don't want to redefine a .h file On Mon, Jul 20, 2015 at 7:03 AM, Ahmed Soliman wrote: > currently I started reading through the linux kernel and I started > reading liunx/include/linux/list.h> I understood some of the functions > but still I dont know what does these lines of code d

what is the use of #ifndefs

2015-07-20 Thread Ahmed Soliman
currently I started reading through the linux kernel and I started reading liunx/include/linux/list.h> I understood some of the functions but still I dont know what does these lines of code do #ifndef _LINUX_LIST_H #define _LINUX_LIST_H which exist at the very beginning of the file I also noticed t