[PATCH] driver_nl80211: get rid of family/cache objects
Johannes Berg
johannes
Thu Nov 10 06:38:17 PST 2011
From: Johannes Berg <johannes.berg at intel.com>
All we really need is the family ID, and we can
get that with genl_ctrl_resolve() and then don't
need to worry about family/cache objects.
Signed-hostap: Johannes Berg <johannes.berg at intel.com>
---
src/drivers/driver_nl80211.c | 30 ++++--------------------------
1 files changed, 4 insertions(+), 26 deletions(-)
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 3c98ee0..77a9e50 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -109,23 +109,11 @@ static void nl80211_handle_destroy(struct nl_handle *handle)
nl_handle_destroy(handle);
}
-
-static inline int __genl_ctrl_alloc_cache(struct nl_handle *h,
- struct nl_cache **cache)
-{
- struct nl_cache *tmp = genl_ctrl_alloc_cache(h);
- if (!tmp)
- return -ENOMEM;
- *cache = tmp;
- return 0;
-}
-#define genl_ctrl_alloc_cache __genl_ctrl_alloc_cache
#endif /* CONFIG_LIBNL20 */
struct nl80211_handles {
struct nl_handle *handle;
- struct nl_cache *cache;
};
@@ -148,12 +136,6 @@ static int nl_create_handles(struct nl80211_handles *handles, struct nl_cb *cb,
goto err;
}
- if (genl_ctrl_alloc_cache(handles->handle, &handles->cache) < 0) {
- wpa_printf(MSG_ERROR, "nl80211: Failed to allocate generic "
- "netlink cache (%s)", dbg);
- goto err;
- }
-
return 0;
err:
nl80211_handle_destroy(handles->handle);
@@ -165,7 +147,6 @@ static void nl_destroy_handles(struct nl80211_handles *handles)
{
if (handles->handle == NULL)
return;
- nl_cache_free(handles->cache);
nl80211_handle_destroy(handles->handle);
handles->handle = NULL;
}
@@ -191,7 +172,7 @@ struct nl80211_global {
struct netlink_data *netlink;
struct nl_cb *nl_cb;
struct nl80211_handles nl;
- struct genl_family *nl80211;
+ int nl80211_id;
int ioctl_sock; /* socket for ioctl() use */
struct nl80211_handles nl_event;
@@ -525,7 +506,7 @@ nla_put_failure:
static void * nl80211_cmd(struct wpa_driver_nl80211_data *drv,
struct nl_msg *msg, int flags, uint8_t cmd)
{
- return genlmsg_put(msg, 0, 0, genl_family_get_id(drv->global->nl80211),
+ return genlmsg_put(msg, 0, 0, drv->global->nl80211_id,
0, flags, cmd, 0);
}
@@ -2539,9 +2520,8 @@ static int wpa_driver_nl80211_init_nl_global(struct nl80211_global *global)
if (nl_create_handles(&global->nl, global->nl_cb, "nl"))
goto err;
- global->nl80211 = genl_ctrl_search_by_name(global->nl.cache,
- "nl80211");
- if (global->nl80211 == NULL) {
+ global->nl80211_id = genl_ctrl_resolve(global->nl.handle, "nl80211");
+ if (global->nl80211_id < 0) {
wpa_printf(MSG_ERROR, "nl80211: 'nl80211' generic netlink not "
"found");
goto err;
@@ -7999,8 +7979,6 @@ static void nl80211_global_deinit(void *priv)
if (global->netlink)
netlink_deinit(global->netlink);
- if (global->nl80211)
- genl_family_put(global->nl80211);
nl_destroy_handles(&global->nl);
if (global->nl_event.handle) {
--
1.7.6.3
More information about the Hostap
mailing list