Module Name: src
Committed By: maya
Date: Sat Dec 10 23:03:27 UTC 2016
Modified Files:
src/sys/dev/raidframe: rf_driver.c rf_general.h
Log Message:
raidframe: use existing routines to print an error and panic.
fixes the i386 ALL build with clang which complained about the
format string not being a string literal, and lets us get rid of
rf_panicbuf.
note: kern_assert is not KASSERT. it should panic as long as the
string is not NULL.
No functional change intended.
To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/dev/raidframe/rf_driver.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/raidframe/rf_general.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/raidframe/rf_driver.c
diff -u src/sys/dev/raidframe/rf_driver.c:1.132 src/sys/dev/raidframe/rf_driver.c:1.133
--- src/sys/dev/raidframe/rf_driver.c:1.132 Sat Dec 26 00:58:45 2015
+++ src/sys/dev/raidframe/rf_driver.c Sat Dec 10 23:03:27 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_driver.c,v 1.132 2015/12/26 00:58:45 pgoyette Exp $ */
+/* $NetBSD: rf_driver.c,v 1.133 2016/12/10 23:03:27 maya Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -66,7 +66,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.132 2015/12/26 00:58:45 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.133 2016/12/10 23:03:27 maya Exp $");
#ifdef _KERNEL_OPT
#include "opt_raid_diagnostic.h"
@@ -121,9 +121,6 @@ __KERNEL_RCSID(0, "$NetBSD: rf_driver.c,
#define RF_MAX_FREE_RAD 128
#define RF_MIN_FREE_RAD 32
-/* debug variables */
-char rf_panicbuf[2048]; /* a buffer to hold an error msg when we panic */
-
/* main configuration routines */
static int raidframe_booted = 0;
@@ -888,17 +885,15 @@ rf_ConfigureDebug(RF_Config_t *cfgPtr)
void
rf_print_panic_message(int line, const char *file)
{
- snprintf(rf_panicbuf, sizeof(rf_panicbuf),
- "raidframe error at line %d file %s", line, file);
+ kern_assert("raidframe error at line %d file %s", line, file);
}
#ifdef RAID_DIAGNOSTIC
void
rf_print_assert_panic_message(int line, const char *file, const char *condition)
{
- snprintf(rf_panicbuf, sizeof(rf_panicbuf),
- "raidframe error at line %d file %s (failed asserting %s)\n",
- line, file, condition);
+ kern_assert("raidframe error at line %d file %s (failed asserting %s)\n",
+ line, file, condition);
}
#endif
Index: src/sys/dev/raidframe/rf_general.h
diff -u src/sys/dev/raidframe/rf_general.h:1.21 src/sys/dev/raidframe/rf_general.h:1.22
--- src/sys/dev/raidframe/rf_general.h:1.21 Tue Mar 25 16:19:14 2014
+++ src/sys/dev/raidframe/rf_general.h Sat Dec 10 23:03:27 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_general.h,v 1.21 2014/03/25 16:19:14 christos Exp $ */
+/* $NetBSD: rf_general.h,v 1.22 2016/12/10 23:03:27 maya Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -54,14 +54,12 @@ void rf_print_unable_to_init_mutex(const
void rf_print_unable_to_add_shutdown(const char *, int, int);
-extern char rf_panicbuf[];
-#define RF_PANIC() {rf_print_panic_message(__LINE__,__FILE__); panic("%s", rf_panicbuf);}
+#define RF_PANIC() {rf_print_panic_message(__LINE__,__FILE__);}
#if defined(RAID_DIAGNOSTIC) || defined(__COVERITY__)
#define RF_ASSERT(_x_) { \
if (!(_x_)) { \
rf_print_assert_panic_message(__LINE__, __FILE__, #_x_); \
- panic(rf_panicbuf); \
} \
}
#else /* RAID_DIAGNOSTIC */