Thread (95 messages) 95 messages, 9 authors, 2008-12-04

Re: [PATCH 09/39] wimax: provides user space with information needed when opening a WiMAX device

From: Johannes Berg <johannes@sipsolutions.net>
Date: 2008-11-27 12:21:13

On Thu, 2008-11-27 at 10:54 +0100, Johannes Berg wrote:
quoted
+	result = -ENOMEM;
+	reply_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+	if (reply_skb == NULL)
+		goto error_new;
+	data = genlmsg_put_reply(reply_skb, genl_info,
+				 &wimax_dev->gnl_family,
+				 0, WIMAX_GNL_RP_IFINFO);
+	if (data == NULL)
+		goto error_put_reply;
+
+	nla_groups = nla_nest_start(reply_skb, WIMAX_GNL_IFINFO_MC_GROUPS);
+	if (nla_groups == NULL)
+		goto error_groups_start;
+
+	list_for_each_entry(pipe_itr, &wimax_dev->pipe_list,
+			    list_node) {
+		nla_group = nla_nest_start(reply_skb,
+					   WIMAX_GNL_IFINFO_MC_GROUP);
+		if (nla_group == NULL)
+			goto error_group_start;
+
+		nla_put_u16(reply_skb, WIMAX_GNL_IFINFO_MC_ID,
+			    pipe_itr->mcg.id);
+		nla_put_string(reply_skb, WIMAX_GNL_IFINFO_MC_NAME,
+			       pipe_itr->mcg.name);
All this is discoverable via the genl controller and a pipe naming
scheme, so I don't think you need this "open" command at all.
In fact, it's entirely trivial since you use a genl family for each
interface, thus you just have to ask the genl controller for the groups
associated with that family. If you need sample code, check out iw.

johannes

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help