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

Johannes Berg
2008-11-27T12:21:13Z

[-- Attachment #1: Type: text/plain, Size: 1326 bytes --]

On Thu, 2008-11-27 at 10:54 +0100, Johannes Berg wrote:

> > + 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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]