diff options
author | Martin Peschke <mp3@de.ibm.com> | 2008-03-27 09:21:55 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-04-07 13:19:03 -0400 |
commit | c15450e33d198334291d50b5a95337c6b90cdab0 (patch) | |
tree | cabb41b4c3f441beba520aabb4d28007b6c86718 /drivers/s390 | |
parent | d5cdc9898b5589acc77db91a1e9c0feb9f32abef (diff) |
[SCSI] zfcp: Introduce a helper function that dumps hex data to a zfcp trace.
Signed-off-by: Martin Peschke <mp3@de.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c index 701046c9bb33..0faadb0cda24 100644 --- a/drivers/s390/scsi/zfcp_dbf.c +++ b/drivers/s390/scsi/zfcp_dbf.c | |||
@@ -31,6 +31,24 @@ MODULE_PARM_DESC(dbfsize, | |||
31 | 31 | ||
32 | #define ZFCP_LOG_AREA ZFCP_LOG_AREA_OTHER | 32 | #define ZFCP_LOG_AREA ZFCP_LOG_AREA_OTHER |
33 | 33 | ||
34 | static void zfcp_dbf_hexdump(debug_info_t *dbf, void *to, int to_len, | ||
35 | int level, char *from, int from_len) | ||
36 | { | ||
37 | int offset; | ||
38 | struct zfcp_dbf_dump *dump = to; | ||
39 | int room = to_len - sizeof(*dump); | ||
40 | |||
41 | for (offset = 0; offset < from_len; offset += dump->size) { | ||
42 | memset(to, 0, to_len); | ||
43 | strncpy(dump->tag, "dump", ZFCP_DBF_TAG_SIZE); | ||
44 | dump->total_size = from_len; | ||
45 | dump->offset = offset; | ||
46 | dump->size = min(from_len - offset, room); | ||
47 | memcpy(dump->data, from + offset, dump->size); | ||
48 | debug_event(dbf, level, dump, dump->size); | ||
49 | } | ||
50 | } | ||
51 | |||
34 | static int | 52 | static int |
35 | zfcp_dbf_stck(char *out_buf, const char *label, unsigned long long stck) | 53 | zfcp_dbf_stck(char *out_buf, const char *label, unsigned long long stck) |
36 | { | 54 | { |