From f5040c40c737927f7813ace672cb42801e54e13a Mon Sep 17 00:00:00 2001 From: jsing Date: Wed, 22 Jan 2014 05:11:36 +0000 Subject: Move sr_dump from the RAID5 code into shared code. Rename it to sr_dump_block and place it under the debug define in the process. --- sys/dev/softraid.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'sys/dev/softraid.c') diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c index ff717a56ac7..44dacacbcb2 100644 --- a/sys/dev/softraid.c +++ b/sys/dev/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.326 2014/01/22 04:24:29 jsing Exp $ */ +/* $OpenBSD: softraid.c,v 1.327 2014/01/22 05:11:36 jsing Exp $ */ /* * Copyright (c) 2007, 2008, 2009 Marco Peereboom * Copyright (c) 2008 Chris Kuethe @@ -4915,6 +4915,26 @@ sr_meta_print(struct sr_metadata *m) } } +void +sr_dump_block(void *blk, int len) +{ + uint8_t *b = blk; + int i, j, c; + + for (i = 0; i < len; i += 16) { + for (j = 0; j < 16; j++) + printf("%.2x ", b[i + j]); + printf(" "); + for (j = 0; j < 16; j++) { + c = b[i + j]; + if (c < ' ' || c > 'z' || i + j > len) + c = '.'; + printf("%c", c); + } + printf("\n"); + } +} + void sr_dump_mem(u_int8_t *p, int len) { -- cgit v1.2.3-59-g8ed1b