cvs commit: src/sys/net if_llc.h

Warner Losh imp at FreeBSD.org
Fri Dec 1 09:50:12 PST 2006


imp         2006-12-01 17:50:11 UTC

  FreeBSD src repository

  Modified files:
    sys/net              if_llc.h 
  Log:
  Move the __packed declarations.  This makes sizeof(struct llc) 8 again
  on the arm.  Add an assert to ensure that the size is 8 to prefent others
  from falling into this trap (we should have more of these).
  
  Why the construct:
  
          struct foo {
                  union bar {
                          struct {
                                  ...
                          } __packed fred;
                          ...
                  } __packed wilma;
          } __packed;
  
  has a different packing than:
  
          struct foo {
                  union bar {
                          struct {
                                  ...
                          } fred __packed;
                          ...
                  } wilma __packed;
          } __packed;
  
  is beyond my ability to ferret out of the gcc documentation.  Most
  likely some subtle binding issue (eg before it says the struct itself
  is packed, while after it means that the whole struct is packed into
  the thing it is in).  Pointers to relevant documentation would be
  appreciated.
  
  Revision  Changes    Path
  1.13      +11 -7     src/sys/net/if_llc.h


More information about the cvs-src mailing list