diff options
author | phk <phk@FreeBSD.org> | 2002-09-30 08:50:47 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-09-30 08:50:47 +0000 |
commit | 72d7c1eb0e7571a3a567c7dcb80c59931eb6545d (patch) | |
tree | d7ee337d23238a2a60b354aee0dfdc02bea553f8 | |
parent | a2bc7673e2e0e78b7bc4be238831aab34d99f57b (diff) | |
download | FreeBSD-src-72d7c1eb0e7571a3a567c7dcb80c59931eb6545d.zip FreeBSD-src-72d7c1eb0e7571a3a567c7dcb80c59931eb6545d.tar.gz |
Introduce g_write_data() function.
Sponsored by: DARPA & NAI Labs
-rw-r--r-- | sys/geom/geom.h | 1 | ||||
-rw-r--r-- | sys/geom/geom_io.c | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/sys/geom/geom.h b/sys/geom/geom.h index 493221b..36acaf5 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -222,6 +222,7 @@ void g_io_request(struct bio *bp, struct g_consumer *cp); int g_io_setattr(const char *attr, struct g_consumer *cp, int len, void *ptr); struct bio *g_new_bio(void); void * g_read_data(struct g_consumer *cp, off_t offset, off_t length, int *error); +int g_write_data(struct g_consumer *cp, off_t offset, void *ptr, off_t length); /* geom_kern.c / geom_kernsim.c */ diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index 7d7eed1..f86c5e2 100644 --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -387,3 +387,21 @@ g_read_data(struct g_consumer *cp, off_t offset, off_t length, int *error) } while (errorc == EBUSY); return (ptr); } + +int +g_write_data(struct g_consumer *cp, off_t offset, void *ptr, off_t length) +{ + struct bio *bp; + int error; + + bp = g_new_bio(); + bp->bio_cmd = BIO_WRITE; + bp->bio_done = NULL; + bp->bio_offset = offset; + bp->bio_length = length; + bp->bio_data = ptr; + g_io_request(bp, cp); + error = biowait(bp, "gwrite"); + g_destroy_bio(bp); + return (error); +} |