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
This commit is contained in:
Toomas Soome 2019-05-09 13:12:43 +00:00
parent 56f76a10c6
commit 82c29d4fde
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=347393
4 changed files with 15 additions and 15 deletions

View File

@ -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 {

View File

@ -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
/*

View File

@ -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

View File

@ -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, size_t size,
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, size_t size,
* 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, size_t size,
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, size_t size,
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, size_t size,
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);
}