summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2016-02-17 17:16:02 +0000
committerimp <imp@FreeBSD.org>2016-02-17 17:16:02 +0000
commit0bfb5dbc867a4ef73b0b2259adfd285a1cbaf5d2 (patch)
tree9d0b9ff9938b0c9fa10bfca4675a8a542491fbe6 /sys/dev
parenta8f5ecad19b5c936057dbbcda2353b9ca84b09f5 (diff)
downloadFreeBSD-src-0bfb5dbc867a4ef73b0b2259adfd285a1cbaf5d2.zip
FreeBSD-src-0bfb5dbc867a4ef73b0b2259adfd285a1cbaf5d2.tar.gz
Create an API to reset a struct bio (g_reset_bio). This is mandatory
for all struct bio you get back from g_{new,alloc}_bio. Temporary bios that you create on the stack or elsewhere should use this before first use of the bio, and between uses of the bio. At the moment, it is nothing more than a wrapper around bzero, but that may change in the future. The wrapper also removes one place where we encode the size of struct bio in the KBI.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/mmc/mmcsd.c3
-rw-r--r--sys/dev/virtio/block/virtio_blk.c7
2 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/mmc/mmcsd.c b/sys/dev/mmc/mmcsd.c
index 4ca0c24..7749123 100644
--- a/sys/dev/mmc/mmcsd.c
+++ b/sys/dev/mmc/mmcsd.c
@@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$");
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/time.h>
+#include <geom/geom.h>
#include <geom/geom_disk.h>
#include <dev/mmc/mmcbrvar.h>
@@ -487,7 +488,7 @@ mmcsd_dump(void *arg, void *virtual, vm_offset_t physical,
if (!length)
return (0);
- bzero(&bp, sizeof(struct bio));
+ g_reset_bio(&bp);
bp.bio_disk = disk;
bp.bio_pblkno = offset / disk->d_sectorsize;
bp.bio_bcount = length;
diff --git a/sys/dev/virtio/block/virtio_blk.c b/sys/dev/virtio/block/virtio_blk.c
index 0cfebf1..7b27364 100644
--- a/sys/dev/virtio/block/virtio_blk.c
+++ b/sys/dev/virtio/block/virtio_blk.c
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <sys/queue.h>
+#include <geom/geom.h>
#include <geom/geom_disk.h>
#include <machine/bus.h>
@@ -1146,7 +1147,7 @@ vtblk_ident(struct vtblk_softc *sc)
req->vbr_hdr.sector = 0;
req->vbr_bp = &buf;
- bzero(&buf, sizeof(struct bio));
+ g_reset_bio(&buf);
buf.bio_cmd = BIO_READ;
buf.bio_data = dp->d_ident;
@@ -1278,7 +1279,7 @@ vtblk_dump_write(struct vtblk_softc *sc, void *virtual, off_t offset,
req->vbr_hdr.sector = offset / 512;
req->vbr_bp = &buf;
- bzero(&buf, sizeof(struct bio));
+ g_reset_bio(&buf);
buf.bio_cmd = BIO_WRITE;
buf.bio_data = virtual;
@@ -1300,7 +1301,7 @@ vtblk_dump_flush(struct vtblk_softc *sc)
req->vbr_hdr.sector = 0;
req->vbr_bp = &buf;
- bzero(&buf, sizeof(struct bio));
+ g_reset_bio(&buf);
buf.bio_cmd = BIO_FLUSH;
OpenPOWER on IntegriCloud