aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/netlink.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/netlink.h')
-rw-r--r--include/net/netlink.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 02740a94f108..98c185441bee 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -638,6 +638,30 @@ static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, u32 pid)
638 nlmsg_ok(pos, rem); \ 638 nlmsg_ok(pos, rem); \
639 pos = nlmsg_next(pos, &(rem))) 639 pos = nlmsg_next(pos, &(rem)))
640 640
641/**
642 * nl_dump_check_consistent - check if sequence is consistent and advertise if not
643 * @cb: netlink callback structure that stores the sequence number
644 * @nlh: netlink message header to write the flag to
645 *
646 * This function checks if the sequence (generation) number changed during dump
647 * and if it did, advertises it in the netlink message header.
648 *
649 * The correct way to use it is to set cb->seq to the generation counter when
650 * all locks for dumping have been acquired, and then call this function for
651 * each message that is generated.
652 *
653 * Note that due to initialisation concerns, 0 is an invalid sequence number
654 * and must not be used by code that uses this functionality.
655 */
656static inline void
657nl_dump_check_consistent(struct netlink_callback *cb,
658 struct nlmsghdr *nlh)
659{
660 if (cb->prev_seq && cb->seq != cb->prev_seq)
661 nlh->nlmsg_flags |= NLM_F_DUMP_INTR;
662 cb->prev_seq = cb->seq;
663}
664
641/************************************************************************** 665/**************************************************************************
642 * Netlink Attributes 666 * Netlink Attributes
643 **************************************************************************/ 667 **************************************************************************/