| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /** |
|---|
| 2 | 3 | * eCryptfs: Linux filesystem encryption layer |
|---|
| 3 | 4 | * Functions only useful for debugging. |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright (C) 2006 International Business Machines Corp. |
|---|
| 6 | 7 | * Author(s): Michael A. Halcrow <mahalcro@us.ibm.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or |
|---|
| 9 | | - * modify it under the terms of the GNU General Public License as |
|---|
| 10 | | - * published by the Free Software Foundation; either version 2 of the |
|---|
| 11 | | - * License, or (at your option) any later version. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 14 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 16 | | - * General Public License for more details. |
|---|
| 17 | | - * |
|---|
| 18 | | - * You should have received a copy of the GNU General Public License |
|---|
| 19 | | - * along with this program; if not, write to the Free Software |
|---|
| 20 | | - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
|---|
| 21 | | - * 02111-1307, USA. |
|---|
| 22 | 8 | */ |
|---|
| 23 | 9 | |
|---|
| 24 | 10 | #include "ecryptfs_kernel.h" |
|---|
| .. | .. |
|---|
| 97 | 83 | */ |
|---|
| 98 | 84 | void ecryptfs_dump_hex(char *data, int bytes) |
|---|
| 99 | 85 | { |
|---|
| 100 | | - int i = 0; |
|---|
| 101 | | - int add_newline = 1; |
|---|
| 102 | | - |
|---|
| 103 | 86 | if (ecryptfs_verbosity < 1) |
|---|
| 104 | 87 | return; |
|---|
| 105 | | - if (bytes != 0) { |
|---|
| 106 | | - printk(KERN_DEBUG "0x%.2x.", (unsigned char)data[i]); |
|---|
| 107 | | - i++; |
|---|
| 108 | | - } |
|---|
| 109 | | - while (i < bytes) { |
|---|
| 110 | | - printk("0x%.2x.", (unsigned char)data[i]); |
|---|
| 111 | | - i++; |
|---|
| 112 | | - if (i % 16 == 0) { |
|---|
| 113 | | - printk("\n"); |
|---|
| 114 | | - add_newline = 0; |
|---|
| 115 | | - } else |
|---|
| 116 | | - add_newline = 1; |
|---|
| 117 | | - } |
|---|
| 118 | | - if (add_newline) |
|---|
| 119 | | - printk("\n"); |
|---|
| 120 | | -} |
|---|
| 121 | 88 | |
|---|
| 89 | + print_hex_dump(KERN_DEBUG, "ecryptfs: ", DUMP_PREFIX_OFFSET, 16, 1, |
|---|
| 90 | + data, bytes, false); |
|---|
| 91 | +} |
|---|