svn commit: r347393 - in head/stand: common i386/libi386

Toomas Soome tsoome at FreeBSD.org
Thu May 9 13:12:45 UTC 2019


Author: tsoome
Date: Thu May  9 13:12:43 2019
New Revision: 347393
URL: https://svnweb.freebsd.org/changeset/base/347393

Log:
  loader: use DPRINTF in biosdisk.c and define safe DPRINTF
  
  r345066 did miss biosdisk.c.
  
  Also define DPRINTF as ((void)0) for case we do not want debug printouts.
  
  MFC after:	1 week

Modified:
  head/stand/common/disk.c
  head/stand/common/interp_forth.c
  head/stand/common/part.c
  head/stand/i386/libi386/biosdisk.c

Modified: head/stand/common/disk.c
==============================================================================
--- head/stand/common/disk.c	Thu May  9 12:58:33 2019	(r347392)
+++ head/stand/common/disk.c	Thu May  9 13:12:43 2019	(r347393)
@@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
 #ifdef DISK_DEBUG
 # define DPRINTF(fmt, args...)	printf("%s: " fmt "\n" , __func__ , ## args)
 #else
-# define DPRINTF(fmt, args...)
+# define DPRINTF(fmt, args...)	((void)0)
 #endif
 
 struct open_disk {

Modified: head/stand/common/interp_forth.c
==============================================================================
--- head/stand/common/interp_forth.c	Thu May  9 12:58:33 2019	(r347392)
+++ head/stand/common/interp_forth.c	Thu May  9 13:12:43 2019	(r347393)
@@ -41,7 +41,7 @@ INTERP_DEFINE("4th");
 #ifdef BFORTH_DEBUG
 #define	DPRINTF(fmt, args...)	printf("%s: " fmt "\n" , __func__ , ## args)
 #else
-#define	DPRINTF(fmt, args...)
+#define	DPRINTF(fmt, args...)	((void)0)
 #endif
 
 /*

Modified: head/stand/common/part.c
==============================================================================
--- head/stand/common/part.c	Thu May  9 12:58:33 2019	(r347392)
+++ head/stand/common/part.c	Thu May  9 13:12:43 2019	(r347393)
@@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
 #ifdef PART_DEBUG
 #define	DPRINTF(fmt, args...) printf("%s: " fmt "\n", __func__, ## args)
 #else
-#define	DPRINTF(fmt, args...)
+#define	DPRINTF(fmt, args...)	((void)0)
 #endif
 
 #ifdef LOADER_GPT_SUPPORT

Modified: head/stand/i386/libi386/biosdisk.c
==============================================================================
--- head/stand/i386/libi386/biosdisk.c	Thu May  9 12:58:33 2019	(r347392)
+++ head/stand/i386/libi386/biosdisk.c	Thu May  9 13:12:43 2019	(r347393)
@@ -65,9 +65,9 @@ __FBSDID("$FreeBSD$");
 #define	CDMAJOR		15
 
 #ifdef DISK_DEBUG
-#define	DEBUG(fmt, args...)	printf("%s: " fmt "\n", __func__, ## args)
+#define	DPRINTF(fmt, args...)	printf("%s: " fmt "\n", __func__, ## args)
 #else
-#define	DEBUG(fmt, args...)
+#define	DPRINTF(fmt, args...)	((void)0)
 #endif
 
 struct specification_packet {
@@ -218,12 +218,12 @@ bd_bios2unit(int biosdev)
 	bdinfo_t *bd;
 	int i, unit;
 
-	DEBUG("looking for bios device 0x%x", biosdev);
+	DPRINTF("looking for bios device 0x%x", biosdev);
 	for (i = 0; bdi[i] != NULL; i++) {
 		unit = 0;
 		STAILQ_FOREACH(bd, bdi[i], bd_link) {
 			if (bd->bd_unit == biosdev) {
-				DEBUG("bd unit %d is BIOS device 0x%x", unit,
+				DPRINTF("bd unit %d is BIOS device 0x%x", unit,
 				    bd->bd_unit);
 				return (unit);
 			}
@@ -620,7 +620,7 @@ bd_int13probe(bdinfo_t *bd)
 	if (bd->bd_sectors == 0)
 		bd->bd_sectors = (uint64_t)bd->bd_cyl * bd->bd_hds * bd->bd_sec;
 
-	DEBUG("unit 0x%x geometry %d/%d/%d\n", bd->bd_unit, bd->bd_cyl,
+	DPRINTF("unit 0x%x geometry %d/%d/%d\n", bd->bd_unit, bd->bd_cyl,
 	    bd->bd_hds, bd->bd_sec);
 
 	return (true);
@@ -919,7 +919,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s
 		return (EIO);
 	}
 
-	DEBUG("open_disk %p", dev);
+	DPRINTF("open_disk %p", dev);
 
 	offset = dblk * BIOSDISK_SECSIZE;
 	dblk = offset / bd->bd_sectorsize;
@@ -932,7 +932,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s
 	 * while translating block count to bytes.
 	 */
 	if (size > INT_MAX) {
-		DEBUG("too large I/O: %zu bytes", size);
+		DPRINTF("too large I/O: %zu bytes", size);
 		return (EIO);
 	}
 
@@ -972,7 +972,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s
 	if (dblk + blks >= d_offset + disk_blocks) {
 		blks = d_offset + disk_blocks - dblk;
 		size = blks * bd->bd_sectorsize;
-		DEBUG("short I/O %d", blks);
+		DPRINTF("short I/O %d", blks);
 	}
 
 	bio_size = min(BIO_BUFFER_SIZE, size);
@@ -997,7 +997,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s
 
 		switch (rw & F_MASK) {
 		case F_READ:
-			DEBUG("read %d from %lld to %p", x, dblk, buf);
+			DPRINTF("read %d from %lld to %p", x, dblk, buf);
 			bsize = bd->bd_sectorsize * x - blkoff;
 			if (rest < bsize)
 				bsize = rest;
@@ -1010,7 +1010,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s
 			bcopy(bbuf + blkoff, buf, bsize);
 			break;
 		case F_WRITE :
-			DEBUG("write %d from %lld to %p", x, dblk, buf);
+			DPRINTF("write %d from %lld to %p", x, dblk, buf);
 			if (blkoff != 0) {
 				/*
 				 * We got offset to sector, read 1 sector to
@@ -1259,7 +1259,7 @@ bd_getdev(struct i386_devdesc *d)
 		return (-1);
 
 	biosdev = bd_unit2bios(d);
-	DEBUG("unit %d BIOS device %d", dev->dd.d_unit, biosdev);
+	DPRINTF("unit %d BIOS device %d", dev->dd.d_unit, biosdev);
 	if (biosdev == -1)			/* not a BIOS device */
 		return (-1);
 
@@ -1312,6 +1312,6 @@ bd_getdev(struct i386_devdesc *d)
 	}
 
 	rootdev = MAKEBOOTDEV(major, slice, unit, partition);
-	DEBUG("dev is 0x%x\n", rootdev);
+	DPRINTF("dev is 0x%x\n", rootdev);
 	return (rootdev);
 }


More information about the svn-src-head mailing list