rpms/kernel/F-9 linux-2.6-warn-add-WARN-macro.patch, NONE, 1.1 kernel.spec, 1.779, 1.780

Chuck Ebbert cebbert at fedoraproject.org
Mon Oct 6 14:13:34 UTC 2008


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv22016

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-warn-add-WARN-macro.patch 
Log Message:
Add missing WARN() macro.

linux-2.6-warn-add-WARN-macro.patch:

--- NEW FILE linux-2.6-warn-add-WARN-macro.patch ---
From: Arjan van de Ven <arjan at linux.intel.com>
Date: Fri, 25 Jul 2008 08:45:53 +0000 (-0700)
Subject: Add a WARN() macro; this is WARN_ON() + printk arguments
X-Git-Tag: v2.6.27-rc1~464
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=a8f18b909c0a3f22630846207035c8b84bb252b8

Add a WARN() macro; this is WARN_ON() + printk arguments

Add a WARN() macro that acts like WARN_ON(), with the added feature that it
takes a printk like argument that is printed as part of the warning message.

[akpm at linux-foundation.org: fix printk arguments]
[akpm at linux-foundation.org: coding-style fixes]
Signed-off-by: Arjan van de Ven <arjan at linux.intel.com>
Cc: Greg KH <greg at kroah.com>
Cc: Jiri Slaby <jirislaby at gmail.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 2632328..a346e74 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -34,9 +34,14 @@ struct bug_entry {
 #ifndef __WARN
 #ifndef __ASSEMBLY__
 extern void warn_on_slowpath(const char *file, const int line);
+extern void warn_slowpath(const char *file, const int line,
+		const char *fmt, ...) __attribute__((format(printf, 3, 4)));
 #define WANT_WARN_ON_SLOWPATH
 #endif
 #define __WARN() warn_on_slowpath(__FILE__, __LINE__)
+#define __WARN_printf(arg...) warn_slowpath(__FILE__, __LINE__, arg)
+#else
+#define __WARN_printf(arg...) __WARN()
 #endif
 
 #ifndef WARN_ON
@@ -48,6 +53,15 @@ extern void warn_on_slowpath(const char *file, const int line);
 })
 #endif
 
+#ifndef WARN
+#define WARN(condition, format...) ({						\
+	int __ret_warn_on = !!(condition);				\
+	if (unlikely(__ret_warn_on))					\
+		__WARN_printf(format);					\
+	unlikely(__ret_warn_on);					\
+})
+#endif
+
 #else /* !CONFIG_BUG */
 #ifndef HAVE_ARCH_BUG
 #define BUG()
@@ -63,6 +77,14 @@ extern void warn_on_slowpath(const char *file, const int line);
 	unlikely(__ret_warn_on);					\
 })
 #endif
+
+#ifndef WARN
+#define WARN(condition, format...) ({					\
+	int __ret_warn_on = !!(condition);				\
+	unlikely(__ret_warn_on);					\
+})
+#endif
+
 #endif
 
 #define WARN_ON_ONCE(condition)	({				\
diff --git a/kernel/panic.c b/kernel/panic.c
index 425567f..12c5a0a 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -318,6 +318,28 @@ void warn_on_slowpath(const char *file, int line)
 	add_taint(TAINT_WARN);
 }
 EXPORT_SYMBOL(warn_on_slowpath);
+
+
+void warn_slowpath(const char *file, int line, const char *fmt, ...)
+{
+	va_list args;
+	char function[KSYM_SYMBOL_LEN];
+	unsigned long caller = (unsigned long)__builtin_return_address(0);
+	sprint_symbol(function, caller);
+
+	printk(KERN_WARNING "------------[ cut here ]------------\n");
+	printk(KERN_WARNING "WARNING: at %s:%d %s()\n", file,
+		line, function);
+	va_start(args, fmt);
+	vprintk(fmt, args);
+	va_end(args);
+
+	print_modules();
+	dump_stack();
+	print_oops_end_marker();
+	add_taint(TAINT_WARN);
+}
+EXPORT_SYMBOL(warn_slowpath);
 #endif
 
 #ifdef CONFIG_CC_STACKPROTECTOR


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-9/kernel.spec,v
retrieving revision 1.779
retrieving revision 1.780
diff -u -r1.779 -r1.780
--- kernel.spec	4 Oct 2008 01:35:25 -0000	1.779
+++ kernel.spec	6 Oct 2008 14:13:03 -0000	1.780
@@ -728,7 +728,8 @@
 
 # for kerneloops reports
 Patch2800: linux-2.6-net-print-module-name-as-part-of-the-message.patch
-Patch2801: linux-2.6-warn-Turn-the-netdev-timeout-WARN_ON-into-WARN.patch
+Patch2801: linux-2.6-warn-add-WARN-macro.patch
+Patch2802: linux-2.6-warn-Turn-the-netdev-timeout-WARN_ON-into-WARN.patch
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1334,6 +1335,7 @@
 
 # for kerneloops reports
 ApplyPatch linux-2.6-net-print-module-name-as-part-of-the-message.patch
+ApplyPatch linux-2.6-warn-add-WARN-macro.patch
 ApplyPatch linux-2.6-warn-Turn-the-netdev-timeout-WARN_ON-into-WARN.patch
 
 # END OF PATCH APPLICATIONS
@@ -1925,6 +1927,9 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL}.xen -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.xen.conf %{with_xen} xen
 
 %changelog
+* Mon Oct 06 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.26.5-53
+- Add missing WARN() macro.
+
 * Fri Oct 03 2008 Chuck Ebbert <cebbert at redhat.com> 2.6.26.5-52
 - Disable the snd-aw2 module: it conflicts with video drivers. (#462919)
 




More information about the fedora-extras-commits mailing list