1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-15 15:06:42 +00:00

Introduce g_write_data() function.

Sponsored by:	DARPA & NAI Labs
This commit is contained in:
Poul-Henning Kamp 2002-09-30 08:50:47 +00:00
parent 5b3317e9e6
commit 90b1cd5615
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=104194
2 changed files with 19 additions and 0 deletions

View File

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

View File

@ -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);
}