diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2014-01-22 05:11:37 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2014-01-22 05:11:37 +0000 |
commit | d1a968fbe74fd6fc3709024cb8e1249e4df1fc04 (patch) | |
tree | 49526b280b17c337e273a68b85e15e12603b7cb8 /sys/dev | |
parent | 25d444466a2b1951f2441ec786d421753acf3aed (diff) |
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.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/softraid.c | 22 | ||||
-rw-r--r-- | sys/dev/softraid_raid5.c | 23 | ||||
-rw-r--r-- | sys/dev/softraid_raid6.c | 3 | ||||
-rw-r--r-- | sys/dev/softraidvar.h | 3 |
4 files changed, 25 insertions, 26 deletions
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 <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -4916,6 +4916,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) { int i; diff --git a/sys/dev/softraid_raid5.c b/sys/dev/softraid_raid5.c index fcfc1c33e90..adad3cd64ca 100644 --- a/sys/dev/softraid_raid5.c +++ b/sys/dev/softraid_raid5.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raid5.c,v 1.10 2014/01/22 04:47:15 jsing Exp $ */ +/* $OpenBSD: softraid_raid5.c,v 1.11 2014/01/22 05:11:36 jsing Exp $ */ /* * Copyright (c) 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2009 Jordan Hargrave <jordan@openbsd.org> @@ -67,7 +67,6 @@ int sr_raid5_write(struct sr_workunit *, struct sr_workunit *, int, int, daddr_t, daddr_t, void *, int, int); void sr_raid5_xor(void *, void *, int); -void sr_dump(void *, int); void sr_raid5_scrub(struct sr_discipline *); /* discipline initialisation. */ @@ -751,26 +750,6 @@ sr_raid5_addio(struct sr_workunit *wu, int chunk, daddr_t blkno, } void -sr_dump(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_raid5_xor(void *a, void *b, int len) { uint32_t *xa = a, *xb = b; diff --git a/sys/dev/softraid_raid6.c b/sys/dev/softraid_raid6.c index 187f7ec23f4..ba84873e757 100644 --- a/sys/dev/softraid_raid6.c +++ b/sys/dev/softraid_raid6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid_raid6.c,v 1.60 2014/01/22 04:24:29 jsing Exp $ */ +/* $OpenBSD: softraid_raid6.c,v 1.61 2014/01/22 05:11:36 jsing Exp $ */ /* * Copyright (c) 2009 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2009 Jordan Hargrave <jordan@openbsd.org> @@ -66,7 +66,6 @@ void sr_raid6_xorp(void *, void *, int); void sr_raid6_xorq(void *, void *, int, int); int sr_raid6_addio(struct sr_workunit *wu, int, daddr_t, daddr_t, void *, int, int, void *, void *, int); -void sr_dump(void *, int); void sr_raid6_scrub(struct sr_discipline *); int sr_failio(struct sr_workunit *); diff --git a/sys/dev/softraidvar.h b/sys/dev/softraidvar.h index eb0044f63be..5f7d31c60d3 100644 --- a/sys/dev/softraidvar.h +++ b/sys/dev/softraidvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: softraidvar.h,v 1.151 2014/01/22 04:24:29 jsing Exp $ */ +/* $OpenBSD: softraidvar.h,v 1.152 2014/01/22 05:11:36 jsing Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us> * Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org> @@ -730,6 +730,7 @@ struct sr_chunk * sr_crypto_create_key_disk(struct sr_discipline *, dev_t); struct sr_chunk * sr_crypto_read_key_disk(struct sr_discipline *, dev_t); #ifdef SR_DEBUG +void sr_dump_block(void *, int); void sr_dump_mem(u_int8_t *, int); #endif |