mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 23:09:34 +01:00
device: Make functions static, drop device.h
This commit is contained in:
parent
1057d8aa74
commit
3ffb645f22
@ -189,7 +189,7 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h src/missing.h \
|
|||||||
src/plugin.h src/plugin.c \
|
src/plugin.h src/plugin.c \
|
||||||
src/netdev.h src/netdev.c \
|
src/netdev.h src/netdev.c \
|
||||||
src/wiphy.h src/wiphy.c \
|
src/wiphy.h src/wiphy.c \
|
||||||
src/device.h src/device.c \
|
src/device.c \
|
||||||
src/station.h src/station.c \
|
src/station.h src/station.c \
|
||||||
src/ie.h src/ie.c \
|
src/ie.h src/ie.c \
|
||||||
src/dbus.h src/dbus.c \
|
src/dbus.h src/dbus.c \
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#include "src/iwd.h"
|
#include "src/iwd.h"
|
||||||
#include "src/module.h"
|
#include "src/module.h"
|
||||||
#include "src/device.h"
|
|
||||||
#include "src/netdev.h"
|
#include "src/netdev.h"
|
||||||
#include "src/wiphy.h"
|
#include "src/wiphy.h"
|
||||||
#include "src/crypto.h"
|
#include "src/crypto.h"
|
||||||
|
1
src/ap.c
1
src/ap.c
@ -34,7 +34,6 @@
|
|||||||
#include "src/iwd.h"
|
#include "src/iwd.h"
|
||||||
#include "src/module.h"
|
#include "src/module.h"
|
||||||
#include "src/scan.h"
|
#include "src/scan.h"
|
||||||
#include "src/device.h"
|
|
||||||
#include "src/netdev.h"
|
#include "src/netdev.h"
|
||||||
#include "src/wiphy.h"
|
#include "src/wiphy.h"
|
||||||
#include "src/crypto.h"
|
#include "src/crypto.h"
|
||||||
|
141
src/device.c
141
src/device.c
@ -38,7 +38,6 @@
|
|||||||
#include "src/netdev.h"
|
#include "src/netdev.h"
|
||||||
#include "src/dbus.h"
|
#include "src/dbus.h"
|
||||||
#include "src/station.h"
|
#include "src/station.h"
|
||||||
#include "src/device.h"
|
|
||||||
|
|
||||||
struct device {
|
struct device {
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
@ -285,6 +284,75 @@ static void setup_device_interface(struct l_dbus_interface *interface)
|
|||||||
device_property_set_mode);
|
device_property_set_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void device_wiphy_state_changed_event(struct wiphy *wiphy,
|
||||||
|
enum wiphy_state_watch_event event,
|
||||||
|
void *user_data)
|
||||||
|
{
|
||||||
|
struct device *device = user_data;
|
||||||
|
|
||||||
|
switch (event) {
|
||||||
|
case WIPHY_STATE_WATCH_EVENT_RFKILLED:
|
||||||
|
break;
|
||||||
|
case WIPHY_STATE_WATCH_EVENT_POWERED:
|
||||||
|
if (device->dbus_powered)
|
||||||
|
netdev_set_powered(device->netdev, true,
|
||||||
|
NULL, NULL, NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct device *device_create(struct wiphy *wiphy, struct netdev *netdev)
|
||||||
|
{
|
||||||
|
struct device *device;
|
||||||
|
struct l_dbus *dbus = dbus_get_bus();
|
||||||
|
uint32_t ifindex = netdev_get_ifindex(netdev);
|
||||||
|
const uint8_t action_ap_roam_prefix[2] = { 0x0a, 0x07 };
|
||||||
|
|
||||||
|
device = l_new(struct device, 1);
|
||||||
|
device->index = ifindex;
|
||||||
|
device->wiphy = wiphy;
|
||||||
|
device->netdev = netdev;
|
||||||
|
|
||||||
|
if (!l_dbus_object_add_interface(dbus, netdev_get_path(device->netdev),
|
||||||
|
IWD_DEVICE_INTERFACE, device))
|
||||||
|
l_info("Unable to register %s interface", IWD_DEVICE_INTERFACE);
|
||||||
|
|
||||||
|
if (!l_dbus_object_add_interface(dbus, netdev_get_path(device->netdev),
|
||||||
|
L_DBUS_INTERFACE_PROPERTIES, device))
|
||||||
|
l_info("Unable to register %s interface",
|
||||||
|
L_DBUS_INTERFACE_PROPERTIES);
|
||||||
|
|
||||||
|
scan_wdev_add(netdev_get_wdev_id(device->netdev));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* register for AP roam transition watch
|
||||||
|
*/
|
||||||
|
device->ap_roam_watch = netdev_frame_watch_add(netdev, 0x00d0,
|
||||||
|
action_ap_roam_prefix, sizeof(action_ap_roam_prefix),
|
||||||
|
device_ap_roam_frame_event, device);
|
||||||
|
|
||||||
|
device->powered = netdev_get_is_up(netdev);
|
||||||
|
|
||||||
|
device->dbus_powered = true;
|
||||||
|
device->wiphy_rfkill_watch =
|
||||||
|
wiphy_state_watch_add(wiphy, device_wiphy_state_changed_event,
|
||||||
|
device, NULL);
|
||||||
|
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void device_free(struct device *device)
|
||||||
|
{
|
||||||
|
l_debug("");
|
||||||
|
|
||||||
|
scan_wdev_remove(netdev_get_wdev_id(device->netdev));
|
||||||
|
|
||||||
|
netdev_frame_watch_remove(device->netdev, device->ap_roam_watch);
|
||||||
|
wiphy_state_watch_remove(device->wiphy, device->wiphy_rfkill_watch);
|
||||||
|
|
||||||
|
l_free(device);
|
||||||
|
}
|
||||||
|
|
||||||
static void device_netdev_notify(struct netdev *netdev,
|
static void device_netdev_notify(struct netdev *netdev,
|
||||||
enum netdev_watch_event event,
|
enum netdev_watch_event event,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
@ -338,80 +406,11 @@ static void device_netdev_notify(struct netdev *netdev,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void device_wiphy_state_changed_event(struct wiphy *wiphy,
|
|
||||||
enum wiphy_state_watch_event event,
|
|
||||||
void *user_data)
|
|
||||||
{
|
|
||||||
struct device *device = user_data;
|
|
||||||
|
|
||||||
switch (event) {
|
|
||||||
case WIPHY_STATE_WATCH_EVENT_RFKILLED:
|
|
||||||
break;
|
|
||||||
case WIPHY_STATE_WATCH_EVENT_POWERED:
|
|
||||||
if (device->dbus_powered)
|
|
||||||
netdev_set_powered(device->netdev, true,
|
|
||||||
NULL, NULL, NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct device *device_create(struct wiphy *wiphy, struct netdev *netdev)
|
|
||||||
{
|
|
||||||
struct device *device;
|
|
||||||
struct l_dbus *dbus = dbus_get_bus();
|
|
||||||
uint32_t ifindex = netdev_get_ifindex(netdev);
|
|
||||||
const uint8_t action_ap_roam_prefix[2] = { 0x0a, 0x07 };
|
|
||||||
|
|
||||||
device = l_new(struct device, 1);
|
|
||||||
device->index = ifindex;
|
|
||||||
device->wiphy = wiphy;
|
|
||||||
device->netdev = netdev;
|
|
||||||
|
|
||||||
if (!l_dbus_object_add_interface(dbus, netdev_get_path(device->netdev),
|
|
||||||
IWD_DEVICE_INTERFACE, device))
|
|
||||||
l_info("Unable to register %s interface", IWD_DEVICE_INTERFACE);
|
|
||||||
|
|
||||||
if (!l_dbus_object_add_interface(dbus, netdev_get_path(device->netdev),
|
|
||||||
L_DBUS_INTERFACE_PROPERTIES, device))
|
|
||||||
l_info("Unable to register %s interface",
|
|
||||||
L_DBUS_INTERFACE_PROPERTIES);
|
|
||||||
|
|
||||||
scan_wdev_add(netdev_get_wdev_id(device->netdev));
|
|
||||||
|
|
||||||
/*
|
|
||||||
* register for AP roam transition watch
|
|
||||||
*/
|
|
||||||
device->ap_roam_watch = netdev_frame_watch_add(netdev, 0x00d0,
|
|
||||||
action_ap_roam_prefix, sizeof(action_ap_roam_prefix),
|
|
||||||
device_ap_roam_frame_event, device);
|
|
||||||
|
|
||||||
device->powered = netdev_get_is_up(netdev);
|
|
||||||
|
|
||||||
device->dbus_powered = true;
|
|
||||||
device->wiphy_rfkill_watch =
|
|
||||||
wiphy_state_watch_add(wiphy, device_wiphy_state_changed_event,
|
|
||||||
device, NULL);
|
|
||||||
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
void device_remove(struct device *device)
|
|
||||||
{
|
|
||||||
l_debug("");
|
|
||||||
|
|
||||||
scan_wdev_remove(netdev_get_wdev_id(device->netdev));
|
|
||||||
|
|
||||||
netdev_frame_watch_remove(device->netdev, device->ap_roam_watch);
|
|
||||||
wiphy_state_watch_remove(device->wiphy, device->wiphy_rfkill_watch);
|
|
||||||
|
|
||||||
l_free(device);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void destroy_device_interface(void *user_data)
|
static void destroy_device_interface(void *user_data)
|
||||||
{
|
{
|
||||||
struct device *device = user_data;
|
struct device *device = user_data;
|
||||||
|
|
||||||
device_remove(device);
|
device_free(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int device_init(void)
|
static int device_init(void)
|
||||||
|
30
src/device.h
30
src/device.h
@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* Wireless daemon for Linux
|
|
||||||
*
|
|
||||||
* Copyright (C) 2013-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
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
struct wiphy;
|
|
||||||
struct netdev;
|
|
||||||
struct device;
|
|
||||||
|
|
||||||
struct device *device_create(struct wiphy *wiphy, struct netdev *netdev);
|
|
||||||
void device_remove(struct device *device);
|
|
@ -37,7 +37,6 @@
|
|||||||
#include "src/iwd.h"
|
#include "src/iwd.h"
|
||||||
#include "src/module.h"
|
#include "src/module.h"
|
||||||
#include "src/common.h"
|
#include "src/common.h"
|
||||||
#include "src/device.h"
|
|
||||||
#include "src/watchlist.h"
|
#include "src/watchlist.h"
|
||||||
#include "src/scan.h"
|
#include "src/scan.h"
|
||||||
#include "src/netdev.h"
|
#include "src/netdev.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user