summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authoroster <oster@NetBSD.org>2000-12-15 02:12:58 +0000
committeroster <oster@NetBSD.org>2000-12-15 02:12:58 +0000
commitb36a1a085ecd4fe59f28ed8a8d6836b9e1be7fdd (patch)
tree4753b2da5c255535b537b73c3ec1551fc9a89c66 /sys/dev
parent2c482e17b7fdadedf162137c90d45bccbe280412 (diff)
For the RF_ASSERT() and RF_PANIC() macros, call a function to do the
sprintf, instead of doing the sprintf in the macros. This means just 1 copy of each of the error messages, chopping about about 16K off the size of an i386 kernel. Thanks to Simon Burge and Enami Tsugutomo for providing the inspiration to do this.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/raidframe/rf_driver.c23
-rw-r--r--sys/dev/raidframe/rf_general.h11
2 files changed, 28 insertions, 6 deletions
diff --git a/sys/dev/raidframe/rf_driver.c b/sys/dev/raidframe/rf_driver.c
index 39c86da81ee..d0e92a861b6 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.38 2000/09/21 01:45:46 oster Exp $ */
+/* $NetBSD: rf_driver.c,v 1.39 2000/12/15 02:12:58 oster Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -995,3 +995,24 @@ rf_PrintUserStats(RF_Raid_t * raidPtr)
printf("Average access size (sect): %ld\n", RF_DB0_CHECK(raidPtr->userstats.num_sect_moved, raidPtr->userstats.num_ios));
printf("Achieved data rate: %ld.%ld MB/sec\n", mbs, mbs_frac);
}
+
+
+void
+rf_print_panic_message(line,file)
+ int line;
+ char *file;
+{
+ sprintf(rf_panicbuf,"raidframe error at line %d file %s",
+ line, file);
+}
+
+void
+rf_print_assert_panic_message(line,file,condition)
+ int line;
+ char *file;
+ char *condition;
+{
+ sprintf(rf_panicbuf,
+ "raidframe error at line %d file %s (failed asserting %s)\n",
+ line, file, condition);
+}
diff --git a/sys/dev/raidframe/rf_general.h b/sys/dev/raidframe/rf_general.h
index 088ddd92d13..e12a26b0a88 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.5 2000/03/03 02:04:48 oster Exp $ */
+/* $NetBSD: rf_general.h,v 1.6 2000/12/15 02:12:58 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -46,8 +46,11 @@
#define RF_ERRORMSG2(s,a,b) printf((s),(a),(b))
#define RF_ERRORMSG3(s,a,b,c) printf((s),(a),(b),(c))
+void rf_print_panic_message(int, char *);
+void rf_print_assert_panic_message(int, char *, char *);
+
extern char rf_panicbuf[];
-#define RF_PANIC() {sprintf(rf_panicbuf,"raidframe error at line %d file %s",__LINE__,__FILE__); panic(rf_panicbuf);}
+#define RF_PANIC() {rf_print_panic_message(__LINE__,__FILE__); panic(rf_panicbuf);}
#ifdef _KERNEL
#ifdef RF_ASSERT
@@ -56,9 +59,7 @@ extern char rf_panicbuf[];
#ifndef NOASSERT
#define RF_ASSERT(_x_) { \
if (!(_x_)) { \
- sprintf(rf_panicbuf, \
- "raidframe error at line %d file %s (failed asserting %s)\n", \
- __LINE__, __FILE__, #_x_); \
+ rf_print_assert_panic_message(__LINE__, __FILE__, #_x_); \
panic(rf_panicbuf); \
} \
}