3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

knownnetworks: Use l_dir_watch instead of l_fswatch

This commit is contained in:
Marcel Holtmann 2018-10-19 19:12:32 +02:00
parent 949e672b75
commit a59e162446

View File

@ -42,7 +42,7 @@
static struct l_queue *known_networks; static struct l_queue *known_networks;
static size_t num_known_hidden_networks; static size_t num_known_hidden_networks;
static struct l_fswatch *storage_dir_watch; static struct l_dir_watch *storage_dir_watch;
static int timespec_compare(const struct timespec *tsa, static int timespec_compare(const struct timespec *tsa,
const struct timespec *tsb) const struct timespec *tsb)
@ -294,9 +294,8 @@ static void known_network_removed(struct network_info *network)
network_info_forget_known(network); network_info_forget_known(network);
} }
static void known_networks_watch_cb(struct l_fswatch *watch, static void known_networks_watch_cb(const char *filename,
const char *filename, enum l_dir_watch_event event,
enum l_fswatch_event event,
void *user_data) void *user_data)
{ {
const char *ssid; const char *ssid;
@ -323,11 +322,9 @@ static void known_networks_watch_cb(struct l_fswatch *watch,
full_path = storage_get_network_file_path(security, ssid); full_path = storage_get_network_file_path(security, ssid);
switch (event) { switch (event) {
case L_FSWATCH_EVENT_DELETE: case L_DIR_WATCH_EVENT_CREATED:
case L_FSWATCH_EVENT_MOVE: case L_DIR_WATCH_EVENT_REMOVED:
case L_FSWATCH_EVENT_MODIFY: case L_DIR_WATCH_EVENT_MODIFIED:
case L_FSWATCH_EVENT_ATTRIB:
case L_FSWATCH_EVENT_CREATE:
/* /*
* For now treat all the operations the same. E.g. they may * For now treat all the operations the same. E.g. they may
* result in the removal of the network (file moved out, not * result in the removal of the network (file moved out, not
@ -347,6 +344,9 @@ static void known_networks_watch_cb(struct l_fswatch *watch,
} }
l_settings_free(settings); l_settings_free(settings);
break;
case L_DIR_WATCH_EVENT_ACCESSED:
break;
} }
} }
@ -405,7 +405,7 @@ bool known_networks_init(void)
closedir(dir); closedir(dir);
storage_dir_watch = l_fswatch_new(DAEMON_STORAGEDIR, storage_dir_watch = l_dir_watch_new(DAEMON_STORAGEDIR,
known_networks_watch_cb, NULL, known_networks_watch_cb, NULL,
known_networks_watch_destroy); known_networks_watch_destroy);
@ -416,7 +416,7 @@ void known_networks_exit(void)
{ {
struct l_dbus *dbus = dbus_get_bus(); struct l_dbus *dbus = dbus_get_bus();
l_fswatch_destroy(storage_dir_watch); l_dir_watch_destroy(storage_dir_watch);
l_queue_destroy(known_networks, network_info_free); l_queue_destroy(known_networks, network_info_free);
known_networks = NULL; known_networks = NULL;