On Sat, 16 Feb 2008, Mark Pearson wrote:
> Hi,
>
> I'm looking to carry out a request on kernel-janitors, where a macro
> is to be created which will return the size of an array, expressed
> in number of elements.
there is no such outstanding request -- that macro already exists in
kernel.h. the outstanding work is to simply replace hardcoded
calculations of the array size with the proper macro invocation.
> (sizeof(array)/sizeof(array[0])
>
> This is called ARRAY_SIZE, and is currently defined in a couple of
> places throughout the code at the moment, including kernel.h.
the only relevant definition is in kernel.h. the only other places
you'll see a macro like that defined is in code that is not kernel
code, that is, boot code that is compiled outside of the kernel.
> As this change will affect a number of sub-modules (e.g.
> ./scripts/mod ./drivers/serial ./arch/mips ./include, etc.), I
> wanted to ask where general macro definition are made in the Linux
> environment.
again, that's in kernel.h, and that macro already exists, there is no
need to invent it again.
> Obviously, I can't use the ARRAY_SIZE definition in kernel.h, as it
> is protected by a #ifdef __KERNEL__ and most of the modules which
> are to be changed aren't kernel modules.
um ... what?
rday
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
Have classroom, will lecture.
http://crashcourse.ca Waterloo, Ontario, CANADA
========================================================================
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ