|
@@ -159,6 +159,38 @@ static inline void *genlmsg_put(struct sk_buff *skb, u32 pid, u32 seq,
|
|
|
return (char *) hdr + GENL_HDRLEN;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * genlmsg_nlhdr - Obtain netlink header from user specified header
|
|
|
+ * @user_hdr: user header as returned from genlmsg_put()
|
|
|
+ * @family: generic netlink family
|
|
|
+ *
|
|
|
+ * Returns pointer to netlink header.
|
|
|
+ */
|
|
|
+static inline struct nlmsghdr *genlmsg_nlhdr(void *user_hdr,
|
|
|
+ struct genl_family *family)
|
|
|
+{
|
|
|
+ return (struct nlmsghdr *)((char *)user_hdr -
|
|
|
+ family->hdrsize -
|
|
|
+ GENL_HDRLEN -
|
|
|
+ NLMSG_HDRLEN);
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * genl_dump_check_consistent - check if sequence is consistent and advertise if not
|
|
|
+ * @cb: netlink callback structure that stores the sequence number
|
|
|
+ * @user_hdr: user header as returned from genlmsg_put()
|
|
|
+ * @family: generic netlink family
|
|
|
+ *
|
|
|
+ * Cf. nl_dump_check_consistent(), this just provides a wrapper to make it
|
|
|
+ * simpler to use with generic netlink.
|
|
|
+ */
|
|
|
+static inline void genl_dump_check_consistent(struct netlink_callback *cb,
|
|
|
+ void *user_hdr,
|
|
|
+ struct genl_family *family)
|
|
|
+{
|
|
|
+ nl_dump_check_consistent(cb, genlmsg_nlhdr(user_hdr, family));
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* genlmsg_put_reply - Add generic netlink header to a reply message
|
|
|
* @skb: socket buffer holding the message
|