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

netdev: Add netdev_get_path

This commit is contained in:
Denis Kenzior 2018-08-19 23:12:14 -05:00
parent a277a424f3
commit 0ad8f7e0d6
2 changed files with 11 additions and 0 deletions

View File

@ -25,6 +25,7 @@
#endif #endif
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <linux/rtnetlink.h> #include <linux/rtnetlink.h>
#include <net/if_arp.h> #include <net/if_arp.h>
#include <linux/if.h> #include <linux/if.h>
@ -296,6 +297,15 @@ struct device *netdev_get_device(struct netdev *netdev)
return netdev->device; return netdev->device;
} }
const char *netdev_get_path(struct netdev *netdev)
{
static char path[26];
snprintf(path, sizeof(path), "%s/%u", wiphy_get_path(netdev->wiphy),
netdev->index);
return path;
}
static void netdev_set_powered_result(int error, uint16_t type, static void netdev_set_powered_result(int error, uint16_t type,
const void *data, const void *data,
uint32_t len, void *user_data) uint32_t len, void *user_data)

View File

@ -109,6 +109,7 @@ bool netdev_get_4addr(struct netdev *netdev);
const char *netdev_get_name(struct netdev *netdev); const char *netdev_get_name(struct netdev *netdev);
bool netdev_get_is_up(struct netdev *netdev); bool netdev_get_is_up(struct netdev *netdev);
struct device *netdev_get_device(struct netdev *netdev); struct device *netdev_get_device(struct netdev *netdev);
const char *netdev_get_path(struct netdev *netdev);
struct handshake_state *netdev_handshake_state_new(struct netdev *netdev); struct handshake_state *netdev_handshake_state_new(struct netdev *netdev);
struct handshake_state *netdev_get_handshake(struct netdev *netdev); struct handshake_state *netdev_get_handshake(struct netdev *netdev);