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

netdev: Make enum naming consistent with guidelines

This commit is contained in:
Denis Kenzior 2016-07-19 18:03:21 -05:00
parent 1c5438d3ab
commit fba5ada1a1
3 changed files with 17 additions and 9 deletions

View File

@ -1031,14 +1031,16 @@ static void device_netdev_notify(struct netdev *netdev,
struct device *device = user_data;
struct l_dbus *dbus = dbus_get_bus();
if (event == NETDEV_EVENT_UP) {
switch (event) {
case NETDEV_WATCH_EVENT_UP:
device_enter_state(device, DEVICE_STATE_AUTOCONNECT);
__device_watch_call_added(device);
l_dbus_property_changed(dbus, device_get_path(device),
IWD_DEVICE_INTERFACE, "Powered");
} else if (event == NETDEV_EVENT_DOWN) {
break;
case NETDEV_WATCH_EVENT_DOWN:
device_enter_state(device, DEVICE_STATE_OFF);
if (device->scan_pending)
@ -1079,9 +1081,12 @@ static void device_netdev_notify(struct netdev *netdev,
l_dbus_property_changed(dbus, device_get_path(device),
IWD_DEVICE_INTERFACE, "Powered");
} else if (event == NETDEV_EVENT_NAME_CHANGE)
break;
case NETDEV_WATCH_EVENT_NAME_CHANGE:
l_dbus_property_changed(dbus, device_get_path(device),
IWD_DEVICE_INTERFACE, "Name");
break;
}
}
struct device *device_create(struct wiphy *wiphy, struct netdev *netdev)
@ -1110,7 +1115,9 @@ struct device *device_create(struct wiphy *wiphy, struct netdev *netdev)
scan_ifindex_add(device->index);
device_netdev_notify(netdev, netdev_get_is_up(netdev) ?
NETDEV_EVENT_UP : NETDEV_EVENT_DOWN, device);
NETDEV_WATCH_EVENT_UP :
NETDEV_WATCH_EVENT_DOWN,
device);
device->netdev_watch_id =
netdev_watch_add(netdev, device_netdev_notify, device);

View File

@ -1231,14 +1231,15 @@ static void netdev_newlink_notify(const struct ifinfomsg *ifi, int bytes)
if (old_up != new_up) {
event.netdev = netdev;
event.type = new_up ? NETDEV_EVENT_UP : NETDEV_EVENT_DOWN;
event.type = new_up ? NETDEV_WATCH_EVENT_UP :
NETDEV_WATCH_EVENT_DOWN;
l_queue_foreach(netdev->watches, netdev_watch_notify, &event);
}
if (strcmp(old_name, netdev->name)) {
event.netdev = netdev;
event.type = NETDEV_EVENT_NAME_CHANGE;
event.type = NETDEV_WATCH_EVENT_NAME_CHANGE;
l_queue_foreach(netdev->watches, netdev_watch_notify, &event);
}

View File

@ -44,9 +44,9 @@ enum netdev_event {
};
enum netdev_watch_event {
NETDEV_EVENT_UP,
NETDEV_EVENT_DOWN,
NETDEV_EVENT_NAME_CHANGE,
NETDEV_WATCH_EVENT_UP,
NETDEV_WATCH_EVENT_DOWN,
NETDEV_WATCH_EVENT_NAME_CHANGE,
};
typedef void (*netdev_command_func_t) (bool result, void *user_data);