[0/3] Phonet build work-arounds take two
Rémi Denis-Courmont
remi at remlab.net
Fri Jul 3 08:20:49 PDT 2009
A variant with less configure and config.h clutter.
configure.ac | 4 +++
drivers/atmodem/at.h | 4 ---
drivers/isimodem/isi.h | 4 ---
gisi/client.c | 10 ++++----
gisi/netlink.c | 9 ++++---
gisi/phonet.h | 56
+++++++++++++++++++++++++++++++++++++++++++++++++
gisi/socket.c | 11 ++++-----
7 files changed, 75 insertions(+), 23 deletions(-)
--
Rémi Denis-Courmont
-------------- next part --------------
From 44ed0e385e79c1230ecc6a3d583e1095eee7f9a0 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?R=C3=A9mi=20Denis-Courmont?= <remi.denis-courmont at nokia.com>
Date: Thu, 2 Jul 2009 13:43:34 +0300
Subject: [PATCH] Do not include <config.h> from headers
It should be included _first_ in all modules, and it is not proof
against multiple inclusions.
---
drivers/atmodem/at.h | 4 ----
drivers/isimodem/isi.h | 4 ----
2 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/drivers/atmodem/at.h b/drivers/atmodem/at.h
index 0300282..3cc3cb1 100644
--- a/drivers/atmodem/at.h
+++ b/drivers/atmodem/at.h
@@ -19,10 +19,6 @@
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
struct at_data {
GAtChat *parser;
struct ofono_modem *modem;
diff --git a/drivers/isimodem/isi.h b/drivers/isimodem/isi.h
index b89a694..e808bfd 100644
--- a/drivers/isimodem/isi.h
+++ b/drivers/isimodem/isi.h
@@ -21,10 +21,6 @@
*
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#define DECLARE_FAILURE(e) \
struct ofono_error e; \
e.type = OFONO_ERROR_TYPE_FAILURE; \
--
1.6.0.4
-------------- next part --------------
From f840ea7a705e3c03cd774149ccf4f4bb35c8a3ea Mon Sep 17 00:00:00 2001
From: =?utf-8?q?R=C3=A9mi=20Denis-Courmont?= <remi.denis-courmont at nokia.com>
Date: Fri, 3 Jul 2009 18:19:15 +0300
Subject: [PATCH] Replacement header for Phonet definitions
---
gisi/phonet.h | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
create mode 100644 gisi/phonet.h
diff --git a/gisi/phonet.h b/gisi/phonet.h
new file mode 100644
index 0000000..a3d3d7d
--- /dev/null
+++ b/gisi/phonet.h
@@ -0,0 +1,56 @@
+/**
+ * Phonet sockets kernel interface
+ *
+ * Copyright (C) 2008 Nokia Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef NETPHONET_PHONET_H
+#define NETPHONET_PHONET_H
+
+#include <sys/types.h>
+
+#include <sys/socket.h>
+#ifndef AF_PHONET
+#define AF_PHONET 35
+#define PF_PHONET AF_PHONET
+#endif
+
+#define PN_PROTO_TRANSPORT 0
+#define PN_PROTO_PHONET 1
+#define PN_PROTO_PIPE 2
+
+#define PNPIPE_ENCAP 1
+#define PNPIPE_IFINDEX 2
+
+#define PNPIPE_ENCAP_NONE 0
+#define PNPIPE_ENCAP_IP 1
+
+#define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0)
+
+struct sockaddr_pn {
+ sa_family_t spn_family;
+ uint8_t spn_obj;
+ uint8_t spn_dev;
+ uint8_t spn_resource;
+ uint8_t __pad[sizeof(struct sockaddr) - (sizeof(sa_family_t) + 3)];
+} __attribute__ ((packed));
+
+#include <linux/rtnetlink.h>
+#ifndef RTNLGRP_PHONET_IFADDR
+#define RTNLGRP_PHONET_IFADDR 21
+#endif
+
+#endif
--
1.6.0.4
-------------- next part --------------
From 7e50d7580cdcddf55864ebad91396bc21e41c59f Mon Sep 17 00:00:00 2001
From: =?utf-8?q?R=C3=A9mi=20Denis-Courmont?= <remi.denis-courmont at nokia.com>
Date: Thu, 2 Jul 2009 11:07:56 +0300
Subject: [PATCH] Check and use netphonet/phonet.h instead of linux/phonet.h
---
configure.ac | 4 ++++
gisi/client.c | 10 +++++-----
gisi/netlink.c | 9 +++++----
gisi/socket.c | 11 +++++------
4 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/configure.ac b/configure.ac
index 9ba745f..71989e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,10 @@ AC_SUBST([GDBUS_LIBS], ['$(top_builddir)/gdbus/libgdbus.la $(DBUS_LIBS)'])
AC_SUBST([GATCHAT_CFLAGS], ['-I$(top_srcdir)/gatchat'])
AC_SUBST([GATCHAT_LIBS], ['$(top_builddir)/gatchat/libgatchat.la'])
+AC_CHECK_HEADERS([netphonet/phonet.h], [], [],
+[#include <sys/types.h>
+#include <sys/socket.h>
+])
AC_SUBST([GISI_CFLAGS], ['-I$(top_srcdir)'])
AC_SUBST([GISI_LIBS], ['$(top_builddir)/gisi/libgisi.la'])
diff --git a/gisi/client.c b/gisi/client.c
index ae8b030..fd6dc87 100644
--- a/gisi/client.c
+++ b/gisi/client.c
@@ -33,12 +33,12 @@
#include <sys/socket.h>
#include <sys/uio.h>
#include <errno.h>
-#include <glib.h>
-#include <linux/types.h>
-#include <linux/phonet.h>
-#ifndef AF_PHONET
-#define AF_PHONET 35
+#ifdef HAVE_NETPHONET_PHONET_H
+#include <netphonet/phonet.h>
+#else
+#include "phonet.h"
#endif
+#include <glib.h>
#include "socket.h"
#include "client.h"
diff --git a/gisi/netlink.c b/gisi/netlink.c
index d555588..b34e8b4 100644
--- a/gisi/netlink.c
+++ b/gisi/netlink.c
@@ -33,14 +33,15 @@
#include <unistd.h>
#include <fcntl.h>
#include <sys/socket.h>
+#ifdef HAVE_NETPHONET_PHONET_H
+#include <netphonet/phonet.h>
+#else
+#include "phonet.h"
+#endif
#ifndef SOL_NETLINK
#define SOL_NETLINK 270 /* libc!? */
#endif
-#ifndef AF_PHONET
-#define AF_PHONET 35
-#endif
#include <linux/rtnetlink.h>
-#include <linux/phonet.h>
#include <glib.h>
#include "netlink.h"
diff --git a/gisi/socket.c b/gisi/socket.c
index 6f72120..2b0493c 100644
--- a/gisi/socket.c
+++ b/gisi/socket.c
@@ -31,14 +31,13 @@
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
-#include <linux/types.h>
-#include <linux/phonet.h>
+#ifdef HAVE_NETPHONET_PHONET_H
+#include <netphonet/phonet.h>
+#else
+#include "phonet.h"
+#endif
#include <glib.h>
-#ifndef AF_PHONET
-#define AF_PHONET 35
-#define PF_PHONET AF_PHONET
-#endif
#include "socket.h"
GIOChannel *phonet_new(uint8_t resource)
--
1.6.0.4
More information about the ofono
mailing list