diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2020-05-25 02:04:49 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2020-05-25 02:04:49 +0000 |
commit | 4bc23f0e5eb73d1ea4fc8062da9ad1038a11eca9 (patch) | |
tree | f2dfbb0ef9aeabc52143128bb0703f765e541e88 /sys | |
parent | 010d4f32ab0d2b587ae720290863c7b0b512156c (diff) |
Add support for write operations to diskstrategy().
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/alpha/stand/boot/disk.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/arch/alpha/stand/boot/disk.c b/sys/arch/alpha/stand/boot/disk.c index 6b1cbb79a55..70ef717602f 100644 --- a/sys/arch/alpha/stand/boot/disk.c +++ b/sys/arch/alpha/stand/boot/disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.c,v 1.17 2015/10/01 16:08:19 krw Exp $ */ +/* $OpenBSD: disk.c,v 1.18 2020/05/25 02:04:48 deraadt Exp $ */ /* $NetBSD: disk.c,v 1.6 1997/04/06 08:40:33 cgd Exp $ */ /* @@ -78,10 +78,14 @@ diskstrategy(void *devdata, int rw, daddr32_t bn, size_t reqcnt, void *addrvoid, sc = (struct disk_softc *)devdata; pp = &sc->sc_label.d_partitions[sc->sc_part]; - ret.bits = prom_read(sc->sc_fd, reqcnt, addr, bn + pp->p_offset); + if (rw == F_READ) + ret.bits = prom_read(sc->sc_fd, reqcnt, addr, bn + pp->p_offset); + else + ret.bits = prom_write(sc->sc_fd, reqcnt, addr, bn + pp->p_offset); if (ret.u.status) return (EIO); - *cnt = ret.u.retval; + if (cnt) + *cnt = ret.u.retval; return (0); } |