diff options
author | Aki Niemi <aki.niemi@nokia.com> | 2010-04-21 10:47:16 +0300 |
---|---|---|
committer | Aki Niemi <aki.niemi@nokia.com> | 2010-04-21 10:48:29 +0300 |
commit | 22103491a4171a55a2593bb1b727b086c13df7c6 (patch) | |
tree | f96b7673ab33732c62137b495bd3723d52a624bd /gisi/netlink.c | |
parent | 3dc106c627f858317df5d15ed019673cd8c83193 (diff) | |
download | ofono-22103491a4171a55a2593bb1b727b086c13df7c6.tar.bz2 |
gisi: move g_isi_modem_by_name to separate file
This fixes build warnings that resulted from conflicts between
linux/if.h and net/if.h.
Diffstat (limited to 'gisi/netlink.c')
-rw-r--r-- | gisi/netlink.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/gisi/netlink.c b/gisi/netlink.c index 6e37b333..1a18b458 100644 --- a/gisi/netlink.c +++ b/gisi/netlink.c @@ -76,21 +76,6 @@ struct _GPhonetNetlink { unsigned interface; }; -/* if_nametoindex is in #include <net/if.h>, - but it is not compatible with <linux/if.h> */ - -extern unsigned if_nametoindex (char const *name); - -GIsiModem *g_isi_modem_by_name(char const *name) -{ - unsigned index = if_nametoindex(name); - - if (errno == 0) - errno = ENODEV; - - return (GIsiModem *)(void *)(uintptr_t)index; -} - static inline GIsiModem *make_modem(unsigned idx) { return (void *)(uintptr_t)idx; @@ -113,15 +98,15 @@ GPhonetNetlink *g_pn_netlink_by_modem(GIsiModem *idx) return NULL; } -GPhonetNetlink *g_pn_netlink_by_name(char const *ifname) +GPhonetNetlink *g_pn_netlink_by_name(const char *ifname) { if (ifname == NULL) { return g_pn_netlink_by_modem(make_modem(0)); } else { - unsigned index = if_nametoindex(ifname); - if (index == 0) + GIsiModem *idx = g_isi_modem_by_name(ifname); + if (!idx) return NULL; - return g_pn_netlink_by_modem(make_modem(index)); + return g_pn_netlink_by_modem(idx); } } |