Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/raidframe raidframe: use existing routines to print ...
details: https://anonhg.NetBSD.org/src/rev/88399a6793f0
branches: trunk
changeset: 349440:88399a6793f0
user: maya <maya%NetBSD.org@localhost>
date: Sat Dec 10 23:03:27 2016 +0000
description:
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.
diffstat:
sys/dev/raidframe/rf_driver.c | 15 +++++----------
sys/dev/raidframe/rf_general.h | 6 ++----
2 files changed, 7 insertions(+), 14 deletions(-)
diffs (74 lines):
diff -r d34fd7a07eac -r 88399a6793f0 sys/dev/raidframe/rf_driver.c
--- a/sys/dev/raidframe/rf_driver.c Sat Dec 10 23:03:22 2016 +0000
+++ b/sys/dev/raidframe/rf_driver.c Sat Dec 10 23:03:27 2016 +0000
@@ -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 @@
#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 @@
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
diff -r d34fd7a07eac -r 88399a6793f0 sys/dev/raidframe/rf_general.h
--- a/sys/dev/raidframe/rf_general.h Sat Dec 10 23:03:22 2016 +0000
+++ b/sys/dev/raidframe/rf_general.h Sat Dec 10 23:03:27 2016 +0000
@@ -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_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 */
Home |
Main Index |
Thread Index |
Old Index