Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 227784
b: refs/heads/master
c: dc88e46
h: refs/heads/master
v: v3
  • Loading branch information
Mimi Zohar authored and James Morris committed Nov 28, 2010
1 parent 69ff118 commit 1fbe881
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ce6ada35bdf710d16582cc4869c26722547e6f11
refs/heads/master: dc88e46029486ed475c71fe1bb696d39511ac8fe
1 change: 1 addition & 0 deletions trunk/include/linux/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
}

extern int hex_to_bin(char ch);
extern void hex2bin(u8 *dst, const char *src, size_t count);

/*
* General tracing related utility functions - trace_printk(),
Expand Down
16 changes: 16 additions & 0 deletions trunk/lib/hexdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ int hex_to_bin(char ch)
}
EXPORT_SYMBOL(hex_to_bin);

/**
* hex2bin - convert an ascii hexadecimal string to its binary representation
* @dst: binary result
* @src: ascii hexadecimal string
* @count: result length
*/
void hex2bin(u8 *dst, const char *src, size_t count)
{
while (count--) {
*dst = hex_to_bin(*src++) << 4;
*dst += hex_to_bin(*src++);
dst++;
}
}
EXPORT_SYMBOL(hex2bin);

/**
* hex_dump_to_buffer - convert a blob of data to "hex ASCII" in memory
* @buf: data blob to dump
Expand Down

0 comments on commit 1fbe881

Please sign in to comment.