3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-19 11:09:25 +01:00

module: Move declarations into separate header file

This commit is contained in:
Marcel Holtmann 2019-11-07 23:33:51 +01:00
parent b45242562b
commit ab5742bb32
28 changed files with 77 additions and 32 deletions

View File

@ -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/resolve.h src/resolve.c\
src/hotspot.c \ src/hotspot.c \
src/p2putil.h src/p2putil.c \ src/p2putil.h src/p2putil.c \
src/module.c \ src/module.h src/module.c \
src/rrm.c \ src/rrm.c \
$(eap_sources) \ $(eap_sources) \
$(builtin_sources) $(builtin_sources)

View File

@ -29,6 +29,7 @@
#include "linux/nl80211.h" #include "linux/nl80211.h"
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
#include "src/device.h" #include "src/device.h"
#include "src/netdev.h" #include "src/netdev.h"
#include "src/wiphy.h" #include "src/wiphy.h"

View File

@ -30,6 +30,7 @@
#include "src/dbus.h" #include "src/dbus.h"
#include "src/agent.h" #include "src/agent.h"
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
static unsigned int next_request_id = 0; static unsigned int next_request_id = 0;

View File

@ -28,6 +28,7 @@
#include <ell/ell.h> #include <ell/ell.h>
#include "src/module.h"
#include "src/anqp.h" #include "src/anqp.h"
#include "src/util.h" #include "src/util.h"
#include "src/eap-private.h" #include "src/eap-private.h"

View File

@ -32,6 +32,7 @@
#include "linux/nl80211.h" #include "linux/nl80211.h"
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
#include "src/scan.h" #include "src/scan.h"
#include "src/device.h" #include "src/device.h"
#include "src/netdev.h" #include "src/netdev.h"

View File

@ -29,6 +29,7 @@
#include "src/blacklist.h" #include "src/blacklist.h"
#include "src/util.h" #include "src/util.h"
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
/* /*
* The current timeout is multiplied by this value after an entry is blacklisted * The current timeout is multiplied by this value after an entry is blacklisted

View File

@ -31,6 +31,7 @@
#include <ell/ell.h> #include <ell/ell.h>
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
#include "src/util.h" #include "src/util.h"
#include "src/wiphy.h" #include "src/wiphy.h"
#include "src/scan.h" #include "src/scan.h"

View File

@ -31,6 +31,7 @@
#include <ell/ell.h> #include <ell/ell.h>
#include "src/missing.h" #include "src/missing.h"
#include "src/module.h"
#include "src/eap.h" #include "src/eap.h"
#include "src/eap-private.h" #include "src/eap-private.h"
#include "src/iwd.h" #include "src/iwd.h"

View File

@ -31,6 +31,7 @@
#include <ell/ell.h> #include <ell/ell.h>
#include "src/missing.h" #include "src/missing.h"
#include "src/module.h"
#include "src/crypto.h" #include "src/crypto.h"
#include "src/eapol.h" #include "src/eapol.h"
#include "src/ie.h" #include "src/ie.h"

View File

@ -32,6 +32,7 @@
#include "src/missing.h" #include "src/missing.h"
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
#include "src/eap-private.h" #include "src/eap-private.h"
#include "src/erp.h" #include "src/erp.h"
#include "src/crypto.h" #include "src/crypto.h"

View File

@ -31,6 +31,7 @@
#include <ell/ell.h> #include <ell/ell.h>
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
#include "src/common.h" #include "src/common.h"
#include "src/network.h" #include "src/network.h"
#include "src/util.h" #include "src/util.h"

View File

@ -35,33 +35,3 @@ const char *iwd_get_iface_blacklist(void);
const char *iwd_get_phy_whitelist(void); const char *iwd_get_phy_whitelist(void);
const char *iwd_get_phy_blacklist(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();

View File

@ -35,6 +35,7 @@
#include <ell/ell.h> #include <ell/ell.h>
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
#include "src/storage.h" #include "src/storage.h"
#include "src/common.h" #include "src/common.h"
#include "src/network.h" #include "src/network.h"

View File

@ -34,6 +34,7 @@
#include "linux/nl80211.h" #include "linux/nl80211.h"
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
#include "src/wiphy.h" #include "src/wiphy.h"
#include "src/dbus.h" #include "src/dbus.h"
#include "src/eap.h" #include "src/eap.h"

View File

@ -36,6 +36,7 @@
#include "src/nl80211util.h" #include "src/nl80211util.h"
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
#include "src/netdev.h" #include "src/netdev.h"
#include "src/wiphy.h" #include "src/wiphy.h"
#include "src/util.h" #include "src/util.h"

View File

@ -26,7 +26,7 @@
#include <errno.h> #include <errno.h>
#include <ell/ell.h> #include <ell/ell.h>
#include "src/iwd.h" #include "src/module.h"
struct dependency { struct dependency {
struct dependency *next; struct dependency *next;

51
src/module.h Normal file
View File

@ -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();

View File

@ -34,6 +34,7 @@
#include <ell/ell.h> #include <ell/ell.h>
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
#include "src/netdev.h" #include "src/netdev.h"
#include "src/station.h" #include "src/station.h"
#include "src/common.h" #include "src/common.h"

View File

@ -42,6 +42,7 @@
#include "linux/nl80211.h" #include "linux/nl80211.h"
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
#include "src/wiphy.h" #include "src/wiphy.h"
#include "src/ie.h" #include "src/ie.h"
#include "src/mpdu.h" #include "src/mpdu.h"

View File

@ -33,6 +33,7 @@
#include <ell/ell.h> #include <ell/ell.h>
#include "src/missing.h" #include "src/missing.h"
#include "src/module.h"
#include "src/ie.h" #include "src/ie.h"
#include "src/crypto.h" #include "src/crypto.h"
#include "src/iwd.h" #include "src/iwd.h"

View File

@ -33,6 +33,7 @@
#include <ell/ell.h> #include <ell/ell.h>
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
#include "src/dbus.h" #include "src/dbus.h"
#include "src/resolve.h" #include "src/resolve.h"

View File

@ -35,6 +35,7 @@
#include <ell/ell.h> #include <ell/ell.h>
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
#include "src/common.h" #include "src/common.h"
#include "src/rfkill.h" #include "src/rfkill.h"

View File

@ -30,6 +30,7 @@
#include <ell/ell.h> #include <ell/ell.h>
#include "src/module.h"
#include "src/mpdu.h" #include "src/mpdu.h"
#include "src/netdev.h" #include "src/netdev.h"
#include "src/iwd.h" #include "src/iwd.h"

View File

@ -37,6 +37,7 @@
#include "linux/nl80211.h" #include "linux/nl80211.h"
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
#include "src/wiphy.h" #include "src/wiphy.h"
#include "src/ie.h" #include "src/ie.h"
#include "src/common.h" #include "src/common.h"

View File

@ -30,6 +30,7 @@
#include <ell/ell.h> #include <ell/ell.h>
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
#include "src/watchlist.h" #include "src/watchlist.h"
#include "src/simauth.h" #include "src/simauth.h"

View File

@ -35,6 +35,7 @@
#include "src/util.h" #include "src/util.h"
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
#include "src/common.h" #include "src/common.h"
#include "src/device.h" #include "src/device.h"
#include "src/watchlist.h" #include "src/watchlist.h"

View File

@ -38,6 +38,7 @@
#include "linux/nl80211.h" #include "linux/nl80211.h"
#include "src/iwd.h" #include "src/iwd.h"
#include "src/module.h"
#include "src/ie.h" #include "src/ie.h"
#include "src/crypto.h" #include "src/crypto.h"
#include "src/scan.h" #include "src/scan.h"

View File

@ -29,6 +29,7 @@
#include <ell/ell.h> #include <ell/ell.h>
#include "src/missing.h" #include "src/missing.h"
#include "src/module.h"
#include "src/dbus.h" #include "src/dbus.h"
#include "src/netdev.h" #include "src/netdev.h"
#include "src/wiphy.h" #include "src/wiphy.h"