Re: Strange variable declarations in Kernel

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

 



Hi Adrian,


> > 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?
> 

I am using a tricore-gcc crosscompiler in Cygwin under Windows 2000
Professional:
gcc version 2.95.3 20010315 (release 2.4.0) 20030318 built for CYGWIN_NT-5.0

I asked one of our postdoctoral researchers (I am a student) about the error
message I get and he said to me, that ANSI C only permits bitfields which
max length is 32 bits. He also said, that the error message has perhaps
something with cygwin to do. 

Do you have any idea, how I could modify the code without breaking anything?

Regards, Paul

-- 
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner

--
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