lib: add iwinfo_backend_by_name()

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
Jo-Philipp Wich 2014-10-27 16:57:19 +01:00
parent 32dad1a63a
commit 7901e7c69f
2 changed files with 12 additions and 0 deletions

View file

@ -182,6 +182,7 @@ struct iwinfo_ops {
const char * iwinfo_type(const char *ifname); const char * iwinfo_type(const char *ifname);
const struct iwinfo_ops * iwinfo_backend(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); void iwinfo_finish(void);
extern const struct iwinfo_ops wext_ops; extern const struct iwinfo_ops wext_ops;

View file

@ -350,6 +350,17 @@ const struct iwinfo_ops * iwinfo_backend(const char *ifname)
return NULL; 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) void iwinfo_finish(void)
{ {
int i; int i;