]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
genetlink: Add genlmsg_parse() helper function.
authorJoe Stringer <joestringer@nicira.com>
Thu, 22 Jan 2015 00:42:51 +0000 (16:42 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 26 Jan 2015 23:45:50 +0000 (15:45 -0800)
The first user will be the next patch.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/genetlink.h

index f24aa83b80b642557876c91264013b0e900f8db4..d5a9a8b5af37920422a49d6855083842d115b0de 100644 (file)
@@ -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