commit 0ad8f7e0d63344d0aefff0d41ea294e5495ddeaa
parent a277a424f351d65e2ea0bf874a361579784cbc6c
Author: Denis Kenzior <denkenz@gmail.com>
Date: Sun, 19 Aug 2018 23:12:14 -0500
netdev: Add netdev_get_path
Diffstat:
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
@@ -25,6 +25,7 @@
#endif
#include <stdlib.h>
+#include <stdio.h>
#include <linux/rtnetlink.h>
#include <net/if_arp.h>
#include <linux/if.h>
@@ -296,6 +297,15 @@ struct device *netdev_get_device(struct netdev *netdev)
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,
const void *data,
uint32_t len, void *user_data)
diff --git a/src/netdev.h b/src/netdev.h
@@ -109,6 +109,7 @@ bool netdev_get_4addr(struct netdev *netdev);
const char *netdev_get_name(struct netdev *netdev);
bool netdev_get_is_up(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_get_handshake(struct netdev *netdev);