diff --git a/Makefile.am b/Makefile.am index d6ff41b8..ecaa3771 100644 --- a/Makefile.am +++ b/Makefile.am @@ -225,7 +225,7 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h src/missing.h \ src/resolve.h src/resolve.c\ src/hotspot.c \ src/p2putil.h src/p2putil.c \ - src/module.c \ + src/module.h src/module.c \ src/rrm.c \ $(eap_sources) \ $(builtin_sources) diff --git a/src/adhoc.c b/src/adhoc.c index 755e9493..a63c4669 100644 --- a/src/adhoc.c +++ b/src/adhoc.c @@ -29,6 +29,7 @@ #include "linux/nl80211.h" #include "src/iwd.h" +#include "src/module.h" #include "src/device.h" #include "src/netdev.h" #include "src/wiphy.h" diff --git a/src/agent.c b/src/agent.c index 7be3f83f..d213f3cd 100644 --- a/src/agent.c +++ b/src/agent.c @@ -30,6 +30,7 @@ #include "src/dbus.h" #include "src/agent.h" #include "src/iwd.h" +#include "src/module.h" static unsigned int next_request_id = 0; diff --git a/src/anqp.c b/src/anqp.c index 5e867656..f3171456 100644 --- a/src/anqp.c +++ b/src/anqp.c @@ -28,6 +28,7 @@ #include +#include "src/module.h" #include "src/anqp.h" #include "src/util.h" #include "src/eap-private.h" diff --git a/src/ap.c b/src/ap.c index 1a23a5c5..e79de108 100644 --- a/src/ap.c +++ b/src/ap.c @@ -32,6 +32,7 @@ #include "linux/nl80211.h" #include "src/iwd.h" +#include "src/module.h" #include "src/scan.h" #include "src/device.h" #include "src/netdev.h" diff --git a/src/blacklist.c b/src/blacklist.c index c93f8ee7..04e4b8e3 100644 --- a/src/blacklist.c +++ b/src/blacklist.c @@ -29,6 +29,7 @@ #include "src/blacklist.h" #include "src/util.h" #include "src/iwd.h" +#include "src/module.h" /* * The current timeout is multiplied by this value after an entry is blacklisted diff --git a/src/device.c b/src/device.c index 688bedff..7cbe95e7 100644 --- a/src/device.c +++ b/src/device.c @@ -31,6 +31,7 @@ #include #include "src/iwd.h" +#include "src/module.h" #include "src/util.h" #include "src/wiphy.h" #include "src/scan.h" diff --git a/src/eap.c b/src/eap.c index ec69109a..012bd58e 100644 --- a/src/eap.c +++ b/src/eap.c @@ -31,6 +31,7 @@ #include #include "src/missing.h" +#include "src/module.h" #include "src/eap.h" #include "src/eap-private.h" #include "src/iwd.h" diff --git a/src/eapol.c b/src/eapol.c index a7f1a039..8da224a5 100644 --- a/src/eapol.c +++ b/src/eapol.c @@ -31,6 +31,7 @@ #include #include "src/missing.h" +#include "src/module.h" #include "src/crypto.h" #include "src/eapol.h" #include "src/ie.h" diff --git a/src/erp.c b/src/erp.c index 2884eb83..ab6a16f8 100644 --- a/src/erp.c +++ b/src/erp.c @@ -32,6 +32,7 @@ #include "src/missing.h" #include "src/iwd.h" +#include "src/module.h" #include "src/eap-private.h" #include "src/erp.h" #include "src/crypto.h" diff --git a/src/hotspot.c b/src/hotspot.c index 72baa15f..68fc5a66 100644 --- a/src/hotspot.c +++ b/src/hotspot.c @@ -31,6 +31,7 @@ #include #include "src/iwd.h" +#include "src/module.h" #include "src/common.h" #include "src/network.h" #include "src/util.h" diff --git a/src/iwd.h b/src/iwd.h index bc448fd3..22223526 100644 --- a/src/iwd.h +++ b/src/iwd.h @@ -35,33 +35,3 @@ const char *iwd_get_iface_blacklist(void); const char *iwd_get_phy_whitelist(void); const char *iwd_get_phy_blacklist(void); - -struct iwd_module_desc { - const char *name; - int (*init)(void); - void (*exit)(void); - bool active; -} __attribute__((aligned(8))); - -struct iwd_module_depends { - const char *self; - const char *target; -}; - -#define IWD_MODULE(name, init, exit) \ - static struct iwd_module_desc __iwd_module_ ## name \ - __attribute__((used, section("__iwd_module"), aligned(8))) = {\ - #name, init, exit \ - }; - -#define IWD_MODULE_DEPENDS(name, dep) \ - static struct iwd_module_depends \ - __iwd_module__##name_##dep \ - __attribute__((used, section("__iwd_module_dep"), \ - aligned(8))) = { \ - .self = #name, \ - .target = #dep, \ - }; - -int iwd_modules_init(); -void iwd_modules_exit(); diff --git a/src/knownnetworks.c b/src/knownnetworks.c index d8d6947d..6022e9c1 100644 --- a/src/knownnetworks.c +++ b/src/knownnetworks.c @@ -35,6 +35,7 @@ #include #include "src/iwd.h" +#include "src/module.h" #include "src/storage.h" #include "src/common.h" #include "src/network.h" diff --git a/src/main.c b/src/main.c index d7a83af6..e1b9073c 100644 --- a/src/main.c +++ b/src/main.c @@ -34,6 +34,7 @@ #include "linux/nl80211.h" #include "src/iwd.h" +#include "src/module.h" #include "src/wiphy.h" #include "src/dbus.h" #include "src/eap.h" diff --git a/src/manager.c b/src/manager.c index b269011d..47874e11 100644 --- a/src/manager.c +++ b/src/manager.c @@ -36,6 +36,7 @@ #include "src/nl80211util.h" #include "src/iwd.h" +#include "src/module.h" #include "src/netdev.h" #include "src/wiphy.h" #include "src/util.h" diff --git a/src/module.c b/src/module.c index 5cf655ec..9eb282f0 100644 --- a/src/module.c +++ b/src/module.c @@ -26,7 +26,7 @@ #include #include -#include "src/iwd.h" +#include "src/module.h" struct dependency { struct dependency *next; diff --git a/src/module.h b/src/module.h new file mode 100644 index 00000000..b0102cba --- /dev/null +++ b/src/module.h @@ -0,0 +1,51 @@ +/* + * + * Wireless daemon for Linux + * + * Copyright (C) 2019 Intel Corporation. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +struct iwd_module_desc { + const char *name; + int (*init)(void); + void (*exit)(void); + bool active; +} __attribute__((aligned(8))); + +struct iwd_module_depends { + const char *self; + const char *target; +}; + +#define IWD_MODULE(name, init, exit) \ + static struct iwd_module_desc __iwd_module_ ## name \ + __attribute__((used, section("__iwd_module"), aligned(8))) = {\ + #name, init, exit \ + }; + +#define IWD_MODULE_DEPENDS(name, dep) \ + static struct iwd_module_depends \ + __iwd_module__##name_##dep \ + __attribute__((used, section("__iwd_module_dep"), \ + aligned(8))) = { \ + .self = #name, \ + .target = #dep, \ + }; + +int iwd_modules_init(); +void iwd_modules_exit(); diff --git a/src/netconfig.c b/src/netconfig.c index b075f893..9d32c37a 100644 --- a/src/netconfig.c +++ b/src/netconfig.c @@ -34,6 +34,7 @@ #include #include "src/iwd.h" +#include "src/module.h" #include "src/netdev.h" #include "src/station.h" #include "src/common.h" diff --git a/src/netdev.c b/src/netdev.c index 2baa12bd..c48e2c1a 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -42,6 +42,7 @@ #include "linux/nl80211.h" #include "src/iwd.h" +#include "src/module.h" #include "src/wiphy.h" #include "src/ie.h" #include "src/mpdu.h" diff --git a/src/network.c b/src/network.c index 0f29022b..29cd4e13 100644 --- a/src/network.c +++ b/src/network.c @@ -33,6 +33,7 @@ #include #include "src/missing.h" +#include "src/module.h" #include "src/ie.h" #include "src/crypto.h" #include "src/iwd.h" diff --git a/src/resolve.c b/src/resolve.c index ca0ffa4d..387e0b3c 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -33,6 +33,7 @@ #include #include "src/iwd.h" +#include "src/module.h" #include "src/dbus.h" #include "src/resolve.h" diff --git a/src/rfkill.c b/src/rfkill.c index edade664..0c88b3ea 100644 --- a/src/rfkill.c +++ b/src/rfkill.c @@ -35,6 +35,7 @@ #include #include "src/iwd.h" +#include "src/module.h" #include "src/common.h" #include "src/rfkill.h" diff --git a/src/rrm.c b/src/rrm.c index 7db679ee..b4c5655f 100644 --- a/src/rrm.c +++ b/src/rrm.c @@ -30,6 +30,7 @@ #include +#include "src/module.h" #include "src/mpdu.h" #include "src/netdev.h" #include "src/iwd.h" diff --git a/src/scan.c b/src/scan.c index 1f14b9fe..f2332545 100644 --- a/src/scan.c +++ b/src/scan.c @@ -37,6 +37,7 @@ #include "linux/nl80211.h" #include "src/iwd.h" +#include "src/module.h" #include "src/wiphy.h" #include "src/ie.h" #include "src/common.h" diff --git a/src/simauth.c b/src/simauth.c index 0e57e6b2..a0d56c76 100644 --- a/src/simauth.c +++ b/src/simauth.c @@ -30,6 +30,7 @@ #include #include "src/iwd.h" +#include "src/module.h" #include "src/watchlist.h" #include "src/simauth.h" diff --git a/src/station.c b/src/station.c index ccf93934..76cf20a1 100644 --- a/src/station.c +++ b/src/station.c @@ -35,6 +35,7 @@ #include "src/util.h" #include "src/iwd.h" +#include "src/module.h" #include "src/common.h" #include "src/device.h" #include "src/watchlist.h" diff --git a/src/wiphy.c b/src/wiphy.c index 22eb8664..1da479db 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -38,6 +38,7 @@ #include "linux/nl80211.h" #include "src/iwd.h" +#include "src/module.h" #include "src/ie.h" #include "src/crypto.h" #include "src/scan.h" diff --git a/src/wsc.c b/src/wsc.c index 1050aefd..ca176a90 100644 --- a/src/wsc.c +++ b/src/wsc.c @@ -29,6 +29,7 @@ #include #include "src/missing.h" +#include "src/module.h" #include "src/dbus.h" #include "src/netdev.h" #include "src/wiphy.h"