From 7901e7c69fc793aa590529afad433ec856baca72 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 27 Oct 2014 16:57:19 +0100 Subject: [PATCH] lib: add iwinfo_backend_by_name() Signed-off-by: Jo-Philipp Wich --- include/iwinfo.h | 1 + iwinfo_lib.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/iwinfo.h b/include/iwinfo.h index 68d459b..38120e6 100644 --- a/include/iwinfo.h +++ b/include/iwinfo.h @@ -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; diff --git a/iwinfo_lib.c b/iwinfo_lib.c index 4ae8f59..c30d834 100644 --- a/iwinfo_lib.c +++ b/iwinfo_lib.c @@ -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;