From: Joe Stringer Date: Thu, 22 Jan 2015 00:42:51 +0000 (-0800) Subject: genetlink: Add genlmsg_parse() helper function. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7b1883cefc288b2725966357edd2d8f321605622;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git genetlink: Add genlmsg_parse() helper function. The first user will be the next patch. Signed-off-by: Joe Stringer Acked-by: Pravin B Shelar Signed-off-by: David S. Miller --- diff --git a/include/net/genetlink.h b/include/net/genetlink.h index f24aa83b80b6..d5a9a8b5af37 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h @@ -205,6 +205,23 @@ static inline struct nlmsghdr *genlmsg_nlhdr(void *user_hdr, NLMSG_HDRLEN); } +/** + * genlmsg_parse - parse attributes of a genetlink message + * @nlh: netlink message header + * @family: genetlink message family + * @tb: destination array with maxtype+1 elements + * @maxtype: maximum attribute type to be expected + * @policy: validation policy + * */ +static inline int genlmsg_parse(const struct nlmsghdr *nlh, + const struct genl_family *family, + struct nlattr *tb[], int maxtype, + const struct nla_policy *policy) +{ + return nlmsg_parse(nlh, family->hdrsize + GENL_HDRLEN, tb, maxtype, + policy); +} + /** * genl_dump_check_consistent - check if sequence is consistent and advertise if not * @cb: netlink callback structure that stores the sequence number