[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>
This commit is contained in:
committed by
David S. Miller
parent
81878d27fd
commit
17c157c889
@ -188,12 +188,9 @@ static int netlbl_mgmt_listall_cb(struct netlbl_dom_map *entry, void *arg)
|
||||
struct netlbl_domhsh_walk_arg *cb_arg = arg;
|
||||
void *data;
|
||||
|
||||
data = netlbl_netlink_hdr_put(cb_arg->skb,
|
||||
NETLINK_CB(cb_arg->nl_cb->skb).pid,
|
||||
cb_arg->seq,
|
||||
netlbl_mgmt_gnl_family.id,
|
||||
NLM_F_MULTI,
|
||||
NLBL_MGMT_C_LISTALL);
|
||||
data = genlmsg_put(cb_arg->skb, NETLINK_CB(cb_arg->nl_cb->skb).pid,
|
||||
cb_arg->seq, &netlbl_mgmt_gnl_family,
|
||||
NLM_F_MULTI, NLBL_MGMT_C_LISTALL);
|
||||
if (data == NULL)
|
||||
goto listall_cb_failure;
|
||||
|
||||
@ -359,12 +356,8 @@ static int netlbl_mgmt_listdef(struct sk_buff *skb, struct genl_info *info)
|
||||
ans_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
|
||||
if (ans_skb == NULL)
|
||||
return -ENOMEM;
|
||||
data = netlbl_netlink_hdr_put(ans_skb,
|
||||
info->snd_pid,
|
||||
info->snd_seq,
|
||||
netlbl_mgmt_gnl_family.id,
|
||||
0,
|
||||
NLBL_MGMT_C_LISTDEF);
|
||||
data = genlmsg_put_reply(ans_skb, info, &netlbl_mgmt_gnl_family,
|
||||
0, NLBL_MGMT_C_LISTDEF);
|
||||
if (data == NULL)
|
||||
goto listdef_failure;
|
||||
|
||||
@ -422,12 +415,9 @@ static int netlbl_mgmt_protocols_cb(struct sk_buff *skb,
|
||||
int ret_val = -ENOMEM;
|
||||
void *data;
|
||||
|
||||
data = netlbl_netlink_hdr_put(skb,
|
||||
NETLINK_CB(cb->skb).pid,
|
||||
cb->nlh->nlmsg_seq,
|
||||
netlbl_mgmt_gnl_family.id,
|
||||
NLM_F_MULTI,
|
||||
NLBL_MGMT_C_PROTOCOLS);
|
||||
data = genlmsg_put(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq,
|
||||
&netlbl_mgmt_gnl_family, NLM_F_MULTI,
|
||||
NLBL_MGMT_C_PROTOCOLS);
|
||||
if (data == NULL)
|
||||
goto protocols_cb_failure;
|
||||
|
||||
@ -495,12 +485,8 @@ static int netlbl_mgmt_version(struct sk_buff *skb, struct genl_info *info)
|
||||
ans_skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
|
||||
if (ans_skb == NULL)
|
||||
return -ENOMEM;
|
||||
data = netlbl_netlink_hdr_put(ans_skb,
|
||||
info->snd_pid,
|
||||
info->snd_seq,
|
||||
netlbl_mgmt_gnl_family.id,
|
||||
0,
|
||||
NLBL_MGMT_C_VERSION);
|
||||
data = genlmsg_put_reply(ans_skb, info, &netlbl_mgmt_gnl_family,
|
||||
0, NLBL_MGMT_C_VERSION);
|
||||
if (data == NULL)
|
||||
goto version_failure;
|
||||
|
||||
|
Reference in New Issue
Block a user