lib: add iwinfo_backend_by_name()
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 27 Oct 2014 15:57:19 +0000 (16:57 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 27 Oct 2014 15:57:19 +0000 (16:57 +0100)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
include/iwinfo.h
iwinfo_lib.c

index 68d459b8d39f38d6f04e17a369bef5bd86297110..38120e66deb27c1c964abe0507666f3ceedb8171 100644 (file)
@@ -182,6 +182,7 @@ struct iwinfo_ops {
 
 const char * iwinfo_type(const char *ifname);
 const struct iwinfo_ops * iwinfo_backend(const char *ifname);
+const struct iwinfo_ops * iwinfo_backend_by_name(const char *name);
 void iwinfo_finish(void);
 
 extern const struct iwinfo_ops wext_ops;
index 4ae8f591c93a2a6141e8e0c2847737837733510d..c30d8341a1dfb1f5c57468b91b6a56f28fac2f04 100644 (file)
@@ -350,6 +350,17 @@ const struct iwinfo_ops * iwinfo_backend(const char *ifname)
        return NULL;
 }
 
+const struct iwinfo_ops * iwinfo_backend_by_name(const char *name)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(backends); i++)
+               if (!strcmp(backends[i]->name, name))
+                       return backends[i];
+
+       return NULL;
+}
+
 void iwinfo_finish(void)
 {
        int i;