From b7a93be7b7e5ff830b7cc47099b423dc583797c2 Mon Sep 17 00:00:00 2001 From: maya Date: Sat, 10 Dec 2016 23:03:27 +0000 Subject: 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. --- sys/dev/raidframe/rf_driver.c | 15 +++++---------- sys/dev/raidframe/rf_general.h | 6 ++---- 2 files changed, 7 insertions(+), 14 deletions(-) (limited to 'sys/dev/raidframe') diff --git a/sys/dev/raidframe/rf_driver.c b/sys/dev/raidframe/rf_driver.c index 5f795cb8947..77bdec0c566 100644 --- a/sys/dev/raidframe/rf_driver.c +++ b/sys/dev/raidframe/rf_driver.c @@ -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 -__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,v 1.132 2015/12/26 00:58:45 pgoyette Exp #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 diff --git a/sys/dev/raidframe/rf_general.h b/sys/dev/raidframe/rf_general.h index baf9437d06f..ca307cd61a1 100644 --- a/sys/dev/raidframe/rf_general.h +++ b/sys/dev/raidframe/rf_general.h @@ -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 char *, int, int); 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 */ -- cgit