[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange variable declarations in Kernel
On Fri, Sep 02, 2005 at 05:25:06PM +0200, Paul Duplys wrote:
> Hi all,
>
> in the file "efi.h" located in /fs/partitions in the kernel tree I found
> this structure definition:
>
> 87. typedef struct _gpt_entry_attributes {
> 88. u64 required_to_function:1;
> 89. u64 reserved:47;
> 90. u64 type_guid_specific:16;
> 91. } __attribute__ ((packed)) gpt_entry_attributes;
>
>
> Unfortunatelly, my compiler (perhaps?) can't handle this:
>
> In file included from check.c:36:
> efi.h:91: Illegal bitfield width
> make[4]: *** [check.o] Error 1
>
> I've never seen a variable definition like this before (and google doesn't
> work...):
>
> required_to_function:1;
>
> What does the collon after the variable name mean? What does the number
> after the collon mean?
>
> In the same file there are few other typedefs of the same form and they use
> the datatype u64 (which is defined as unsigned long long in asm/types.h) and
> the attribute packed too. But with them there are no compile problems. So I
> guess, the problem is the collon and the number after the collon.
As your compiler is telling you they are bitfields.
What compiler are you using that has a problem with this code?
> Regards and thanks in advance,
> Paul
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/