git: 4f02a4f48c08 - main - linux(4): Add LINUX_RATELIMIT_MSG_OPT2 for future use

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Sat, 28 May 2022 20:53:28 UTC
The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=4f02a4f48c080ad56f0d7c745ace4d2f7dacf928

commit 4f02a4f48c080ad56f0d7c745ace4d2f7dacf928
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2022-05-28 20:47:23 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-05-28 20:47:23 +0000

    linux(4): Add LINUX_RATELIMIT_MSG_OPT2 for future use
    
    MFC after:              2 weeks
---
 sys/compat/linux/linux_util.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sys/compat/linux/linux_util.h b/sys/compat/linux/linux_util.h
index a29ba0bc4af1..6f7b55be8123 100644
--- a/sys/compat/linux/linux_util.h
+++ b/sys/compat/linux/linux_util.h
@@ -198,4 +198,16 @@ bool	linux_use_real_ifname(const struct ifnet *ifp);
 		}						\
 	} while (0)
 
+#define LINUX_RATELIMIT_MSG_OPT2(_message, _opt1, _opt2)	\
+	do {							\
+		static int seen = 0;				\
+								\
+		if (seen == 0) {				\
+			linux_msg(curthread, _message, _opt1, _opt2); \
+								\
+			if (linux_debug < 3)			\
+				seen = 1;			\
+		}						\
+	} while (0)
+
 #endif /* ! _LINUX_UTIL_H_ */