diff options
author | James Morris <james.l.morris@oracle.com> | 2014-09-22 22:54:56 +1000 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2014-09-22 22:54:56 +1000 |
commit | 35e1efd25a9e7d5cf2884fa23441ab87353849bb (patch) | |
tree | aa0e546b39fa4d0a434919ff106721dfc3777a3d /lib | |
parent | 6f98e892884c32b9273ecce1332b849bcad3b8b1 (diff) | |
parent | d1ac5540455c3a2a11e943e19e2dc044cebe147d (diff) |
Merge tag 'keys-next-20140922' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs into next
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hexdump.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/hexdump.c b/lib/hexdump.c index 8499c810909a..270773b91923 100644 --- a/lib/hexdump.c +++ b/lib/hexdump.c @@ -59,6 +59,22 @@ int hex2bin(u8 *dst, const char *src, size_t count) EXPORT_SYMBOL(hex2bin); /** + * bin2hex - convert binary data to an ascii hexadecimal string + * @dst: ascii hexadecimal result + * @src: binary data + * @count: binary data length + */ +char *bin2hex(char *dst, const void *src, size_t count) +{ + const unsigned char *_src = src; + + while (count--) + dst = hex_byte_pack(dst, *_src++); + return dst; +} +EXPORT_SYMBOL(bin2hex); + +/** * hex_dump_to_buffer - convert a blob of data to "hex ASCII" in memory * @buf: data blob to dump * @len: number of bytes in the @buf |