svn commit: r337881 - head/stand/i386/libi386
Toomas Soome
tsoome at FreeBSD.org
Wed Aug 15 22:40:10 UTC 2018
Author: tsoome
Date: Wed Aug 15 22:40:09 2018
New Revision: 337881
URL: https://svnweb.freebsd.org/changeset/base/337881
Log:
libi386: use BD_RD and BR_WR constants
Use BD_RD and BD_WR instead of 0 and 1.
Reported by: ian
Modified:
head/stand/i386/libi386/biosdisk.c
Modified: head/stand/i386/libi386/biosdisk.c
==============================================================================
--- head/stand/i386/libi386/biosdisk.c Wed Aug 15 22:32:55 2018 (r337880)
+++ head/stand/i386/libi386/biosdisk.c Wed Aug 15 22:40:09 2018 (r337881)
@@ -91,6 +91,8 @@ static struct bdinfo
static int nbdinfo = 0;
#define BD(dev) (bdinfo[(dev)->dd.d_unit])
+#define BD_RD 0
+#define BD_WR 1
static void bd_io_workaround(struct disk_devdesc *dev);
@@ -503,7 +505,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s
case F_READ:
DEBUG("read %d from %lld to %p", blks, dblk, buf);
- if (blks && (rc = bd_io(dev, dblk, blks, buf, 0))) {
+ if (blks && (rc = bd_io(dev, dblk, blks, buf, BD_RD))) {
/* Filter out floppy controller errors */
if (BD(dev).bd_flags != BD_FLOPPY || rc != 0x20) {
printf("read %d from %lld to %p, error: 0x%x\n",
@@ -515,7 +517,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s
case F_WRITE :
DEBUG("write %d from %lld to %p", blks, dblk, buf);
- if (blks && bd_io(dev, dblk, blks, buf, 1)) {
+ if (blks && bd_io(dev, dblk, blks, buf, BD_WR)) {
DEBUG("write error");
return (EIO);
}
@@ -544,7 +546,7 @@ bd_edd_io(struct disk_devdesc *dev, daddr_t dblk, int
v86.ctl = V86_FLAGS;
v86.addr = 0x13;
/* Should we Write with verify ?? 0x4302 ? */
- if (dowrite)
+ if (dowrite == BD_WR)
v86.eax = 0x4300;
else
v86.eax = 0x4200;
@@ -580,7 +582,7 @@ bd_chs_io(struct disk_devdesc *dev, daddr_t dblk, int
v86.ctl = V86_FLAGS;
v86.addr = 0x13;
- if (dowrite)
+ if (dowrite == BD_WR)
v86.eax = 0x300 | blks;
else
v86.eax = 0x200 | blks;
@@ -668,7 +670,7 @@ bd_io(struct disk_devdesc *dev, daddr_t dblk, int blks
* Put your Data In, Put your Data out,
* Put your Data In, and shake it all about
*/
- if (dowrite && bbuf != NULL)
+ if (dowrite == BD_WR && bbuf != NULL)
bcopy(p, bbuf, x * BD(dev).bd_sectorsize);
/*
@@ -693,7 +695,7 @@ bd_io(struct disk_devdesc *dev, daddr_t dblk, int blks
break;
}
- if (dowrite)
+ if (dowrite == BD_WR)
DEBUG("Write %d sector(s) from %p (0x%x) to %lld %s", x,
p, VTOP(p), dblk, result ? "failed" : "ok");
else
@@ -702,7 +704,7 @@ bd_io(struct disk_devdesc *dev, daddr_t dblk, int blks
if (result) {
return (result);
}
- if (!dowrite && bbuf != NULL)
+ if (dowrite == BD_RD && bbuf != NULL)
bcopy(bbuf, p, x * BD(dev).bd_sectorsize);
p += (x * BD(dev).bd_sectorsize);
dblk += x;
More information about the svn-src-all
mailing list