git: 0d77f6c0c350 - main - linux(4): Add LINUX_RATELIMIT_MSG macro for future use.

Dmitry Chagin dchagin at FreeBSD.org
Thu Aug 12 08:56:05 UTC 2021


The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=0d77f6c0c350ae41acc0653a236a76d981773021

commit 0d77f6c0c350ae41acc0653a236a76d981773021
Author:     Dmitry Chagin <dchagin at FreeBSD.org>
AuthorDate: 2021-08-12 08:55:55 +0000
Commit:     Dmitry Chagin <dchagin at FreeBSD.org>
CommitDate: 2021-08-12 08:55:55 +0000

    linux(4): Add LINUX_RATELIMIT_MSG macro for future use.
    
    Differential Revision:  https://reviews.freebsd.org/D31488
    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 26ec8a3d4847..994efa88100f 100644
--- a/sys/compat/linux/linux_util.h
+++ b/sys/compat/linux/linux_util.h
@@ -165,6 +165,18 @@ void	linux_free_get_char_devices(char *string);
 		}					\
 	} while (0)
 
+#define LINUX_RATELIMIT_MSG(_message)				\
+	do {							\
+		static int seen = 0;				\
+								\
+		if (seen == 0) {				\
+			linux_msg(curthread, _message);		\
+								\
+			if (linux_debug < 3)			\
+				seen = 1;			\
+		}						\
+	} while (0)
+
 #define LINUX_RATELIMIT_MSG_OPT1(_message, _opt1)	 	\
 	do {							\
 		static int seen = 0;				\


More information about the dev-commits-src-all mailing list