Index: geom.h =================================================================== RCS file: /private/FreeBSD/src/sys/geom/geom.h,v retrieving revision 1.77 diff -u -p -r1.77 geom.h --- geom.h 10 Feb 2004 15:53:28 -0000 1.77 +++ geom.h 11 Feb 2004 08:48:52 -0000 @@ -230,6 +230,7 @@ void g_io_request(struct bio *bp, struct 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); +void g_print_bio(struct bio *bp); /* geom_kern.c / geom_kernsim.c */ Index: geom_io.c =================================================================== RCS file: /private/FreeBSD/src/sys/geom/geom_io.c,v retrieving revision 1.52 diff -u -p -r1.52 geom_io.c --- geom_io.c 28 Jan 2004 08:39:18 -0000 1.52 +++ geom_io.c 11 Feb 2004 08:49:30 -0000 @@ -457,3 +457,38 @@ g_write_data(struct g_consumer *cp, off_ g_destroy_bio(bp); return (error); } + +void +g_print_bio(struct bio *bp) +{ + const char *pname; + const char *cmd = NULL; + + if (bp->bio_to != NULL) + pname = bp->bio_to->name; + else + pname = "[unknown]"; + + switch (bp->bio_cmd) { + case BIO_GETATTR: + cmd = "GETATTR"; + printf("%s[%s(attr=%s)]", pname, cmd, bp->bio_attribute); + return; + case BIO_READ: + cmd = "READ"; + case BIO_WRITE: + if (cmd == NULL) + cmd = "WRITE"; + case BIO_DELETE: + if (cmd == NULL) + cmd = "DELETE"; + printf("%s[%s(offset=%jd, length=%jd)]", pname, cmd, + (intmax_t)bp->bio_offset, (intmax_t)bp->bio_length); + return; + default: + cmd = "UNKNOWN"; + printf("%s[%s()]", pname, cmd); + return; + } + /* NOTREACHED */ +}