Re: Minor patch for 2.0.27

Jon Lewis (jlewis@inorganic5.fdt.net)
Thu, 19 Dec 1996 00:27:44 -0500 (EST)


On Wed, 18 Dec 1996, Jan Kasprzak wrote:

> I've noticed a bug in 2.0.27's README: The README says that
> you need gcc 2.6.3 or newer. In fact, 2.0.27 does not compile
> with 2.6.3 w/o modifications: It doesn't understand pentium
> optimizations (-malign-*=2) and the compilation fails in include/fddidevice.h
> on "__attribute__ ((packed))". The most simple fix is attached.

Upgrading gcc wasn't a welcome option for me...at least at the time...so I
opted to alter the source. Not being a C or kernel guru, I have no idea if
this patch breaks fddi...I just know it lets me compile...and since I don't
have fddi, it doesn't matter a whole lot to me. I am curious though.

I basically looked at other kernel header files and tried to make this one
more similar to them. With this, I can make a usable 2.0.27 using gcc 2.6.3.

What does __attribute__((packed)) mean anyway?

diff --exclude *.orig --exclude *.rej -ruN linux-2.0.25-clean/include/linux/if_fddi.h linux-2.0.25/include/linux/if_fddi.h
--- linux-2.0.25-clean/include/linux/if_fddi.h Fri Nov 8 15:11:54 1996
+++ linux-2.0.25/include/linux/if_fddi.h Fri Nov 8 16:08:01 1996
@@ -63,44 +63,44 @@
/* Define 802.2 Type 1 header */
struct fddi_8022_1_hdr
{
- __u8 dsap; /* destination service access point */
- __u8 ssap; /* source service access point */
- __u8 ctrl; /* control byte #1 */
- } __attribute__ ((packed));
+ __u8 dsap __attribute__((packed)); /* destination service access point */
+ __u8 ssap __attribute__((packed)); /* source service access point */
+ __u8 ctrl __attribute__((packed)); /* control byte #1 */
+ };

/* Define 802.2 Type 2 header */
struct fddi_8022_2_hdr
{
- __u8 dsap; /* destination service access point */
- __u8 ssap; /* source service access point */
- __u8 ctrl_1; /* control byte #1 */
- __u8 ctrl_2; /* control byte #2 */
- } __attribute__ ((packed));
+ __u8 dsap __attribute__((packed)); /* destination service access point */
+ __u8 ssap __attribute__((packed)); /* source service access point */
+ __u8 ctrl_1 __attribute__((packed)); /* control byte #1 */
+ __u8 ctrl_2 __attribute__((packed)); /* control byte #2 */
+ };

/* Define 802.2 SNAP header */
#define FDDI_K_OUI_LEN 3
struct fddi_snap_hdr
{
- __u8 dsap; /* always 0xAA */
- __u8 ssap; /* always 0xAA */
- __u8 ctrl; /* always 0x03 */
- __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */
- __u16 ethertype; /* packet type ID field */
- } __attribute__ ((packed));
+ __u8 dsap __attribute__((packed)); /* always 0xAA */
+ __u8 ssap __attribute__((packed)); /* always 0xAA */
+ __u8 ctrl __attribute__((packed)); /* always 0x03 */
+ __u8 oui[FDDI_K_OUI_LEN] __attribute__((packed)); /* organizational universal id */
+ __u16 ethertype __attribute__((packed)); /* packet type ID field */
+ };

/* Define FDDI LLC frame header */
struct fddihdr
{
- __u8 fc; /* frame control */
- __u8 daddr[FDDI_K_ALEN]; /* destination address */
- __u8 saddr[FDDI_K_ALEN]; /* source address */
+ __u8 fc __attribute__((packed)); /* frame control */
+ __u8 daddr[FDDI_K_ALEN] __attribute__((packed)); /* destination address */
+ __u8 saddr[FDDI_K_ALEN] __attribute__((packed)); /* source address */
union
{
- struct fddi_8022_1_hdr llc_8022_1;
- struct fddi_8022_2_hdr llc_8022_2;
- struct fddi_snap_hdr llc_snap;
+ struct fddi_8022_1_hdr llc_8022_1 __attribute__((packed));
+ struct fddi_8022_2_hdr llc_8022_2 __attribute__((packed));
+ struct fddi_snap_hdr llc_snap __attribute__((packed));
} hdr;
- } __attribute__ ((packed));
+ };

/* Define FDDI statistics structure */
struct fddi_statistics

------------------------------------------------------------------
Jon Lewis <jlewis@fdt.net> | Unsolicited commercial e-mail will
Network Administrator | be proof-read for $199/hr.
________Finger jlewis@inorganic5.fdt.net for PGP public key_______