Skip to content

Commit

Permalink
ecryptfs: use print_hex_dump_bytes for hexdump
Browse files Browse the repository at this point in the history
The Kernel has nice hexdump facilities, use them rather a homebrew
hexdump function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
  • Loading branch information
Sascha Hauer authored and Tyler Hicks committed Jun 19, 2019
1 parent d43388d commit 96827c3
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions fs/ecryptfs/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,25 +97,9 @@ void ecryptfs_dump_auth_tok(struct ecryptfs_auth_tok *auth_tok)
*/
void ecryptfs_dump_hex(char *data, int bytes)
{
int i = 0;
int add_newline = 1;

if (ecryptfs_verbosity < 1)
return;
if (bytes != 0) {
printk(KERN_DEBUG "0x%.2x.", (unsigned char)data[i]);
i++;
}
while (i < bytes) {
printk("0x%.2x.", (unsigned char)data[i]);
i++;
if (i % 16 == 0) {
printk("\n");
add_newline = 0;
} else
add_newline = 1;
}
if (add_newline)
printk("\n");
}

print_hex_dump(KERN_DEBUG, "ecryptfs: ", DUMP_PREFIX_OFFSET, 16, 1,
data, bytes, false);
}

0 comments on commit 96827c3

Please sign in to comment.