aboutsummaryrefslogtreecommitdiffstats
path: root/memdisk
diff options
context:
space:
mode:
authorShao Miller <shao.miller@yrdsb.edu.on.ca>2011-01-24 21:47:43 -0500
committerShao Miller <shao.miller@yrdsb.edu.on.ca>2011-01-24 21:48:04 -0500
commit13101c28a48c226bdb25b27278014e84ee9f0874 (patch)
tree26362444401a2a57e2040df80dbbb4d2f01603cb /memdisk
parent808d43ea43c9df30a0a6922ef4cb4678634d41ab (diff)
downloadsyslinux-13101c28a48c226bdb25b27278014e84ee9f0874.tar.gz
syslinux-13101c28a48c226bdb25b27278014e84ee9f0874.tar.xz
syslinux-13101c28a48c226bdb25b27278014e84ee9f0874.zip
memdisk: Make debug-mode a tad prettier
By removing the use of #ifdef-#endif blocks. Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
Diffstat (limited to 'memdisk')
-rw-r--r--memdisk/dskprobe.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/memdisk/dskprobe.c b/memdisk/dskprobe.c
index de858bb9..5c9d6013 100644
--- a/memdisk/dskprobe.c
+++ b/memdisk/dskprobe.c
@@ -16,17 +16,23 @@
* Routines for probing BIOS disk drives
*/
-/*
- * Uncomment for debugging
- *
- * #define DBG_DSKPROBE 1
- */
+/* Change to 1 for debugging */
+#define DBG_DSKPROBE 0
#include <stdint.h>
#include "memdisk.h"
#include "bda.h"
#include "conio.h"
+/* Function type for printf() */
+typedef int (f_printf) (const char *, ...);
+
+/* Dummy printf() that does nothing */
+static f_printf no_printf;
+static f_printf *dskprobe_printfs[] = { no_printf, printf };
+
+#define dskprobe_printf (dskprobe_printfs[DBG_DSKPROBE])
+
/*
* We will probe a BIOS drive numer using INT 13h, AH=probe
* and will pass along that call's success or failure
@@ -43,9 +49,8 @@ int probe_int13_ah(uint8_t drive, uint8_t probe)
intcall(0x13, &regs, &regs);
err = !(regs.eflags.l & 1);
-#ifdef DBG_DSKPROBE
- printf("probe_int13_ah(0x%02x, 0x%02x) == %d\n", drive, probe, err);
-#endif
+ dskprobe_printf("probe_int13_ah(0x%02x, 0x%02x) == %d\n", drive, probe,
+ err);
return err;
}
@@ -72,10 +77,8 @@ int probe_bda_drive(uint8_t drive)
bios_drives = 0;
}
err = (drive - (drive & 0x80)) >= bios_drives ? 0 : 1;
-#ifdef DBG_DSKPROBE
- printf("probe_bda_drive(0x%02x) == %d, count: %d\n",
- drive, err, bios_drives);
-#endif
+ dskprobe_printf("probe_bda_drive(0x%02x) == %d, count: %d\n", drive, err,
+ bios_drives);
return err;
}
@@ -112,3 +115,10 @@ uint8_t probe_drive_range(uint8_t start)
}
return drive;
}
+
+/* Dummy printf() that does nothing */
+static int no_printf(const char *ignored, ...)
+{
+ (void)ignored;
+ return 0;
+}