Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 132332 - sys-kernel/linux-headers - ethtool.h broken (typedef u32)
Summary: sys-kernel/linux-headers - ethtool.h broken (typedef u32)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Low minor (vote)
Assignee: Tim Yamin (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-05 04:55 UTC by Dick Marinus
Modified: 2006-07-28 14:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
kernel-2.eclass.patch (kernel-2.eclass.patch,605 bytes, patch)
2006-05-05 09:25 UTC, Dick Marinus
Details | Diff
kernel-2.eclass.patch (kernel-2.eclass.patch,627 bytes, patch)
2006-05-06 02:37 UTC, Dick Marinus
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dick Marinus 2006-05-05 04:55:25 UTC
$ echo "#include <linux/ethtool.h>" > test.c

$ gcc -c test.c
In file included from test.c:1:
/usr/include/linux/ethtool.h:330: error: syntax error before "u32"
/usr/include/linux/ethtool.h:343: error: syntax error before "u32"
/usr/include/linux/ethtool.h:345: error: syntax error before "u32"
/usr/include/linux/ethtool.h:347: error: syntax error before "u32"
/usr/include/linux/ethtool.h:349: error: syntax error before "u32"
/usr/include/linux/ethtool.h:353: error: syntax error before "u32"

I've rsync-ed and re-emerged sys-kernel/linux-headers-2.6.11-r5 today. Replacing the broken u32 to __u32 seems to fix these issues. I'm running ~x86.
Comment 1 Dick Marinus 2006-05-05 08:25:17 UTC
maybe:
sed 's/\(__\)\?\([us]\(8\|16\|32\|64\)\)/__\2/g' 

would fix the problem?
Comment 2 Dick Marinus 2006-05-05 09:25:32 UTC
Created attachment 86205 [details, diff]
kernel-2.eclass.patch

diff -ud orig/linux/ethtool.h linux/ethtool.h
--- orig/linux/ethtool.h        2006-05-05 17:04:26.000000000 +0200
+++ linux/ethtool.h     2006-05-05 17:31:20.000000000 +0200
@@ -42,7 +42,7 @@
                                /* For PCI devices, use pci_name(pci_dev). */
        char    reserved1[32];
        char    reserved2[16];
-       __u32   n_stats;        /* number of u64's from ETHTOOL_GSTATS */
+       __u32   n_stats;        /* number of __u64's from ETHTOOL_GSTATS */
        __u32   testinfo_len;
        __u32   eedump_len;     /* Size of data from ETHTOOL_GEEPROM (bytes) */
        __u32   regdump_len;    /* Size of data from ETHTOOL_GREGS (bytes) */
@@ -248,7 +248,7 @@
 /* for dumping NIC-specific statistics */
 struct ethtool_stats {
        __u32   cmd;            /* ETHTOOL_GSTATS */
-       __u32   n_stats;        /* number of u64's being returned */
+       __u32   n_stats;        /* number of __u64's being returned */
        __u64   data[0];
 };

@@ -327,7 +327,7 @@
        void    (*get_wol)(struct net_device *, struct ethtool_wolinfo *);
        int     (*set_wol)(struct net_device *, struct ethtool_wolinfo *);
        __u32   (*get_msglevel)(struct net_device *);
-       void    (*set_msglevel)(struct net_device *, u32);
+       void    (*set_msglevel)(struct net_device *, __u32);
        int     (*nway_reset)(struct net_device *);
        __u32   (*get_link)(struct net_device *);
        int     (*get_eeprom_len)(struct net_device *);
@@ -340,17 +340,17 @@
        void    (*get_pauseparam)(struct net_device *, struct ethtool_pauseparam*);
        int     (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam*);
        __u32   (*get_rx_csum)(struct net_device *);
-       int     (*set_rx_csum)(struct net_device *, u32);
+       int     (*set_rx_csum)(struct net_device *, __u32);
        __u32   (*get_tx_csum)(struct net_device *);
-       int     (*set_tx_csum)(struct net_device *, u32);
+       int     (*set_tx_csum)(struct net_device *, __u32);
        __u32   (*get_sg)(struct net_device *);
-       int     (*set_sg)(struct net_device *, u32);
+       int     (*set_sg)(struct net_device *, __u32);
        __u32   (*get_tso)(struct net_device *);
-       int     (*set_tso)(struct net_device *, u32);
+       int     (*set_tso)(struct net_device *, __u32);
        int     (*self_test_count)(struct net_device *);
        void    (*self_test)(struct net_device *, struct ethtool_test *, __u64 *);
        void    (*get_strings)(struct net_device *, __u32 stringset, __u8 *);
-       int     (*phys_id)(struct net_device *, u32);
+       int     (*phys_id)(struct net_device *, __u32);
        int     (*get_stats_count)(struct net_device *);
        void    (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, __u64 *);
        int     (*begin)(struct net_device *);
Comment 3 Dick Marinus 2006-05-06 02:37:19 UTC
Created attachment 86243 [details, diff]
kernel-2.eclass.patch

symbols like __fs16 are safe now.

Please note sys-kernel/linux-headers-2.6.16 needs to be instructed to ignore asm/types.h.
Comment 4 Tim Yamin (RETIRED) gentoo-dev 2006-05-06 06:43:06 UTC
's:\<\([us]\(8\|16\|32\|64\)\)\>:__\1:g'

^^ Want to just try that instead? I'm not sure where the fsXX types are used (and if types.h defines those I doubt they'd conflict in userspace anyway).
Comment 5 Dick Marinus 2006-05-06 08:29:00 UTC
word match, smart! ethtool.h seems to be fixed correctly.

you are right about asm/types.h which doesn't break userspace but the kernel-2.eclass seems to run 'make oldconfig' which defines __KERNEL__.

There are more headers broken, I'm also having the same problems with mii.h and ext3_fs.h.

fsXX isn't a problem with your regexp either, you can find them by using: egrep '[A-Za-z0-9][us](8|16|32|64)' /usr/include/linux -r
Comment 6 Tim Yamin (RETIRED) gentoo-dev 2006-05-06 08:30:41 UTC
(In reply to comment #5)
> There are more headers broken, I'm also having the same problems with mii.h and
> ext3_fs.h.

Hmm, did you rerun the updated sed on those headers as well? If they still break post compiler errors please.
Comment 7 Dick Marinus 2006-05-06 10:28:54 UTC
I'm commenting about linux-headers-2.6.11-r5 which seems to patch jiffies.h and ethtool.h, could you please add mii.h and ext3_fs.h to this list?
Comment 8 Tim Yamin (RETIRED) gentoo-dev 2006-07-28 14:32:47 UTC
Now fixed in CVS; sorry about the delay! Thanks...