[GENL]: Add genlmsg_put_reply() to simplify building reply headers
By modyfing genlmsg_put() to take a genl_family and by adding genlmsg_put_reply() the process of constructing the netlink and generic netlink headers is simplified. Signed-off-by: Thomas Graf <tgraf@suug.ch> Acked-by: Paul Moore <paul.moore@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
这个提交包含在:
@@ -384,6 +384,13 @@ static void genl_rcv(struct sock *sk, int len)
|
||||
* Controller
|
||||
**************************************************************************/
|
||||
|
||||
static struct genl_family genl_ctrl = {
|
||||
.id = GENL_ID_CTRL,
|
||||
.name = "nlctrl",
|
||||
.version = 0x1,
|
||||
.maxattr = CTRL_ATTR_MAX,
|
||||
};
|
||||
|
||||
static int ctrl_fill_info(struct genl_family *family, u32 pid, u32 seq,
|
||||
u32 flags, struct sk_buff *skb, u8 cmd)
|
||||
{
|
||||
@@ -392,8 +399,7 @@ static int ctrl_fill_info(struct genl_family *family, u32 pid, u32 seq,
|
||||
void *hdr;
|
||||
int idx = 1;
|
||||
|
||||
hdr = genlmsg_put(skb, pid, seq, GENL_ID_CTRL, 0, flags, cmd,
|
||||
family->version);
|
||||
hdr = genlmsg_put(skb, pid, seq, &genl_ctrl, flags, cmd);
|
||||
if (hdr == NULL)
|
||||
return -1;
|
||||
|
||||
@@ -562,13 +568,6 @@ static struct genl_ops genl_ctrl_ops = {
|
||||
.policy = ctrl_policy,
|
||||
};
|
||||
|
||||
static struct genl_family genl_ctrl = {
|
||||
.id = GENL_ID_CTRL,
|
||||
.name = "nlctrl",
|
||||
.version = 0x1,
|
||||
.maxattr = CTRL_ATTR_MAX,
|
||||
};
|
||||
|
||||
static int __init genl_init(void)
|
||||
{
|
||||
int i, err;
|
||||
|
在新工单中引用
屏蔽一个用户