mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-21 22:09:23 +01:00
wired: Utilize module system for daemon init
This commit is contained in:
parent
ab5742bb32
commit
fa3db055ce
@ -315,7 +315,9 @@ libexec_PROGRAMS += wired/ead
|
||||
|
||||
wired_ead_SOURCES = wired/main.c wired/ethdev.h wired/ethdev.c \
|
||||
wired/network.h wired/network.c \
|
||||
wired/dbus.h wired/dbus.c $(eap_sources)
|
||||
wired/dbus.h wired/dbus.c \
|
||||
src/module.h src/module.c \
|
||||
$(eap_sources)
|
||||
wired_ead_LDADD = $(ell_ldadd)
|
||||
wired_ead_DEPENDENCIES = $(ell_dependencies)
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <ell/ell.h>
|
||||
|
||||
#include "src/module.h"
|
||||
#include "src/eap.h"
|
||||
#include "wired/dbus.h"
|
||||
#include "wired/network.h"
|
||||
|
12
wired/main.c
12
wired/main.c
@ -30,6 +30,7 @@
|
||||
#include <getopt.h>
|
||||
#include <ell/ell.h>
|
||||
|
||||
#include "src/module.h"
|
||||
#include "src/eap.h"
|
||||
#include "wired/dbus.h"
|
||||
#include "wired/ethdev.h"
|
||||
@ -46,8 +47,11 @@ static void dbus_ready(struct l_dbus *dbus, void *user_data)
|
||||
|
||||
l_info("System ready");
|
||||
|
||||
eap_init();
|
||||
network_init();
|
||||
if (iwd_modules_init() < 0) {
|
||||
l_main_quit();
|
||||
return;
|
||||
}
|
||||
|
||||
ethdev_init(opts->interfaces, opts->nointerfaces);
|
||||
}
|
||||
|
||||
@ -56,8 +60,8 @@ static void dbus_shutdown(struct l_dbus *dbus, void *user_data)
|
||||
l_info("System shutdown");
|
||||
|
||||
ethdev_exit();
|
||||
network_exit();
|
||||
eap_exit();
|
||||
|
||||
iwd_modules_exit();
|
||||
|
||||
dbus_app_shutdown_complete();
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <ell/ell.h>
|
||||
|
||||
#include "src/module.h"
|
||||
#include "wired/network.h"
|
||||
|
||||
#define STORAGEFILE_SUFFIX ".8021x"
|
||||
@ -171,7 +172,7 @@ static void network_storage_watch_destroy(void *user_data)
|
||||
storage_watch = NULL;
|
||||
}
|
||||
|
||||
bool network_init(void)
|
||||
static int network_init(void)
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *dirent;
|
||||
@ -187,7 +188,7 @@ bool network_init(void)
|
||||
state_dirs = l_strsplit(state_dir, ':');
|
||||
if (!state_dirs[0]) {
|
||||
l_strv_free(state_dirs);
|
||||
return false;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
storage_path = l_strdup(state_dirs[0]);
|
||||
@ -196,7 +197,7 @@ bool network_init(void)
|
||||
dir = opendir(storage_path);
|
||||
if (!dir) {
|
||||
l_info("Unable to open %s: %s", storage_path, strerror(errno));
|
||||
return false;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
network_list = l_queue_new();
|
||||
@ -224,10 +225,10 @@ bool network_init(void)
|
||||
network_storage_watch_cb, NULL,
|
||||
network_storage_watch_destroy);
|
||||
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void network_exit(void)
|
||||
static void network_exit(void)
|
||||
{
|
||||
l_dir_watch_destroy(storage_watch);
|
||||
|
||||
@ -236,3 +237,6 @@ void network_exit(void)
|
||||
|
||||
l_free(storage_path);
|
||||
}
|
||||
|
||||
IWD_MODULE(network, network_init, network_exit);
|
||||
IWD_MODULE_DEPENDS(network, eap);
|
||||
|
@ -22,7 +22,4 @@
|
||||
|
||||
struct l_settings;
|
||||
|
||||
bool network_init(void);
|
||||
void network_exit(void);
|
||||
|
||||
struct l_settings *network_lookup_security(const char *network);
|
||||
|
Loading…
Reference in New Issue
Block a user