Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[linux-2.6-block.git] / include / net / genetlink.h
index 6c92415311cacb3ee39ff768edc3d2a4461e922f..0574abd3db86bc0a796819a387dfc751adfcb04d 100644 (file)
@@ -210,6 +210,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
@@ -250,9 +267,9 @@ static inline void *genlmsg_put_reply(struct sk_buff *skb,
  * @skb: socket buffer the message is stored in
  * @hdr: user specific header
  */
-static inline int genlmsg_end(struct sk_buff *skb, void *hdr)
+static inline void genlmsg_end(struct sk_buff *skb, void *hdr)
 {
-       return nlmsg_end(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN);
+       nlmsg_end(skb, hdr - GENL_HDRLEN - NLMSG_HDRLEN);
 }
 
 /**