From: Ben Hutchings <bhutchings@solarflare.com>
To: netdev <netdev@vger.kernel.org>
Cc: "Gabor Z. Papp" <gzp@papp.hu>
Subject: [PATCH ethtool] ethtool: Work around old <linux/types.h> without big-endian types
Date: Tue, 23 Nov 2010 17:15:17 +0000 [thread overview]
Message-ID: <1290532517.6770.1603.camel@localhost> (raw)
Add an autoconf test for whether __be16 and __be32 are defined.
If not, define them in ethtool-util.h.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
__be16 and __be32 were not included in the userland version of
<linux/types.h> before Linux 2.6.10.
Ben.
configure.ac | 7 +++++++
ethtool-util.h | 6 ++++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
index f2401a4..2e31e3a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,6 +17,13 @@ dnl Checks for header files.
AC_CHECK_HEADERS(sys/ioctl.h)
dnl Checks for typedefs, structures, and compiler characteristics.
+AC_MSG_CHECKING([whether <linux/types.h> defines big-endian types])
+AC_TRY_COMPILE([#include <linux/types.h>],
+ [__be16 foo;__be32 bar;],
+ [AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_BE_TYPES], [1],
+ [Define to 1 if <linux/types.h> defines big-endian types])],
+ [AC_MSG_RESULT(no)])
dnl Checks for library functions.
AC_HEADER_STDC
diff --git a/ethtool-util.h b/ethtool-util.h
index 4ef3a9f..f053028 100644
--- a/ethtool-util.h
+++ b/ethtool-util.h
@@ -6,6 +6,12 @@
#include <sys/types.h>
#include <endian.h>
+/* ethtool.h expects these to be defined by <linux/types.h> */
+#ifndef HAVE_BE_TYPES
+typedef __uint16_t __be16;
+typedef __uint32_t __be32;
+#endif
+
#include "ethtool-copy.h"
typedef unsigned long long u64;
--
1.5.4
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
reply other threads:[~2010-11-23 17:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1290532517.6770.1603.camel@localhost \
--to=bhutchings@solarflare.com \
--cc=gzp@papp.hu \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).